locationmanager/server/src/clocationmanagersession.cpp
branchRCL_3
changeset 19 b73252188534
parent 12 9f21bab39f42
equal deleted inserted replaced
18:63c982fb92f2 19:b73252188534
    46 // --------------------------------------------------------------------------
    46 // --------------------------------------------------------------------------
    47 //
    47 //
    48 CLocationManagerSession::~CLocationManagerSession()
    48 CLocationManagerSession::~CLocationManagerSession()
    49     {
    49     {
    50     LOG( "CLocationManagerSession::~CLocationManagerSession(), begin" );
    50     LOG( "CLocationManagerSession::~CLocationManagerSession(), begin" );
    51     TRAP_IGNORE(Server().StopGPSPositioningL());
    51     // don't call stop GPS positioning from here...
       
    52     // we are expecting the application to start and stop else on server terminate, we will do the same.
       
    53     // this is not okay when user takes a photograph and then transfer photo using BT/PC .
       
    54     // at this point, it will stop the trail for camera where as camera session is still valid.
       
    55     
       
    56 
    52     Server().CancelNotificationRequest( iNotificationHandle );
    57     Server().CancelNotificationRequest( iNotificationHandle );
    53     Server().CancelLocationRequest( iLocationHandle );
    58     Server().CancelLocationRequest( iLocationHandle );
    54     Server().CancelTrackLogNotificationRequest( iTrackLogNotificationHandle );
    59     Server().CancelTrackLogNotificationRequest( iTrackLogNotificationHandle );
    55     Server().RemoveSession();
    60     Server().RemoveSession();
    56     LOG( "CLocationManagerSession::~CLocationManagerSession(), end" );
    61     LOG( "CLocationManagerSession::~CLocationManagerSession(), end" );
    84 // From CSession2, passes the request forward to DispatchMessageL.
    89 // From CSession2, passes the request forward to DispatchMessageL.
    85 // --------------------------------------------------------------------------
    90 // --------------------------------------------------------------------------
    86 //
    91 //
    87 void CLocationManagerSession::ServiceL( const RMessage2& aMessage )
    92 void CLocationManagerSession::ServiceL( const RMessage2& aMessage )
    88     {
    93     {
    89     LOG( "CLocationManagerSession::ServiceL" );
    94     LOG( "CLocationManagerSession::ServiceL, begin" );
    90     _LIT( KSemaphore, "LocManSynchSemaphore" );
    95     LOG1("Message id - %d", aMessage.Function());
    91     RSemaphore semaphore;
       
    92     const TInt result = semaphore.OpenGlobal( KSemaphore );
       
    93     LOG1( "CLocationManagerSession::ServiceL - semaphore open result: %d", result );
       
    94     iMessage = RMessage2( aMessage );
    96     iMessage = RMessage2( aMessage );
    95     if ( result == KErrNone )
       
    96     	{
       
    97     	semaphore.Signal();
       
    98     	semaphore.Close();
       
    99     	}
       
   100     TRAPD( err, DispatchMessageL( aMessage ) );
    97     TRAPD( err, DispatchMessageL( aMessage ) );
   101     if ( err != KErrNone )
    98     if ( err != KErrNone )
   102         {
    99         {
   103         aMessage.Complete( err );
   100         aMessage.Complete( err );
   104         }    
   101         }    
       
   102     LOG( "CLocationManagerSession::ServiceL, end" );
   105     }
   103     }
   106 
   104 
   107 // --------------------------------------------------------------------------
   105 // --------------------------------------------------------------------------
   108 // CLocationManagerSession::DispatchMessageL
   106 // CLocationManagerSession::DispatchMessageL
   109 // Handles the request from client.
   107 // Handles the request from client.
   178         	GetCaptureSettingL( aMessage );
   176         	GetCaptureSettingL( aMessage );
   179         	break;
   177         	break;
   180         case ELocManCancelTrackLogNotify:
   178         case ELocManCancelTrackLogNotify:
   181         	CancelTrackLogNotificationRequest( aMessage );
   179         	CancelTrackLogNotificationRequest( aMessage );
   182         	break;
   180         	break;
       
   181         case ELocManTagPending:
       
   182         	Server().TagPendingRequestL(aMessage);
       
   183         	break;
       
   184         case ELocManStartGeoTaging:
       
   185             Server().StartGeoTaggingL(aMessage);
       
   186             break;
       
   187         case ELocManCancelTagPendingReq:
       
   188             Server().CancelTagPendingRequest(aMessage);
       
   189 			break;
       
   190 		case ELocManCancelGeoTaggingReq:
       
   191             Server().CancelGeoTaggingRequest(aMessage);
       
   192             break;
   183         default:
   193         default:
   184             aMessage.Complete( KErrArgument );
   194             aMessage.Complete( KErrArgument );
   185             break;
   195             break;
   186         }
   196         }
   187     }
   197     }
   492 	aMessage.WriteL(KParamName, fileName);
   502 	aMessage.WriteL(KParamName, fileName);
   493 	aMessage.Complete( err );
   503 	aMessage.Complete( err );
   494 	}
   504 	}
   495 
   505 
   496 // --------------------------------------------------------------------------
   506 // --------------------------------------------------------------------------
   497 // CLocationManagerSession::GpsQualityChange
   507 // CLocationManagerSession::RegisterTrackLogObserver
   498 // --------------------------------------------------------------------------
   508 // --------------------------------------------------------------------------
   499 //  
   509 //  
   500 void CLocationManagerSession::RegisterTrackLogObserver( const RMessage2& aMessage )
   510 void CLocationManagerSession::RegisterTrackLogObserver( const RMessage2& aMessage )
   501 	{
   511 	{
   502 	iTrackLogNotificationHandle = aMessage.Handle();
   512 	iTrackLogNotificationHandle = aMessage.Handle();
   503 	TRAP_IGNORE( Server().AddTrackLogNotificationRequestL( aMessage ) );
   513 	TRAP_IGNORE( Server().AddTrackLogNotificationRequestL( aMessage ) );
   504 	}
   514 	}
   505 
   515 
       
   516 
       
   517 // --------------------------------------------------------------------------
       
   518 // CLocationManagerSession::GetCaptureSettingL
       
   519 // --------------------------------------------------------------------------
       
   520 //
   506 void CLocationManagerSession::GetCaptureSettingL( const RMessage2& aMessage )
   521 void CLocationManagerSession::GetCaptureSettingL( const RMessage2& aMessage )
   507 	{
   522 	{
   508 	TInt KParamCaptureSetting = 0;
   523 	TInt KParamCaptureSetting = 0;
   509 	RLocationTrail::TTrailCaptureSetting captureSetting = RLocationTrail::EOff;
   524 	RLocationTrail::TTrailCaptureSetting captureSetting = RLocationTrail::EOff;
   510 	
   525