diff -r aa5a574040a4 -r a3cc46f37772 contextengine/plugins/locationplugin/src/locationcontextplugin.cpp --- a/contextengine/plugins/locationplugin/src/locationcontextplugin.cpp Tue Jul 06 14:44:37 2010 +0300 +++ b/contextengine/plugins/locationplugin/src/locationcontextplugin.cpp Fri Sep 17 16:54:49 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;