locationmanager/server/src/clocationmanagersession.cpp
branchRCL_3
changeset 63 e538444823de
parent 47 b73252188534
equal deleted inserted replaced
57:2872ae438bf7 63:e538444823de
    46 // --------------------------------------------------------------------------
    46 // --------------------------------------------------------------------------
    47 //
    47 //
    48 CLocationManagerSession::~CLocationManagerSession()
    48 CLocationManagerSession::~CLocationManagerSession()
    49     {
    49     {
    50     LOG( "CLocationManagerSession::~CLocationManagerSession(), begin" );
    50     LOG( "CLocationManagerSession::~CLocationManagerSession(), begin" );
    51     // don't call stop GPS positioning from here...
    51     TRAP_IGNORE(Server().StopGPSPositioningL());
    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 
       
    57     Server().CancelNotificationRequest( iNotificationHandle );
    52     Server().CancelNotificationRequest( iNotificationHandle );
    58     Server().CancelLocationRequest( iLocationHandle );
    53     Server().CancelLocationRequest( iLocationHandle );
    59     Server().CancelTrackLogNotificationRequest( iTrackLogNotificationHandle );
    54     Server().CancelTrackLogNotificationRequest( iTrackLogNotificationHandle );
    60     Server().RemoveSession();
    55     Server().RemoveSession();
    61     LOG( "CLocationManagerSession::~CLocationManagerSession(), end" );
    56     LOG( "CLocationManagerSession::~CLocationManagerSession(), end" );
    89 // From CSession2, passes the request forward to DispatchMessageL.
    84 // From CSession2, passes the request forward to DispatchMessageL.
    90 // --------------------------------------------------------------------------
    85 // --------------------------------------------------------------------------
    91 //
    86 //
    92 void CLocationManagerSession::ServiceL( const RMessage2& aMessage )
    87 void CLocationManagerSession::ServiceL( const RMessage2& aMessage )
    93     {
    88     {
    94     LOG( "CLocationManagerSession::ServiceL, begin" );
    89     LOG( "CLocationManagerSession::ServiceL" );
    95     LOG1("Message id - %d", aMessage.Function());
    90     _LIT( KSemaphore, "LocManSynchSemaphore" );
       
    91     RSemaphore semaphore;
       
    92     const TInt result = semaphore.OpenGlobal( KSemaphore );
       
    93     LOG1( "CLocationManagerSession::ServiceL - semaphore open result: %d", result );
    96     iMessage = RMessage2( aMessage );
    94     iMessage = RMessage2( aMessage );
       
    95     if ( result == KErrNone )
       
    96     	{
       
    97     	semaphore.Signal();
       
    98     	semaphore.Close();
       
    99     	}
    97     TRAPD( err, DispatchMessageL( aMessage ) );
   100     TRAPD( err, DispatchMessageL( aMessage ) );
    98     if ( err != KErrNone )
   101     if ( err != KErrNone )
    99         {
   102         {
   100         aMessage.Complete( err );
   103         aMessage.Complete( err );
   101         }    
   104         }    
   102     LOG( "CLocationManagerSession::ServiceL, end" );
       
   103     }
   105     }
   104 
   106 
   105 // --------------------------------------------------------------------------
   107 // --------------------------------------------------------------------------
   106 // CLocationManagerSession::DispatchMessageL
   108 // CLocationManagerSession::DispatchMessageL
   107 // Handles the request from client.
   109 // Handles the request from client.
   176         	GetCaptureSettingL( aMessage );
   178         	GetCaptureSettingL( aMessage );
   177         	break;
   179         	break;
   178         case ELocManCancelTrackLogNotify:
   180         case ELocManCancelTrackLogNotify:
   179         	CancelTrackLogNotificationRequest( aMessage );
   181         	CancelTrackLogNotificationRequest( aMessage );
   180         	break;
   182         	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;
       
   193         default:
   183         default:
   194             aMessage.Complete( KErrArgument );
   184             aMessage.Complete( KErrArgument );
   195             break;
   185             break;
   196         }
   186         }
   197     }
   187     }
   502 	aMessage.WriteL(KParamName, fileName);
   492 	aMessage.WriteL(KParamName, fileName);
   503 	aMessage.Complete( err );
   493 	aMessage.Complete( err );
   504 	}
   494 	}
   505 
   495 
   506 // --------------------------------------------------------------------------
   496 // --------------------------------------------------------------------------
   507 // CLocationManagerSession::RegisterTrackLogObserver
   497 // CLocationManagerSession::GpsQualityChange
   508 // --------------------------------------------------------------------------
   498 // --------------------------------------------------------------------------
   509 //  
   499 //  
   510 void CLocationManagerSession::RegisterTrackLogObserver( const RMessage2& aMessage )
   500 void CLocationManagerSession::RegisterTrackLogObserver( const RMessage2& aMessage )
   511 	{
   501 	{
   512 	iTrackLogNotificationHandle = aMessage.Handle();
   502 	iTrackLogNotificationHandle = aMessage.Handle();
   513 	TRAP_IGNORE( Server().AddTrackLogNotificationRequestL( aMessage ) );
   503 	TRAP_IGNORE( Server().AddTrackLogNotificationRequestL( aMessage ) );
   514 	}
   504 	}
   515 
   505 
   516 
       
   517 // --------------------------------------------------------------------------
       
   518 // CLocationManagerSession::GetCaptureSettingL
       
   519 // --------------------------------------------------------------------------
       
   520 //
       
   521 void CLocationManagerSession::GetCaptureSettingL( const RMessage2& aMessage )
   506 void CLocationManagerSession::GetCaptureSettingL( const RMessage2& aMessage )
   522 	{
   507 	{
   523 	TInt KParamCaptureSetting = 0;
   508 	TInt KParamCaptureSetting = 0;
   524 	RLocationTrail::TTrailCaptureSetting captureSetting = RLocationTrail::EOff;
   509 	RLocationTrail::TTrailCaptureSetting captureSetting = RLocationTrail::EOff;
   525 	
   510