locationmanager/server/inc/clocationmanagerserver.h
changeset 36 aa5a574040a4
parent 21 50bf9db68373
child 40 910a23996aa0
equal deleted inserted replaced
35:f727727520eb 36:aa5a574040a4
    22 #include <e32base.h>
    22 #include <e32base.h>
    23 #include <etel3rdparty.h>
    23 #include <etel3rdparty.h>
    24 #include <centralrepository.h>
    24 #include <centralrepository.h>
    25 #include <locationdatatype.h>
    25 #include <locationdatatype.h>
    26 #include <locationeventdef.h>
    26 #include <locationeventdef.h>
       
    27 #ifdef LOC_REVERSEGEOCODE
       
    28 #include <geotagger.h>
       
    29 #endif //LOC_REVERSEGEOCODE
    27 
    30 
    28 #include "rlocationtrail.h"
    31 #include "rlocationtrail.h"
    29 #include "rlocationobjectmanipulator.h"
    32 #include "rlocationobjectmanipulator.h"
    30 #include "clocationrecord.h"
    33 #include "clocationrecord.h"
    31 #include "ctracklog.h"
    34 #include "ctracklog.h"
    33 #include "mdsutils.h"
    36 #include "mdsutils.h"
    34 #include "mdesession.h"
    37 #include "mdesession.h"
    35 #include "mdequery.h"
    38 #include "mdequery.h"
    36 #include "mderelationquery.h"
    39 #include "mderelationquery.h"
    37 #include "locationmanagerdefs.h"
    40 #include "locationmanagerdefs.h"
    38 
    41 #include "clocationservertimerhandler.h"
    39 
    42 
    40 class CMdESession;
    43 class CMdESession;
       
    44 #ifdef LOC_REVERSEGEOCODE
       
    45 class CLocationGeoTagTimerAO;
       
    46 #endif
       
    47 class CGeoTagger;
       
    48 class REComSession;
       
    49 class CNwRegistrationStatusHandler;
    41 
    50 
    42 // Total number of ranges
    51 // Total number of ranges
    43 const TUint KLocationManagerRangeCount = 1;
    52 const TUint KLocationManagerRangeCount = 1;
    44 
    53 
    45 // Definition of the ranges of IPC numbers
    54 // Definition of the ranges of IPC numbers
    83 class CLocationManagerServer : public CPolicyServer,
    92 class CLocationManagerServer : public CPolicyServer,
    84                                public MLocationTrailObserver,
    93                                public MLocationTrailObserver,
    85                                public MMdESessionObserver,
    94                                public MMdESessionObserver,
    86                                public MMdEQueryObserver,
    95                                public MMdEQueryObserver,
    87                                public MMdEObjectObserver,
    96                                public MMdEObjectObserver,
    88                                public MGpxConversionObserver
    97                                public MGpxConversionObserver,
       
    98                                public MGeoTaggerObserver,
       
    99                                public MLocationServerTimerObserver
    89     {
   100     {
    90 private:
   101 private:
    91 	struct TMessageQuery
   102 	struct TMessageQuery
    92 		{
   103 		{
    93 		CMdERelationQuery* iQuery;
   104 		CMdERelationQuery* iQuery;
   257 	 * @since S60 3.2
   268 	 * @since S60 3.2
   258 	 * @param aObjectId
   269 	 * @param aObjectId
   259 	 * @return None.
   270 	 * @return None.
   260 	 */ 
   271 	 */ 
   261 	void RemoveLocationObjectL(TUint& aObjectId);
   272 	void RemoveLocationObjectL(TUint& aObjectId);
       
   273 
       
   274 	/**
       
   275 	  * Copies the location object
       
   276 	  * @param aSource source location object
       
   277 	  *	@param aTargets target location object
       
   278 	  * @param aQuery message query type
       
   279 
       
   280 	  */	
   262 	void CopyLocationObjectL( TItemId aSource, const RArray<TItemId>& aTargets, TMessageQuery& aQuery );
   281 	void CopyLocationObjectL( TItemId aSource, const RArray<TItemId>& aTargets, TMessageQuery& aQuery );
       
   282 
       
   283 	/**
       
   284 	  * Copies the location object
       
   285 	  * @param aSource The source location object
       
   286 	  *	@param aTargets target location object
       
   287 	  * @param aQuery message query type
       
   288 	  */
   263 	void CopyLocationObjectL( const TDesC& aSource, const RArray<TPtrC>& aTargets, TMessageQuery& aQuery );
   289 	void CopyLocationObjectL( const TDesC& aSource, const RArray<TPtrC>& aTargets, TMessageQuery& aQuery );
   264 	
   290 
       
   291 	/**
       
   292 	  * checks if the session is ready
       
   293 	  * @return ETrue if Session is ready
       
   294 	  */	
   265 	TBool IsSessionReady();
   295 	TBool IsSessionReady();
   266 	
   296 
       
   297 	/**
       
   298 	  * Start track log
       
   299 	  *
       
   300 	  * @return The itemId
       
   301 	  */	
   267 	TItemId StartTrackLogL();
   302 	TItemId StartTrackLogL();
   268 	
   303 
       
   304 	/** 
       
   305 	  * Stop track log
       
   306 	  *
       
   307 	  */	
   269 	void StopTrackLogL();
   308 	void StopTrackLogL();
   270 	
   309 
       
   310 	/**
       
   311 	  * IsTrackLogRecording
       
   312 	  *
       
   313 	  * @param aRec
       
   314 	  */	
   271 	void IsTrackLogRecording( TBool &aRec );
   315 	void IsTrackLogRecording( TBool &aRec );
   272 	
   316 	
       
   317 	/**
       
   318 	  * Retrieve track log status
       
   319 	  *
       
   320 	  * @param aRecording 
       
   321 	  * @param aFixQuality
       
   322 	  */
   273 	TInt GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality);
   323 	TInt GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality);
   274 	
   324 
       
   325 	/**
       
   326 	  * Delete track log
       
   327 	  *
       
   328 	  * @param aUri 
       
   329 	  */	
   275 	TInt DeleteTrackLogL(const TDesC& aUri);
   330 	TInt DeleteTrackLogL(const TDesC& aUri);
   276 	
   331 
       
   332 	/**
       
   333 	  * Track log name
       
   334 	  *
       
   335 	  * @param aFileName name of file used to track log
       
   336 	  */	
   277 	TInt TrackLogName(TFileName& aFileName);
   337 	TInt TrackLogName(TFileName& aFileName);
   278 	
   338 	
       
   339 	/**
       
   340 	  * Gets the location trail capture settings
       
   341 	  * @param aCaptureSetting The location trail capture settings
       
   342 	  */	
   279 	void GetCaptureSetting( RLocationTrail::TTrailCaptureSetting& aCaptureSetting );
   343 	void GetCaptureSetting( RLocationTrail::TTrailCaptureSetting& aCaptureSetting );
   280 	
   344 
       
   345 	/**
       
   346 	  * Adds an observer  for Gpx conversion
       
   347 	  * @param aObserver the observer for Gpx conversion
       
   348 	  */
   281 	void AddGpxObserver( MGpxConversionObserver* aObserver );
   349 	void AddGpxObserver( MGpxConversionObserver* aObserver );
   282 	
   350 	
       
   351 	/**
       
   352 	  * Copy location by Id
       
   353 	  * @param aMessage
       
   354 	  */	
   283 	void InitCopyLocationByIdL( const RMessage2& aMessage );
   355 	void InitCopyLocationByIdL( const RMessage2& aMessage );
       
   356 	
       
   357 	/**
       
   358 	  * Copy Location by Uri
       
   359 	  * @param aMessage
       
   360 	  */
   284 	void InitCopyLocationByURIL( const RMessage2& aMessage );
   361 	void InitCopyLocationByURIL( const RMessage2& aMessage );
   285 
   362 
       
   363 	/**
       
   364 	  * Handles tag pending request
       
   365 	  *
       
   366 	  * @param aMessage IPC message
       
   367 	  */	
       
   368     void TagPendingRequestL( const RMessage2& aMessage );
       
   369 
       
   370 	/**
       
   371 	  * Cancels the tag pending request
       
   372 	  * @param aMessage IPC message
       
   373 	  */	
       
   374     void CancelTagPendingRequest( const RMessage2& aMessage );
       
   375 
       
   376 	/**
       
   377 	  * Cancels the geotagging request
       
   378 	  * @param aMessage IPC message
       
   379 	  */
       
   380 	void CancelGeoTaggingRequest( const RMessage2& aMessage );
       
   381 
       
   382 
       
   383 	/**
       
   384 	  * Handle starts geotagging request
       
   385 	  * @param aMessage IPC message
       
   386 	  */
       
   387     void StartGeoTaggingL( const RMessage2& aMessage );
       
   388     
   286 public: // from MLocationTrailObserver.
   389 public: // from MLocationTrailObserver.
   287     /**
   390     /**
   288      * Callback method to get notification about trail state change.
   391      * Callback method to get notification about trail state change.
   289      * @since S60 3.1
   392      * @since S60 3.1
   290      * @param None.
   393      * @param None.
   338 public: // from MGpxConversionObserver
   441 public: // from MGpxConversionObserver
   339 
   442 
   340 	void GpxFileCreated( const TDesC& aFileName, TItemId aTagId, TReal32 aLength,
   443 	void GpxFileCreated( const TDesC& aFileName, TItemId aTagId, TReal32 aLength,
   341 			TTime aStart, TTime aEnd );
   444 			TTime aStart, TTime aEnd );
   342 
   445 
       
   446 protected:  //From MGeoTaggerObserver
       
   447 
       
   448 	/**
       
   449 	  * This method is called on completion of geotagging
       
   450 	  * and also completes start geotagging IPC message
       
   451 	  * @param aError The err code for geotagging if any
       
   452 	  */
       
   453      void GeoTaggingCompleted( const TInt aError );   
       
   454      /**
       
   455       * This method is used for notifying completion of query for pending geo tags
       
   456 	  * @param aError The err code for geotagging if any           
       
   457       */
       
   458      void PendingGeoTagReqComplete( const TInt aError );
       
   459 
       
   460     /*
       
   461     * Get registrer network country code
       
   462     *
       
   463     * @return current register n/w info
       
   464     */
       
   465     RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw();
       
   466 
       
   467 
       
   468     /*
       
   469     * Get home network country code
       
   470     * @param aHomeNwInfoAvailableFlag ETrue if home n/w info available else EFalse
       
   471     * @return user home n/w info
       
   472     */
       
   473     const RMobilePhone::TMobilePhoneNetworkInfoV1& 
       
   474         GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag);
       
   475 
       
   476     
       
   477     /*
       
   478     * UE is registered to home network?
       
   479     *
       
   480     * @return ETrue if UE is registered at home network else EFalse
       
   481     */
       
   482     TBool IsRegisteredAtHomeNetwork();
       
   483 
       
   484 public: //MLocationServerTimerObserver
       
   485     /**
       
   486         * Timer call back
       
   487         * @param aLocationServerTimerType timer type
       
   488         * @param aErrorCode error code
       
   489         */
       
   490     void LocationServerTimerCallBackL
       
   491         (const TLocationServerTimerType aLocationServerTimerType, const TInt aErrorCode);
   343 private:    
   492 private:    
   344     /**
   493     /**
   345     * C++ constructor.
   494     * C++ constructor.
   346     */
   495     */
   347     CLocationManagerServer();
   496     CLocationManagerServer();
   348     
   497     
   349     /**
   498     /**
   350     * 2nd phase constructor.
   499     * 2nd phase constructor.
   351     */
   500     */
   352     void ConstructL();
   501     void ConstructL();
   353     
   502 
       
   503 	/**
       
   504 	  * Copies the location
       
   505 	  * @param aQuery The query
       
   506 	  */	
   354     void CopyLocationL( CMdEQuery& aQuery );
   507     void CopyLocationL( CMdEQuery& aQuery );
   355 
   508 
   356     /**
   509     /**
   357      * Go through all messages in lists, complete request
   510      * Go through all messages in lists, complete request
   358      * with KErrCancel status and remove items from list.
   511      * with KErrCancel status and remove items from list.
   359      */ 
   512      */ 
   360     void CancelRequests(RArray<RMessage2>& aMessagesList);
   513     void CancelRequests(RArray<RMessage2>& aMessagesList);
   361     
   514     
   362     
   515     /**
       
   516 	  * cancels the list of copy requests
       
   517 	  * @param aMessageList  the list of query 
       
   518 	  */
   363     void CancelCopyRequests(RArray<TMessageQuery>& aMessageList);
   519     void CancelCopyRequests(RArray<TMessageQuery>& aMessageList);
   364     
   520     
   365     /**
   521     /**
   366      * Create a new tracklog tag object in the database.
   522      * Create a new tracklog tag object in the database.
   367      * @return TItemId tag ID in the database
   523      * @return TItemId tag ID in the database
   394     /**
   550     /**
   395      * Callback function for positioning stop timer.
   551      * Callback function for positioning stop timer.
   396      * @param aAny, a pointer to CLocationRecord object
   552      * @param aAny, a pointer to CLocationRecord object
   397      * @return Error code
   553      * @return Error code
   398      */
   554      */
   399     static TInt PositioningStopTimeout( TAny* aAny );
   555    void PositioningStopTimeout();
   400     
   556     
   401     /**
   557     /**
   402      * Callback function to check if files were added to remapping queue with delay
   558      * Callback function to check if files were added to remapping queue with delay
   403      * @param aAny, a pointer to CLocationRecord object
   559      * @param aAny, a pointer to CLocationRecord object
   404      * @return Error code
   560      * @return Error code
   405      */
   561      */
   406     static TInt CheckForRemappingCallback( TAny* aAny );
   562     void CheckForRemappingCallback();
       
   563 
   407     
   564     
   408     /**
   565     /**
   409      * Stops location trail and deletes the positioning stop timer.
   566      * Stops location trail and deletes the positioning stop timer.
   410      */
   567      */
   411     void StopRecording();
   568     void StopRecording();
   412     
   569 
       
   570 	/**
       
   571 	  * Complete notify request
       
   572 	  *
       
   573 	  * @param aEventType, returns the event type
       
   574 	  * @param aError, return error type for this call.
       
   575 	  */	
   413     void CompleteNotifyRequest( TEventTypes aEventType, TInt aError );
   576     void CompleteNotifyRequest( TEventTypes aEventType, TInt aError );
       
   577 
       
   578     /**
       
   579       * Get supported TSY name
       
   580       *@param aTsyName - buffer to store the supported tsy name
       
   581       */  
       
   582     void GetCommDbTSYnameL(TDes& aTsyName);
       
   583 
       
   584     /**
       
   585       * Initialize etel to access modem parameters
       
   586       */  
       
   587     void InitialisePhoneL();
       
   588 
       
   589     /**
       
   590       * Retrieve home network
       
   591       */  
       
   592     void RetrieveHomeNetwork();
   414 
   593 
   415 private:
   594 private:
   416     /**
   595     /**
   417      * A class for recording and storing locations.
   596      * A class for recording and storing locations.
   418      * Own.
   597      * Own.
   464     
   643     
   465     /**
   644     /**
   466      * A timer to stop location trail.
   645      * A timer to stop location trail.
   467      * Own.
   646      * Own.
   468      */
   647      */
   469     CPeriodic* iTimer;
   648     CLocationServerTimerHandler* iTimer;
   470     
   649     
   471     TBool iClientSwitch;    
   650     TBool iClientSwitch;    
   472     TInt iSessionCount;
   651     TInt iSessionCount;
   473     TBool iSessionReady;  
   652     TBool iSessionReady;  
   474     
   653     
   476     TItemId iTagId;
   655     TItemId iTagId;
   477     TInt iLocManStopDelay;
   656     TInt iLocManStopDelay;
   478     TInt iLocManStopRemapDelay;
   657     TInt iLocManStopRemapDelay;
   479     
   658     
   480     RLocationTrail::TTrailCaptureSetting iCaptureSetting;
   659     RLocationTrail::TTrailCaptureSetting iCaptureSetting;
   481     TBool iRemoveLocation;   
   660     TBool iRemoveLocation;    
   482     
   661     
   483     /**
   662     /**
   484      * A flag for state of waiting for position stop timeout.
   663      * A flag for state of waiting for position stop timeout.
   485      */
   664      */
   486     TBool iWaitForPositioningStopTimeout;
   665     TBool iWaitForPositioningStopTimeout;
       
   666 	RTelServer		iTelServer;
       
   667 	RMobilePhone	iPhone;	
       
   668 	TBool			iTelServerIsOpen;
       
   669 	TBool			iPhoneIsOpen;
       
   670     CNwRegistrationStatusHandler *iNwRegistrationStatusHandler;
       
   671     RMobilePhone::TMobilePhoneNetworkInfoV1 iHomeNetwork;
       
   672     TBool iHomeNwInfoAvailableFlag;
       
   673   
       
   674 #ifdef LOC_REVERSEGEOCODE
       
   675     CLocationGeoTagTimerAO* iGeoTagTimer;
       
   676     CGeoTagger* iGeoTaggingPendingReqObj;
       
   677     RMessage2 iTagPendingMessage;
       
   678     RMessage2 iGeoTaggingMessage;
       
   679     REComSession* iEcomSession; 
       
   680 #endif //LOC_REVERSEGEOCODE
   487     };
   681     };
   488 
   682 
   489 
   683 
   490 #endif // C_CLOCATIONMANAGERSERVER_H
   684 #endif // C_CLOCATIONMANAGERSERVER_H
   491 
   685