136 aHD.SetErrorCode( KErrNone ); |
136 aHD.SetErrorCode( KErrNone ); |
137 aObserver.PluginSnapshotStatus( &aHD ); |
137 aObserver.PluginSnapshotStatus( &aHD ); |
138 return; |
138 return; |
139 } |
139 } |
140 |
140 |
141 if ( !iLocationTrailConnected ) // no trail, no snapshot |
141 if ( !iLocationTrailConnected ) |
142 { |
142 { |
143 aHD.SetErrorCode( KErrDisconnected ); |
143 WRITELOG( "CLocationContextPlugin::ContextSnapshot() - try to reconnect" ); |
144 aObserver.PluginSnapshotStatus( &aHD ); |
144 iManipulator.Close(); |
145 return; |
145 iLocationTrail.Close(); |
|
146 TInt err = iLocationTrail.Connect(); |
|
147 if ( err == KErrNone ) |
|
148 { |
|
149 err = iManipulator.Connect(); |
|
150 if( err == KErrNone ) |
|
151 { |
|
152 iLocationTrailConnected = ETrue; |
|
153 } |
|
154 } |
|
155 |
|
156 if (err != KErrNone ) |
|
157 { |
|
158 // no trail, no snapshot |
|
159 aHD.SetErrorCode( KErrDisconnected ); |
|
160 aObserver.PluginSnapshotStatus( &aHD ); |
|
161 return; |
|
162 } |
146 } |
163 } |
147 |
164 |
148 TInt ret = KErrNone; |
165 TInt ret = KErrNone; |
149 |
166 |
150 ret = iManipulator.LocationSnapshot( aHD.MdeObject().Id() ); |
167 ret = iManipulator.LocationSnapshot( aHD.MdeObject().Id() ); |
|
168 |
|
169 if( ret == KErrServerTerminated ) |
|
170 { |
|
171 iLocationTrailConnected = EFalse; |
|
172 } |
151 |
173 |
152 if( ret != KErrNone ) |
174 if( ret != KErrNone ) |
153 { |
175 { |
154 ret = KErrCompletion; |
176 ret = KErrCompletion; |
155 } |
177 } |