diff -r 85f623e1ef41 -r 29d87345eaeb contextengine/plugins/locationplugin/src/locationcontextplugin.cpp --- a/contextengine/plugins/locationplugin/src/locationcontextplugin.cpp Wed Sep 01 12:24:24 2010 +0100 +++ b/contextengine/plugins/locationplugin/src/locationcontextplugin.cpp Tue Sep 14 22:10:25 2010 +0300 @@ -138,17 +138,39 @@ return; } - if ( !iLocationTrailConnected ) // no trail, no snapshot - { - aHD.SetErrorCode( KErrDisconnected ); - aObserver.PluginSnapshotStatus( &aHD ); - return; + if ( !iLocationTrailConnected ) + { + WRITELOG( "CLocationContextPlugin::ContextSnapshot() - try to reconnect" ); + iManipulator.Close(); + iLocationTrail.Close(); + TInt err = iLocationTrail.Connect(); + if ( err == KErrNone ) + { + err = iManipulator.Connect(); + if( err == KErrNone ) + { + iLocationTrailConnected = ETrue; + } + } + + if (err != KErrNone ) + { + // no trail, no snapshot + aHD.SetErrorCode( KErrDisconnected ); + aObserver.PluginSnapshotStatus( &aHD ); + return; + } } TInt ret = KErrNone; ret = iManipulator.LocationSnapshot( aHD.MdeObject().Id() ); + if( ret == KErrServerTerminated ) + { + iLocationTrailConnected = EFalse; + } + if( ret != KErrNone ) { ret = KErrCompletion;