changeset 36 | aa5a574040a4 |
parent 25 | 8e4539ab1889 |
child 40 | 910a23996aa0 |
child 45 | a93990e5815e |
35:f727727520eb | 36:aa5a574040a4 |
---|---|
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <e32debug.h> |
18 #include <e32debug.h> |
19 #include <w32std.h> |
19 #include <w32std.h> |
20 #include <ecom.h> |
|
21 #include <commsdattypesv1_1.h> |
|
22 #include <cdblen.h> |
|
23 #include <commsdat_partner.h> |
|
20 |
24 |
21 #include "clocationmanagerserver.h" |
25 #include "clocationmanagerserver.h" |
22 #include "clocationmanagersession.h" |
26 #include "clocationmanagersession.h" |
23 |
27 |
24 #include "locationtraildefs.h" |
28 #include "locationtraildefs.h" |
27 #include "mdesession.h" |
31 #include "mdesession.h" |
28 #include "mdenamespacedef.h" |
32 #include "mdenamespacedef.h" |
29 #include "mdeobjectdef.h" |
33 #include "mdeobjectdef.h" |
30 #include "mdepropertydef.h" |
34 #include "mdepropertydef.h" |
31 #include "mdcserializationbuffer.h" |
35 #include "mdcserializationbuffer.h" |
36 #ifdef LOC_REVERSEGEOCODE |
|
37 #include "clocationgeotagtimerao.h" |
|
38 #endif //LOC_REVERSEGEOCODE |
|
39 #include "nwregistrationstatushandler.h" |
|
32 |
40 |
33 using namespace MdeConstants; |
41 using namespace MdeConstants; |
42 using namespace CommsDat; |
|
43 |
|
34 |
44 |
35 // -------------------------------------------------------------------------- |
45 // -------------------------------------------------------------------------- |
36 // RunServerL |
46 // RunServerL |
37 // Initialize and run the server. |
47 // Initialize and run the server. |
38 // -------------------------------------------------------------------------- |
48 // -------------------------------------------------------------------------- |
92 // |
102 // |
93 CLocationManagerServer::CLocationManagerServer() |
103 CLocationManagerServer::CLocationManagerServer() |
94 : CPolicyServer( CActive::EPriorityStandard, |
104 : CPolicyServer( CActive::EPriorityStandard, |
95 KLocationManagerPolicy, |
105 KLocationManagerPolicy, |
96 ESharableSessions ), |
106 ESharableSessions ), |
107 iASW(NULL), |
|
97 iTimer( NULL ), |
108 iTimer( NULL ), |
98 iSessionReady( EFalse ), |
109 iSessionReady( EFalse ), |
99 iTagId( 0 ), |
110 iTagId( 0 ), |
100 iLocManStopDelay( 0 ), |
111 iLocManStopDelay( 0 ), |
101 iLocManStopRemapDelay( 0 ), |
112 iLocManStopRemapDelay( 0 ), |
102 iCaptureSetting( RLocationTrail::EOff ), |
113 iCaptureSetting( RLocationTrail::EOff ), |
103 iRemoveLocation( EFalse ), |
114 iRemoveLocation( EFalse ), |
104 iWaitForPositioningStopTimeout ( EFalse ) |
115 iWaitForPositioningStopTimeout ( EFalse ), |
116 iTelServerIsOpen(EFalse), |
|
117 iPhoneIsOpen(EFalse), |
|
118 iNwRegistrationStatusHandler(NULL), |
|
119 iHomeNwInfoAvailableFlag(EFalse) |
|
120 #ifdef LOC_REVERSEGEOCODE |
|
121 ,iGeoTagTimer(NULL) |
|
122 ,iGeoTaggingPendingReqObj(NULL) |
|
123 ,iEcomSession(NULL) |
|
124 #endif //LOC_REVERSEGEOCODE |
|
105 { |
125 { |
106 } |
126 } |
107 |
127 |
108 // -------------------------------------------------------------------------- |
128 // -------------------------------------------------------------------------- |
109 // CLocationManagerServer::ConstructL |
129 // CLocationManagerServer::ConstructL |
117 StartL( KLocServerName ); |
137 StartL( KLocServerName ); |
118 |
138 |
119 RProcess process; |
139 RProcess process; |
120 process.SetPriority( EPriorityBackground ); |
140 process.SetPriority( EPriorityBackground ); |
121 process.Close(); |
141 process.Close(); |
122 |
142 |
143 // initialize etel |
|
144 InitialisePhoneL(); |
|
145 |
|
146 #ifdef LOC_REVERSEGEOCODE |
|
147 iEcomSession = &(REComSession::OpenL()); |
|
148 #endif //LOC_REVERSEGEOCODE |
|
149 |
|
123 iASW = new (ELeave) CActiveSchedulerWait(); |
150 iASW = new (ELeave) CActiveSchedulerWait(); |
151 |
|
152 iNwRegistrationStatusHandler = CNwRegistrationStatusHandler::NewL(iPhone); |
|
153 |
|
124 iMdeSession = CMdESession::NewL( *this ); |
154 iMdeSession = CMdESession::NewL( *this ); |
125 iLocationRecord = CLocationRecord::NewL(); |
155 iLocationRecord = CLocationRecord::NewL(*this, iPhone); |
126 iTrackLog = CTrackLog::NewL(); |
156 iTrackLog = CTrackLog::NewL(); |
127 |
157 |
128 iASW->Start(); |
158 iASW->Start(); |
129 |
159 delete iASW; |
130 iLocationRecord->SetObserver( this ); |
160 iASW = NULL; |
131 |
161 if(iSessionReady) |
132 iLocationRecord->SetAddObserver( iTrackLog ); |
162 { |
133 |
163 LOG("Session is ready to give service"); |
134 iTrackLog->AddGpxObserver( this ); |
164 |
135 |
165 iLocationRecord->SetObserver( this ); |
136 CRepository* repository = CRepository::NewLC( KRepositoryUid ); |
166 |
137 TInt err = repository->Get( KLocationTrailShutdownTimer, iLocManStopDelay ); |
167 iLocationRecord->SetAddObserver( iTrackLog ); |
138 |
168 |
139 LOG1("CLocationManagerServer::ConstructL, iLocManStopDelay:%d", iLocManStopDelay); |
169 iTrackLog->AddGpxObserver( this ); |
140 |
170 |
141 if ( err != KErrNone ) |
171 CRepository* repository = CRepository::NewLC( KRepositoryUid ); |
142 { |
172 TInt err = repository->Get( KLocationTrailShutdownTimer, iLocManStopDelay ); |
143 LOG1("CLocationManagerServer::ConstructL, iLocManStopDelay err:%d", err); |
173 |
144 iLocManStopDelay = KLocationTrailShutdownDelay; |
174 LOG1("CLocationManagerServer::ConstructL, iLocManStopDelay:%d", iLocManStopDelay); |
145 } |
175 |
146 |
176 if ( err != KErrNone ) |
147 err = repository->Get( KLocationTrailRemapShutdownTimer, iLocManStopRemapDelay ); |
177 { |
148 CleanupStack::PopAndDestroy( repository ); |
178 LOG1("CLocationManagerServer::ConstructL, iLocManStopDelay err:%d", err); |
149 |
179 iLocManStopDelay = KLocationTrailShutdownDelay; |
150 LOG1("CLocationManagerServer::ConstructL, iLocManStopRemapDelay:%d", iLocManStopRemapDelay); |
180 } |
151 |
181 |
152 if ( err != KErrNone ) |
182 err = repository->Get( KLocationTrailRemapShutdownTimer, iLocManStopRemapDelay ); |
153 { |
183 CleanupStack::PopAndDestroy( repository ); |
154 LOG1("CLocationManagerServer::ConstructL, iLocManStopRemapDelay err:%d", err); |
184 |
155 iLocManStopRemapDelay = KLocationTrailRemapShutdownDelay; |
185 LOG1("CLocationManagerServer::ConstructL, iLocManStopRemapDelay:%d", iLocManStopRemapDelay); |
156 } |
186 |
157 |
187 if ( err != KErrNone ) |
158 TRAPD( error, iTimer = CPeriodic::NewL( CActive::EPriorityUserInput ) ); |
188 { |
159 if ( error != KErrNone ) |
189 LOG1("CLocationManagerServer::ConstructL, iLocManStopRemapDelay err:%d", err); |
160 { |
190 iLocManStopRemapDelay = KLocationTrailRemapShutdownDelay; |
161 LOG("CLocationManagerServer::ConstructL - iTimer not created"); |
191 } |
162 iTimer = NULL; |
192 |
163 } |
193 #ifdef LOC_REVERSEGEOCODE |
164 |
194 //Create the instance of the geotagging timer object |
165 |
195 iGeoTagTimer = CLocationGeoTagTimerAO::NewL(*iMdeSession, *this); |
196 //Schedule a task for geotagging every day at 3.00 AM |
|
197 iGeoTagTimer->StartTimer(); |
|
198 #endif //LOC_REVERSEGEOCODE |
|
199 } |
|
200 else |
|
201 { |
|
202 LOG("Unable to open MDE session. Closing.."); |
|
203 User::Leave(KErrCouldNotConnect); |
|
204 } |
|
166 LOG ("CLocationManagerServer::ConstructL() end"); |
205 LOG ("CLocationManagerServer::ConstructL() end"); |
167 } |
206 } |
168 |
207 |
169 // -------------------------------------------------------------------------- |
208 // -------------------------------------------------------------------------- |
170 // CLocationManagerServer::~CLocationManagerServer() |
209 // CLocationManagerServer::~CLocationManagerServer() |
171 // C++ destructor. |
210 // C++ destructor. |
172 // -------------------------------------------------------------------------- |
211 // -------------------------------------------------------------------------- |
173 // |
212 // |
174 CLocationManagerServer::~CLocationManagerServer() |
213 CLocationManagerServer::~CLocationManagerServer() |
175 { |
214 { |
215 LOG("CLocationManagerServer::~CLocationManagerServer ,begin"); |
|
216 |
|
217 #ifdef LOC_REVERSEGEOCODE |
|
218 delete iGeoTagTimer; |
|
219 delete iGeoTaggingPendingReqObj; |
|
220 #endif //LOC_REVERSEGEOCODE |
|
221 |
|
176 delete iLocationRecord; |
222 delete iLocationRecord; |
177 delete iTrackLog; |
223 delete iTrackLog; |
178 delete iTimer; |
224 delete iTimer; |
179 //delete iRelationQuery; |
|
180 delete iASW; |
225 delete iASW; |
181 delete iMdeSession; |
226 delete iMdeSession; |
182 |
227 delete iNwRegistrationStatusHandler; |
183 iTargetObjectIds.Close(); |
228 iTargetObjectIds.Close(); |
184 CancelRequests(iNotifReqs); |
229 CancelRequests(iNotifReqs); |
185 iNotifReqs.Close(); |
230 iNotifReqs.Close(); |
186 CancelRequests(iLocationReqs); |
231 CancelRequests(iLocationReqs); |
187 iLocationReqs.Close(); |
232 iLocationReqs.Close(); |
188 CancelRequests(iTrackLogNotifyReqs); |
233 CancelRequests(iTrackLogNotifyReqs); |
189 iTrackLogNotifyReqs.Close(); |
234 iTrackLogNotifyReqs.Close(); |
190 CancelCopyRequests(iCopyReqs); |
235 CancelCopyRequests(iCopyReqs); |
191 iCopyReqs.Close(); |
236 iCopyReqs.Close(); |
192 iSessionCount = 0; |
237 iSessionCount = 0; |
193 } |
238 if(iPhoneIsOpen) |
194 // -------------------------------------------------------------------------- |
239 { |
195 // CLocationManagerServer::CompleteRequests() |
240 iPhoneIsOpen = EFalse; // not required |
241 iPhone.Close(); |
|
242 } |
|
243 if(iTelServerIsOpen) |
|
244 { |
|
245 iTelServerIsOpen = EFalse; |
|
246 iTelServer.Close(); |
|
247 } |
|
248 #ifdef LOC_REVERSEGEOCODE |
|
249 if(iEcomSession) |
|
250 { |
|
251 iEcomSession->Close(); |
|
252 } |
|
253 #endif //LOC_REVERSEGEOCODE |
|
254 LOG("CLocationManagerServer::~CLocationManagerServer ,end"); |
|
255 } |
|
256 |
|
257 // -------------------------------------------------------------------------- |
|
258 // CLocationManagerServer::GetCommDbTSYnameL |
|
259 // -------------------------------------------------------------------------- |
|
260 // |
|
261 void CLocationManagerServer::GetCommDbTSYnameL(TDes& aTsyName) |
|
262 { |
|
263 LOG( "CLocationManagerServer::GetCommDbTSYnameL(), begin" ); |
|
264 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
265 CMDBSession* db = CMDBSession::NewL(KCDVersion1_2); |
|
266 #else |
|
267 CMDBSession* db = CMDBSession::NewL(KCDVersion1_1); |
|
268 #endif |
|
269 CleanupStack::PushL(db); |
|
270 |
|
271 CMDBField<TDesC>* globalSettingField = new(ELeave) CMDBField<TDesC>(KCDTIdBearerAvailabilityCheckTSY); |
|
272 CleanupStack::PushL(globalSettingField); |
|
273 globalSettingField->SetRecordId(1); |
|
274 globalSettingField->SetMaxLengthL(KMaxTextLength); |
|
275 globalSettingField->LoadL(*db); |
|
276 aTsyName = *globalSettingField; |
|
277 CleanupStack::PopAndDestroy(globalSettingField); |
|
278 |
|
279 CleanupStack::PopAndDestroy(db); |
|
280 LOG( "CLocationManagerServer::GetCommDbTSYnameL(), end" ); |
|
281 } |
|
282 |
|
283 // -------------------------------------------------------------------------- |
|
284 // CLocationManagerServer::InitialisePhoneL |
|
285 // -------------------------------------------------------------------------- |
|
286 // |
|
287 void CLocationManagerServer::InitialisePhoneL() |
|
288 { |
|
289 LOG( "CLocationManagerServer::InitialisePhoneL(), begin" ); |
|
290 User::LeaveIfError(iTelServer.Connect()); |
|
291 iTelServerIsOpen = ETrue; |
|
292 TBuf<KCommsDbSvrMaxFieldLength> tsyName; |
|
293 GetCommDbTSYnameL(tsyName); |
|
294 |
|
295 User::LeaveIfError(iTelServer.LoadPhoneModule(tsyName)); |
|
296 |
|
297 TInt numPhones; |
|
298 User::LeaveIfError(iTelServer.EnumeratePhones(numPhones)); |
|
299 |
|
300 TInt phoneIndx; |
|
301 TInt ret = KErrHardwareNotAvailable; |
|
302 |
|
303 for(phoneIndx=0; phoneIndx<numPhones; phoneIndx++) |
|
304 { |
|
305 RTelServer::TPhoneInfo tInfo; |
|
306 ret = iTelServer.GetPhoneInfo(phoneIndx, tInfo); |
|
307 if(ret != KErrNone) |
|
308 { |
|
309 continue; |
|
310 } |
|
311 |
|
312 ret = iPhone.Open(iTelServer, tInfo.iName); |
|
313 if(ret != KErrNone) |
|
314 { |
|
315 continue; |
|
316 } |
|
317 |
|
318 iPhoneIsOpen = ETrue; |
|
319 |
|
320 RPhone::TStatus status; |
|
321 User::LeaveIfError(iPhone.GetStatus(status)); |
|
322 if(status.iModemDetected!=RPhone::EDetectedPresent) |
|
323 { |
|
324 ret = iPhone.Initialise(); |
|
325 if(ret != KErrNone) |
|
326 { |
|
327 iPhone.Close(); |
|
328 iPhoneIsOpen = EFalse; |
|
329 continue; |
|
330 } |
|
331 } |
|
332 // we found the correct phone |
|
333 break; |
|
334 } |
|
335 |
|
336 // |
|
337 // ret will be KErrNone if a valid phone was found... |
|
338 // |
|
339 |
|
340 LOG1( "CLocationManagerServer::InitialisePhoneL(), end. Err - %d", ret ); |
|
341 User::LeaveIfError(ret); |
|
342 } |
|
343 |
|
344 |
|
345 // -------------------------------------------------------------------------- |
|
346 // CLocationManagerServer::CancelRequests() |
|
196 // -------------------------------------------------------------------------- |
347 // -------------------------------------------------------------------------- |
197 // |
348 // |
198 void CLocationManagerServer::CancelRequests(RArray<RMessage2>& aMessageList) |
349 void CLocationManagerServer::CancelRequests(RArray<RMessage2>& aMessageList) |
199 { |
350 { |
200 const TInt count = aMessageList.Count(); |
351 const TInt count = aMessageList.Count(); |
209 } |
360 } |
210 } |
361 } |
211 aMessageList.Reset(); |
362 aMessageList.Reset(); |
212 } |
363 } |
213 |
364 |
365 // -------------------------------------------------------------------------- |
|
366 // CLocationManagerServer::CancelCopyRequests |
|
367 // -------------------------------------------------------------------------- |
|
368 // |
|
214 void CLocationManagerServer::CancelCopyRequests(RArray<TMessageQuery>& aMessageList) |
369 void CLocationManagerServer::CancelCopyRequests(RArray<TMessageQuery>& aMessageList) |
215 { |
370 { |
216 const TInt count = aMessageList.Count(); |
371 const TInt count = aMessageList.Count(); |
217 |
372 |
218 for ( TInt i(0) ; i < count; i++ ) |
373 for ( TInt i(0) ; i < count; i++ ) |
225 } |
380 } |
226 } |
381 } |
227 aMessageList.Reset(); |
382 aMessageList.Reset(); |
228 } |
383 } |
229 |
384 |
230 |
385 // -------------------------------------------------------------------------- |
386 // CLocationManagerServer::HandleSessionOpened |
|
387 // -------------------------------------------------------------------------- |
|
388 // |
|
231 void CLocationManagerServer::HandleSessionOpened(CMdESession& /*aSession*/, TInt aError) |
389 void CLocationManagerServer::HandleSessionOpened(CMdESession& /*aSession*/, TInt aError) |
232 { |
390 { |
233 if ( iASW->IsStarted() ) |
391 LOG ("CLocationManagerServer::HandleSessionOpened() start"); |
392 if ( iASW && iASW->IsStarted() ) |
|
234 { |
393 { |
235 iASW->AsyncStop(); |
394 iASW->AsyncStop(); |
236 } |
395 } |
237 |
396 |
238 if ( KErrNone == aError ) |
397 if ( KErrNone == aError ) |
247 delete iMdeSession; |
406 delete iMdeSession; |
248 iMdeSession = NULL; |
407 iMdeSession = NULL; |
249 } |
408 } |
250 } |
409 } |
251 |
410 |
252 void CLocationManagerServer::HandleSessionError(CMdESession& /*aSession*/, TInt /*aError*/) |
411 |
253 { |
412 // -------------------------------------------------------------------------- |
413 // CLocationManagerServer::HandleSessionError |
|
414 // -------------------------------------------------------------------------- |
|
415 // |
|
416 void CLocationManagerServer::HandleSessionError(CMdESession& /*aSession*/, TInt aError) |
|
417 { |
|
418 LOG1 ("CLocationManagerServer::HandleSessionError() start, Error - %d", aError); |
|
419 ARG_USED(aError); |
|
254 iSessionReady = EFalse; |
420 iSessionReady = EFalse; |
255 delete iMdeSession; |
421 delete iMdeSession; |
256 iMdeSession = NULL; |
422 iMdeSession = NULL; |
257 |
423 |
258 if ( iASW->IsStarted() ) |
424 if ( iASW && iASW->IsStarted() ) |
259 { |
425 { |
260 iASW->AsyncStop(); |
426 iASW->AsyncStop(); |
261 } |
427 } |
262 } |
428 } |
263 |
429 |
430 |
|
431 |
|
432 // -------------------------------------------------------------------------- |
|
433 // CLocationManagerServer::IsSessionReady |
|
434 // -------------------------------------------------------------------------- |
|
435 // |
|
264 TBool CLocationManagerServer::IsSessionReady() |
436 TBool CLocationManagerServer::IsSessionReady() |
265 { |
437 { |
266 return iSessionReady; |
438 return iSessionReady; |
267 } |
439 } |
268 |
440 |
301 // -------------------------------------------------------------------------- |
473 // -------------------------------------------------------------------------- |
302 // |
474 // |
303 void CLocationManagerServer::RemoveSession() |
475 void CLocationManagerServer::RemoveSession() |
304 { |
476 { |
305 iSessionCount--; |
477 iSessionCount--; |
306 if ( !iSessionCount ) |
478 if ( !iSessionCount |
307 { |
479 && iLocationRecord |
480 && !iLocationRecord->TaggingInProgress()) |
|
481 { |
|
482 // Nothing in progress. shutdown the server |
|
308 CActiveScheduler::Stop(); |
483 CActiveScheduler::Stop(); |
309 } |
484 } |
310 } |
485 } |
311 |
486 |
312 // -------------------------------------------------------------------------- |
487 // -------------------------------------------------------------------------- |
332 User::Leave( KErrAlreadyExists ); |
507 User::Leave( KErrAlreadyExists ); |
333 } |
508 } |
334 |
509 |
335 if ( iTimer ) |
510 if ( iTimer ) |
336 { |
511 { |
337 iTimer->Cancel(); |
512 delete iTimer; |
513 iTimer = NULL; |
|
338 } |
514 } |
339 |
515 |
340 iLocationRecord->StartL( aCaptureSetting ); |
516 iLocationRecord->StartL( aCaptureSetting ); |
341 } |
517 } |
342 |
518 |
353 RLocationTrail::TTrailState state; |
529 RLocationTrail::TTrailState state; |
354 GetLocationTrailState( state ); |
530 GetLocationTrailState( state ); |
355 |
531 |
356 if( state != RLocationTrail::ETrailStopped && state != RLocationTrail::ETrailStopping ) |
532 if( state != RLocationTrail::ETrailStopped && state != RLocationTrail::ETrailStopping ) |
357 { |
533 { |
358 if(!iTimer) |
534 if(iTimer == NULL) |
359 { |
535 { |
360 TRAPD( error, iTimer = CPeriodic::NewL( CActive::EPriorityUserInput ) ); |
536 TRAP_IGNORE(iTimer = CLocationServerTimerHandler::NewL(*this)); |
361 if ( error != KErrNone ) |
537 } |
362 { |
538 if ( iTimer == NULL) |
363 LOG("CLocationManagerServer::StopGPSPositioningL() - iTimer not created"); |
|
364 iTimer = NULL; |
|
365 } |
|
366 } |
|
367 if(iTimer) |
|
368 { |
539 { |
369 iTimer->Cancel(); |
540 // If timer can't be created we stop the location trail immediately. |
370 iLocationRecord->SetStateToStopping(); |
541 iLocationRecord->Stop(); |
371 iTimer->Start( iLocManStopDelay * 1000000, 0, TCallBack( CheckForRemappingCallback, this ) ); |
542 } |
372 } |
|
373 else |
543 else |
374 { |
544 { |
375 iLocationRecord->Stop(); |
545 iLocationRecord->SetStateToStopping(); |
546 iTimer->StartTimer( iLocManStopDelay * 1000000, MLocationServerTimerObserver::EStopRecording); |
|
376 } |
547 } |
377 } |
548 } |
378 |
549 |
379 // Always stop tracklog. |
550 // Always stop tracklog. |
380 StopTrackLogL(); |
551 StopTrackLogL(); |
387 void CLocationManagerServer::StopRecording() |
558 void CLocationManagerServer::StopRecording() |
388 { |
559 { |
389 LOG( "CLocationManagerServer::StopRecording()" ); |
560 LOG( "CLocationManagerServer::StopRecording()" ); |
390 iWaitForPositioningStopTimeout = EFalse; |
561 iWaitForPositioningStopTimeout = EFalse; |
391 iLocationRecord->Stop(); |
562 iLocationRecord->Stop(); |
392 if(iTimer) |
563 } |
393 { |
564 |
394 iTimer->Cancel(); |
565 // -------------------------------------------------------------------------- |
395 } |
566 // CLocationUtilityServer::LocationServerTimerCallBackL |
396 |
567 // -------------------------------------------------------------------------- |
568 // |
|
569 void CLocationManagerServer::LocationServerTimerCallBackL |
|
570 (const TLocationServerTimerType aLocationServerTimerType, const TInt /*aErrorCode*/) |
|
571 { |
|
572 LOG1( "CLocationManagerServer::LocationServerTimerCallBackL, begin, Type - %d", |
|
573 aLocationServerTimerType); |
|
574 switch(aLocationServerTimerType) |
|
575 { |
|
576 case MLocationServerTimerObserver::EStopRecording: |
|
577 CheckForRemappingCallback(); |
|
578 break; |
|
579 case MLocationServerTimerObserver::EPositioningStopTimeout: |
|
580 PositioningStopTimeout(); |
|
581 break; |
|
582 case MLocationServerTimerObserver::ELocGeneralPurpose: |
|
583 default: |
|
584 // execution shouldn't come over here. |
|
585 LOG("Invalid timer type"); |
|
586 break; |
|
587 } |
|
588 LOG( "CLocationManagerServer::LocationServerTimerCallBackL, end" ); |
|
397 } |
589 } |
398 |
590 |
399 // -------------------------------------------------------------------------- |
591 // -------------------------------------------------------------------------- |
400 // CLocationUtilityServer::PositioningStopTimeout |
592 // CLocationUtilityServer::PositioningStopTimeout |
401 // -------------------------------------------------------------------------- |
593 // -------------------------------------------------------------------------- |
402 // |
594 // |
403 TInt CLocationManagerServer::PositioningStopTimeout( TAny* aAny ) |
595 void CLocationManagerServer::PositioningStopTimeout() |
404 { |
596 { |
405 LOG( "CLocationManagerServer::PositioningStopTimeout" ); |
597 LOG( "CLocationManagerServer::PositioningStopTimeout" ); |
406 CLocationManagerServer* self = STATIC_CAST( CLocationManagerServer*, aAny ); |
598 StopRecording(); |
407 self->StopRecording(); |
599 } |
408 |
600 |
409 return KErrNone; |
601 // -------------------------------------------------------------------------- |
410 } |
602 // CLocationUtilityServer::CheckForRemappingCallback |
411 |
603 // -------------------------------------------------------------------------- |
412 // -------------------------------------------------------------------------- |
604 // |
413 // CLocationUtilityServer::PositioningStopTimeout |
605 void CLocationManagerServer::CheckForRemappingCallback() |
414 // -------------------------------------------------------------------------- |
606 { |
415 // |
607 LOG( "CLocationManagerServer::CheckForRemappingCallback, begin" ); |
416 TInt CLocationManagerServer::CheckForRemappingCallback( TAny* aAny ) |
608 if ( iLocationRecord->RemappingNeeded() && !iLocationRecord->IsLowBattery()) |
417 { |
|
418 LOG( "CLocationManagerServer::CheckForRemappingCallback" ); |
|
419 CLocationManagerServer* self = STATIC_CAST( CLocationManagerServer*, aAny ); |
|
420 |
|
421 self->iTimer->Cancel(); |
|
422 |
|
423 if ( self->iLocationRecord->RemappingNeeded() && !self->iLocationRecord->IsLowBattery()) |
|
424 { |
609 { |
425 self->iTimer->Start( self->iLocManStopRemapDelay * 1000000, 0, TCallBack( PositioningStopTimeout, self ) ); |
610 iTimer->StartTimer( iLocManStopRemapDelay * 1000000, MLocationServerTimerObserver::EPositioningStopTimeout); |
426 self->iWaitForPositioningStopTimeout = ETrue; |
611 iWaitForPositioningStopTimeout = ETrue; |
427 } |
612 } |
428 else |
613 else |
429 { |
614 { |
430 self->StopRecording(); |
615 StopRecording(); |
431 } |
616 } |
432 |
617 LOG( "CLocationManagerServer::CheckForRemappingCallback, end" ); |
433 return KErrNone; |
|
434 } |
618 } |
435 |
619 |
436 // -------------------------------------------------------------------------- |
620 // -------------------------------------------------------------------------- |
437 // CLocationManagerServer::GetLocationTrailState |
621 // CLocationManagerServer::GetLocationTrailState |
438 // -------------------------------------------------------------------------- |
622 // -------------------------------------------------------------------------- |
546 } |
730 } |
547 LOG( "CLocationManagerServer::CancelLocationRequest(), end" ); |
731 LOG( "CLocationManagerServer::CancelLocationRequest(), end" ); |
548 } |
732 } |
549 |
733 |
550 // -------------------------------------------------------------------------- |
734 // -------------------------------------------------------------------------- |
551 // CLocationManagerServer::GetCurrentCellId |
735 // CLocationManagerServer::GetCurrentNetworkInfo |
552 // -------------------------------------------------------------------------- |
736 // -------------------------------------------------------------------------- |
553 // |
737 // |
554 void CLocationManagerServer::GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) |
738 void CLocationManagerServer::GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) |
555 { |
739 { |
556 iLocationRecord->GetNetworkInfo( aNetworkInfo ); |
740 iLocationRecord->GetNetworkInfo( aNetworkInfo ); |
628 iLocationReqs.Reset(); |
812 iLocationReqs.Reset(); |
629 |
813 |
630 LOG( "CLocationManagerServer::CurrentLocation(), end" ); |
814 LOG( "CLocationManagerServer::CurrentLocation(), end" ); |
631 } |
815 } |
632 |
816 |
817 |
|
818 // -------------------------------------------------------------------------- |
|
819 // CLocationManagerServer::GPSSignalQualityChanged |
|
820 // -------------------------------------------------------------------------- |
|
821 // |
|
633 void CLocationManagerServer::GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) |
822 void CLocationManagerServer::GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) |
634 { |
823 { |
635 LOG( "CLocationManagerServer::GPSSignalQualityChanged" ); |
824 LOG( "CLocationManagerServer::GPSSignalQualityChanged" ); |
636 const TInt KFixParam = 0; |
825 const TInt KFixParam = 0; |
637 const TInt KPositionInfoParam = 1; |
826 const TInt KPositionInfoParam = 1; |
675 } |
864 } |
676 iTrackLogNotifyReqs.Reset(); |
865 iTrackLogNotifyReqs.Reset(); |
677 } |
866 } |
678 |
867 |
679 |
868 |
680 |
869 // -------------------------------------------------------------------------- |
870 // CLocationManagerServer::CancelTrackLogNotificationRequest |
|
871 // -------------------------------------------------------------------------- |
|
872 // |
|
681 void CLocationManagerServer::CancelTrackLogNotificationRequest( const TInt aHandle ) |
873 void CLocationManagerServer::CancelTrackLogNotificationRequest( const TInt aHandle ) |
682 { |
874 { |
683 LOG( "CLocationManagerServer::CancelTrackLogNotificationRequest(), begin" ); |
875 LOG( "CLocationManagerServer::CancelTrackLogNotificationRequest(), begin" ); |
684 |
876 |
685 const TInt count = iTrackLogNotifyReqs.Count(); |
877 const TInt count = iTrackLogNotifyReqs.Count(); |
702 } |
894 } |
703 |
895 |
704 LOG( "CLocationManagerServer::CancelTrackLogNotificationRequest(), end" ); |
896 LOG( "CLocationManagerServer::CancelTrackLogNotificationRequest(), end" ); |
705 } |
897 } |
706 |
898 |
899 |
|
900 // -------------------------------------------------------------------------- |
|
901 // CLocationManagerServer::CreateLocationObjectL |
|
902 // -------------------------------------------------------------------------- |
|
903 // |
|
707 void CLocationManagerServer::CreateLocationObjectL( const TLocationData& aLocationData, |
904 void CLocationManagerServer::CreateLocationObjectL( const TLocationData& aLocationData, |
708 const TUint& aObjectId ) |
905 const TUint& aObjectId ) |
709 { |
906 { |
710 if ( !IsSessionReady() ) |
907 if ( !IsSessionReady() ) |
711 { |
908 { |
713 } |
910 } |
714 |
911 |
715 iLocationRecord->CreateLocationObjectL( aLocationData, aObjectId ); |
912 iLocationRecord->CreateLocationObjectL( aLocationData, aObjectId ); |
716 } |
913 } |
717 |
914 |
915 |
|
916 // -------------------------------------------------------------------------- |
|
917 // CLocationManagerServer::LocationSnapshotL |
|
918 // -------------------------------------------------------------------------- |
|
919 // |
|
718 void CLocationManagerServer::LocationSnapshotL( const TUint& aObjectId ) |
920 void CLocationManagerServer::LocationSnapshotL( const TUint& aObjectId ) |
719 { |
921 { |
922 LOG( "CLocationManagerServer::LocationSnapshotL(), begin" ); |
|
720 if ( !IsSessionReady() ) |
923 if ( !IsSessionReady() ) |
721 { |
924 { |
925 LOG( "Session is not ready" ); |
|
722 User::Leave( KErrNotReady ); |
926 User::Leave( KErrNotReady ); |
723 } |
927 } |
724 iLocationRecord->LocationSnapshotL( aObjectId ); |
928 iLocationRecord->LocationSnapshotL( aObjectId ); |
929 LOG( "CLocationManagerServer::LocationSnapshotL(), end" ); |
|
725 } |
930 } |
726 |
931 |
727 // -------------------------------------------------------------------------- |
932 // -------------------------------------------------------------------------- |
728 // CLocationManagerServer::RemoveLocationObjectL |
933 // CLocationManagerServer::RemoveLocationObjectL |
729 // -------------------------------------------------------------------------- |
934 // -------------------------------------------------------------------------- |
755 |
960 |
756 iRemoveLocation = ETrue; |
961 iRemoveLocation = ETrue; |
757 iRelationQuery->FindL( 1, 1 ); |
962 iRelationQuery->FindL( 1, 1 ); |
758 } |
963 } |
759 |
964 |
965 |
|
966 // -------------------------------------------------------------------------- |
|
967 // CLocationManagerServer::CopyLocationObjectL |
|
968 // -------------------------------------------------------------------------- |
|
969 // |
|
760 void CLocationManagerServer::CopyLocationObjectL( TItemId aSource, |
970 void CLocationManagerServer::CopyLocationObjectL( TItemId aSource, |
761 const RArray<TItemId>& aTargets, TMessageQuery& aMessageQuery ) |
971 const RArray<TItemId>& aTargets, TMessageQuery& aMessageQuery ) |
762 { |
972 { |
763 if( aTargets.Count() <= 0 ) |
973 if( aTargets.Count() <= 0 ) |
764 { |
974 { |
816 aMessageQuery.iMessage.Complete( KErrNotFound ); |
1026 aMessageQuery.iMessage.Complete( KErrNotFound ); |
817 iCopyReqs.Remove( iCopyReqs.Find( aMessageQuery ) ); |
1027 iCopyReqs.Remove( iCopyReqs.Find( aMessageQuery ) ); |
818 } |
1028 } |
819 } |
1029 } |
820 |
1030 |
1031 |
|
1032 // -------------------------------------------------------------------------- |
|
1033 // CLocationManagerServer::CopyLocationObjectL |
|
1034 // -------------------------------------------------------------------------- |
|
1035 // |
|
821 void CLocationManagerServer::CopyLocationObjectL( const TDesC& aSource, |
1036 void CLocationManagerServer::CopyLocationObjectL( const TDesC& aSource, |
822 const RArray<TPtrC>& aTargets, TMessageQuery& aQuery ) |
1037 const RArray<TPtrC>& aTargets, TMessageQuery& aQuery ) |
823 { |
1038 { |
824 CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL(); |
1039 CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL(); |
825 TMdEObject obj; |
1040 TMdEObject obj; |
837 } |
1052 } |
838 |
1053 |
839 CopyLocationObjectL( source, iTargetObjectIds, aQuery ); |
1054 CopyLocationObjectL( source, iTargetObjectIds, aQuery ); |
840 } |
1055 } |
841 |
1056 |
1057 |
|
1058 // -------------------------------------------------------------------------- |
|
1059 // CLocationManagerServer::HandleQueryNewResults |
|
1060 // -------------------------------------------------------------------------- |
|
1061 // |
|
842 void CLocationManagerServer::HandleQueryNewResults( CMdEQuery& /*aQuery*/, |
1062 void CLocationManagerServer::HandleQueryNewResults( CMdEQuery& /*aQuery*/, |
843 TInt /*aFirstNewItemIndex*/, TInt /*aNewItemCount*/ ) |
1063 TInt /*aFirstNewItemIndex*/, TInt /*aNewItemCount*/ ) |
844 { |
1064 { |
845 } |
1065 } |
846 |
1066 |
1067 |
|
1068 // -------------------------------------------------------------------------- |
|
1069 // CLocationManagerServer::HandleQueryCompleted |
|
1070 // -------------------------------------------------------------------------- |
|
1071 // |
|
847 void CLocationManagerServer::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ) |
1072 void CLocationManagerServer::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ) |
848 { |
1073 { |
1074 LOG("CLocationManagerServer::HandleQueryCompleted"); |
|
849 if ( iRemoveLocation ) |
1075 if ( iRemoveLocation ) |
850 { |
1076 { |
851 if( aQuery.Count() > 0 && aError == KErrNone ) |
1077 if( aQuery.Count() > 0 && aError == KErrNone ) |
852 { |
1078 { |
853 TRAPD( err, iMdeSession->RemoveRelationL( aQuery.ResultId( 0 ), &aQuery.NamespaceDef() ) ); |
1079 TRAPD( err, iMdeSession->RemoveRelationL( aQuery.ResultId( 0 ), &aQuery.NamespaceDef() ) ); |
887 } |
1113 } |
888 |
1114 |
889 iTargetObjectIds.Reset(); |
1115 iTargetObjectIds.Reset(); |
890 } |
1116 } |
891 |
1117 |
1118 |
|
1119 // -------------------------------------------------------------------------- |
|
1120 // CLocationManagerServer::NewLC |
|
1121 // -------------------------------------------------------------------------- |
|
1122 // |
|
892 void CLocationManagerServer::CopyLocationL( CMdEQuery& aQuery ) |
1123 void CLocationManagerServer::CopyLocationL( CMdEQuery& aQuery ) |
893 { |
1124 { |
894 CMdEObjectDef& locationDef = aQuery.NamespaceDef().GetObjectDefL( Location::KLocationObject ); |
1125 CMdEObjectDef& locationDef = aQuery.NamespaceDef().GetObjectDefL( Location::KLocationObject ); |
895 |
1126 |
896 CMdERelation& result = static_cast<CMdERelation&>( aQuery.ResultItem( 0 ) ); |
1127 CMdERelation& result = static_cast<CMdERelation&>( aQuery.ResultItem( 0 ) ); |
924 break; |
1155 break; |
925 } |
1156 } |
926 } |
1157 } |
927 } |
1158 } |
928 |
1159 |
1160 |
|
1161 // -------------------------------------------------------------------------- |
|
1162 // CLocationManagerServer::InitCopyLocationByIdL |
|
1163 // -------------------------------------------------------------------------- |
|
1164 // |
|
929 void CLocationManagerServer::InitCopyLocationByIdL( const RMessage2& aMessage ) |
1165 void CLocationManagerServer::InitCopyLocationByIdL( const RMessage2& aMessage ) |
930 { |
1166 { |
931 const TInt KParamSourceId = 0; |
1167 const TInt KParamSourceId = 0; |
932 const TInt KParamTargetIds = 1; |
1168 const TInt KParamTargetIds = 1; |
933 TItemId sourceId = 0; |
1169 TItemId sourceId = 0; |
957 CleanupStack::PopAndDestroy(paramBuf); |
1193 CleanupStack::PopAndDestroy(paramBuf); |
958 } |
1194 } |
959 CleanupStack::PopAndDestroy(&targetIds); |
1195 CleanupStack::PopAndDestroy(&targetIds); |
960 } |
1196 } |
961 |
1197 |
1198 |
|
1199 // -------------------------------------------------------------------------- |
|
1200 // CLocationManagerServer::InitCopyLocationByURIL |
|
1201 // -------------------------------------------------------------------------- |
|
1202 // |
|
962 void CLocationManagerServer::InitCopyLocationByURIL( const RMessage2& aMessage ) |
1203 void CLocationManagerServer::InitCopyLocationByURIL( const RMessage2& aMessage ) |
963 { |
1204 { |
964 LOG( "CLocationManagerSession::CopyLocationDataByUriL begin" ); |
1205 LOG( "CLocationManagerSession::CopyLocationDataByUriL begin" ); |
965 const TInt KParamSourceUri = 0; |
1206 const TInt KParamSourceUri = 0; |
966 const TInt KParamTargetUris = 1; |
1207 const TInt KParamTargetUris = 1; |
1006 } |
1247 } |
1007 |
1248 |
1008 LOG( "CLocationManagerSession::CopyLocationDataByUriL end" ); |
1249 LOG( "CLocationManagerSession::CopyLocationDataByUriL end" ); |
1009 } |
1250 } |
1010 |
1251 |
1252 |
|
1253 // -------------------------------------------------------------------------- |
|
1254 // CLocationManagerServer::StartTrackLogL |
|
1255 // -------------------------------------------------------------------------- |
|
1256 // |
|
1011 TItemId CLocationManagerServer::StartTrackLogL() |
1257 TItemId CLocationManagerServer::StartTrackLogL() |
1012 { |
1258 { |
1259 LOG("CLocationManagerServer::StartTrackLogL"); |
|
1013 if ( iTrackLog->IsRecording() ) |
1260 if ( iTrackLog->IsRecording() ) |
1014 { |
1261 { |
1015 User::Leave( KErrInUse ); |
1262 User::Leave( KErrInUse ); |
1016 } |
1263 } |
1017 |
1264 |
1024 CompleteNotifyRequest( EStarted, KErrNone ); |
1271 CompleteNotifyRequest( EStarted, KErrNone ); |
1025 |
1272 |
1026 return iTagId; |
1273 return iTagId; |
1027 } |
1274 } |
1028 |
1275 |
1276 |
|
1277 // -------------------------------------------------------------------------- |
|
1278 // CLocationManagerServer::StopTrackLogL |
|
1279 // -------------------------------------------------------------------------- |
|
1280 // |
|
1029 void CLocationManagerServer::StopTrackLogL() |
1281 void CLocationManagerServer::StopTrackLogL() |
1030 { |
1282 { |
1283 LOG("CLocationManagerServer::StopTrackLogL"); |
|
1031 if ( iTrackLog->IsRecording() ) |
1284 if ( iTrackLog->IsRecording() ) |
1032 { |
1285 { |
1033 iTrackLog->StopRecordingL(); |
1286 iTrackLog->StopRecordingL(); |
1034 |
1287 |
1035 CompleteNotifyRequest( EStopped, KErrNone ); |
1288 CompleteNotifyRequest( EStopped, KErrNone ); |
1038 TRAP_IGNORE( iMdeSession->RemoveObjectObserverL( *this, &iMdeSession->GetDefaultNamespaceDefL()) ); |
1291 TRAP_IGNORE( iMdeSession->RemoveObjectObserverL( *this, &iMdeSession->GetDefaultNamespaceDefL()) ); |
1039 TRAP_IGNORE( iMdeSession->RemoveObjectObserverL( *this, &iMdeSession->GetDefaultNamespaceDefL()) ); |
1292 TRAP_IGNORE( iMdeSession->RemoveObjectObserverL( *this, &iMdeSession->GetDefaultNamespaceDefL()) ); |
1040 } |
1293 } |
1041 } |
1294 } |
1042 |
1295 |
1296 |
|
1297 // -------------------------------------------------------------------------- |
|
1298 // CLocationManagerServer::CompleteNotifyRequest |
|
1299 // -------------------------------------------------------------------------- |
|
1300 // |
|
1043 void CLocationManagerServer::CompleteNotifyRequest( TEventTypes aEventType, TInt aError ) |
1301 void CLocationManagerServer::CompleteNotifyRequest( TEventTypes aEventType, TInt aError ) |
1044 { |
1302 { |
1303 LOG("CLocationManagerServer::CompleteNotifyRequest"); |
|
1045 const TInt KEventTypeParam = 2; |
1304 const TInt KEventTypeParam = 2; |
1046 TPckg<TEventTypes> wrapEventType( aEventType ); |
1305 TPckg<TEventTypes> wrapEventType( aEventType ); |
1047 |
1306 |
1048 const TInt count = iTrackLogNotifyReqs.Count(); |
1307 const TInt count = iTrackLogNotifyReqs.Count(); |
1049 for ( TInt i( count ); --i >= 0; ) |
1308 for ( TInt i( count ); --i >= 0; ) |
1057 } |
1316 } |
1058 } |
1317 } |
1059 iTrackLogNotifyReqs.Reset(); |
1318 iTrackLogNotifyReqs.Reset(); |
1060 } |
1319 } |
1061 |
1320 |
1321 |
|
1322 // -------------------------------------------------------------------------- |
|
1323 // CLocationManagerServer::IsTrackLogRecording |
|
1324 // -------------------------------------------------------------------------- |
|
1325 // |
|
1062 void CLocationManagerServer::IsTrackLogRecording( TBool &aRec ) |
1326 void CLocationManagerServer::IsTrackLogRecording( TBool &aRec ) |
1063 { |
1327 { |
1064 aRec = iTrackLog->IsRecording(); |
1328 aRec = iTrackLog->IsRecording(); |
1065 } |
1329 } |
1066 |
1330 |
1331 |
|
1332 // -------------------------------------------------------------------------- |
|
1333 // CLocationManagerServer::GpxFileCreated |
|
1334 // -------------------------------------------------------------------------- |
|
1335 // |
|
1067 void CLocationManagerServer::GpxFileCreated( const TDesC& aFileName, TItemId aTagId, |
1336 void CLocationManagerServer::GpxFileCreated( const TDesC& aFileName, TItemId aTagId, |
1068 TReal32 aLength, TTime aStart, TTime aEnd ) |
1337 TReal32 aLength, TTime aStart, TTime aEnd ) |
1069 { |
1338 { |
1070 TRAP_IGNORE( CreateTrackLogL( aTagId, aFileName, aLength, aStart, aEnd ) ); |
1339 TRAP_IGNORE( CreateTrackLogL( aTagId, aFileName, aLength, aStart, aEnd ) ); |
1071 } |
1340 } |
1072 |
1341 |
1342 |
|
1343 // -------------------------------------------------------------------------- |
|
1344 // CLocationManagerServer::CreateTrackLogTagL |
|
1345 // -------------------------------------------------------------------------- |
|
1346 // |
|
1073 TItemId CLocationManagerServer::CreateTrackLogTagL() |
1347 TItemId CLocationManagerServer::CreateTrackLogTagL() |
1074 { |
1348 { |
1349 LOG("CLocationManagerServer::CreateTrackLogTagL"); |
|
1075 if ( !IsSessionReady() ) |
1350 if ( !IsSessionReady() ) |
1076 { |
1351 { |
1077 User::Leave( KErrNotReady ); |
1352 User::Leave( KErrNotReady ); |
1078 } |
1353 } |
1079 |
1354 |
1102 CleanupStack::PopAndDestroy( trackLogTag ); |
1377 CleanupStack::PopAndDestroy( trackLogTag ); |
1103 |
1378 |
1104 return tagId; |
1379 return tagId; |
1105 } |
1380 } |
1106 |
1381 |
1382 |
|
1383 // -------------------------------------------------------------------------- |
|
1384 // CLocationManagerServer::CreateTrackLogL |
|
1385 // -------------------------------------------------------------------------- |
|
1386 // |
|
1107 void CLocationManagerServer::CreateTrackLogL( TItemId aTagId, const TDesC& aUri, TReal32 aLength, |
1387 void CLocationManagerServer::CreateTrackLogL( TItemId aTagId, const TDesC& aUri, TReal32 aLength, |
1108 TTime aStart, TTime aEnd ) |
1388 TTime aStart, TTime aEnd ) |
1109 { |
1389 { |
1390 LOG("CLocationManagerServer::CreateTrackLogL"); |
|
1110 if ( !IsSessionReady() ) |
1391 if ( !IsSessionReady() ) |
1111 { |
1392 { |
1112 User::Leave( KErrNotReady ); |
1393 User::Leave( KErrNotReady ); |
1113 } |
1394 } |
1114 |
1395 |
1151 |
1432 |
1152 CleanupStack::PopAndDestroy( relationObject ); |
1433 CleanupStack::PopAndDestroy( relationObject ); |
1153 CleanupStack::PopAndDestroy( trackLog ); |
1434 CleanupStack::PopAndDestroy( trackLog ); |
1154 } |
1435 } |
1155 |
1436 |
1437 |
|
1438 // -------------------------------------------------------------------------- |
|
1439 // CLocationManagerServer::GetTrackLogStatus |
|
1440 // -------------------------------------------------------------------------- |
|
1441 // |
|
1156 TInt CLocationManagerServer::GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality) |
1442 TInt CLocationManagerServer::GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality) |
1157 { |
1443 { |
1158 if ( !iTrackLog ) |
1444 if ( !iTrackLog ) |
1159 { |
1445 { |
1160 return KErrNotFound; |
1446 return KErrNotFound; |
1163 iTrackLog->GetStatus( aRecording, aFixQuality ); |
1449 iTrackLog->GetStatus( aRecording, aFixQuality ); |
1164 |
1450 |
1165 return KErrNone; |
1451 return KErrNone; |
1166 } |
1452 } |
1167 |
1453 |
1454 |
|
1455 // -------------------------------------------------------------------------- |
|
1456 // CLocationManagerServer::DeleteTrackLogL |
|
1457 // -------------------------------------------------------------------------- |
|
1458 // |
|
1168 TInt CLocationManagerServer::DeleteTrackLogL( const TDesC& aUri ) |
1459 TInt CLocationManagerServer::DeleteTrackLogL( const TDesC& aUri ) |
1169 { |
1460 { |
1170 LOG( "CLocationManagerServer::DeleteTrackLogL enter" ); |
1461 LOG( "CLocationManagerServer::DeleteTrackLogL enter" ); |
1171 |
1462 |
1172 // remove tracklog mde object |
1463 // remove tracklog mde object |
1203 LOG( "CLocationManagerServer::DeleteTrackLogL return" ); |
1494 LOG( "CLocationManagerServer::DeleteTrackLogL return" ); |
1204 |
1495 |
1205 return err; |
1496 return err; |
1206 } |
1497 } |
1207 |
1498 |
1499 |
|
1500 // -------------------------------------------------------------------------- |
|
1501 // CLocationManagerServer::TrackLogName |
|
1502 // -------------------------------------------------------------------------- |
|
1503 // |
|
1208 TInt CLocationManagerServer::TrackLogName( TFileName& aFileName ) |
1504 TInt CLocationManagerServer::TrackLogName( TFileName& aFileName ) |
1209 { |
1505 { |
1210 if ( iTrackLog->IsRecording() ) |
1506 if ( iTrackLog->IsRecording() ) |
1211 { |
1507 { |
1212 iTrackLog->GetTrackLogName(aFileName); |
1508 iTrackLog->GetTrackLogName(aFileName); |
1213 return KErrNone; |
1509 return KErrNone; |
1214 } |
1510 } |
1215 return KErrNotFound; |
1511 return KErrNotFound; |
1216 } |
1512 } |
1217 |
1513 |
1514 |
|
1515 // -------------------------------------------------------------------------- |
|
1516 // CLocationManagerServer::GetCaptureSetting |
|
1517 // -------------------------------------------------------------------------- |
|
1518 // |
|
1218 void CLocationManagerServer::GetCaptureSetting( RLocationTrail::TTrailCaptureSetting& aCaptureSetting ) |
1519 void CLocationManagerServer::GetCaptureSetting( RLocationTrail::TTrailCaptureSetting& aCaptureSetting ) |
1219 { |
1520 { |
1220 aCaptureSetting = iCaptureSetting; |
1521 aCaptureSetting = iCaptureSetting; |
1221 } |
1522 } |
1222 |
1523 |
1524 |
|
1525 // -------------------------------------------------------------------------- |
|
1526 // CLocationManagerServer::HandleObjectNotification |
|
1527 // -------------------------------------------------------------------------- |
|
1528 // |
|
1223 void CLocationManagerServer::HandleObjectNotification( CMdESession& /*aSession*/, |
1529 void CLocationManagerServer::HandleObjectNotification( CMdESession& /*aSession*/, |
1224 TObserverNotificationType aType, |
1530 TObserverNotificationType aType, |
1225 const RArray<TItemId>& aObjectIdArray ) |
1531 const RArray<TItemId>& aObjectIdArray ) |
1226 { |
1532 { |
1227 // If notification type is remove then someone has deleted a tracklog tag. |
1533 // If notification type is remove then someone has deleted a tracklog tag. |
1232 } |
1538 } |
1233 |
1539 |
1234 TRAP_IGNORE( LinkObjectToTrackLogTagL( aObjectIdArray ) ); |
1540 TRAP_IGNORE( LinkObjectToTrackLogTagL( aObjectIdArray ) ); |
1235 } |
1541 } |
1236 |
1542 |
1543 |
|
1544 // -------------------------------------------------------------------------- |
|
1545 // CLocationManagerServer::StartListeningTagRemovalsL |
|
1546 // -------------------------------------------------------------------------- |
|
1547 // |
|
1237 void CLocationManagerServer::StartListeningTagRemovalsL() |
1548 void CLocationManagerServer::StartListeningTagRemovalsL() |
1238 { |
1549 { |
1239 if ( !IsSessionReady() ) |
1550 if ( !IsSessionReady() ) |
1240 { |
1551 { |
1241 User::Leave( KErrNotReady ); |
1552 User::Leave( KErrNotReady ); |
1247 iMdeSession->AddObjectObserverL( *this, condition, ENotifyRemove, |
1558 iMdeSession->AddObjectObserverL( *this, condition, ENotifyRemove, |
1248 &iMdeSession->GetDefaultNamespaceDefL() ); |
1559 &iMdeSession->GetDefaultNamespaceDefL() ); |
1249 CleanupStack::Pop( condition ); |
1560 CleanupStack::Pop( condition ); |
1250 } |
1561 } |
1251 |
1562 |
1563 |
|
1564 // -------------------------------------------------------------------------- |
|
1565 // CLocationManagerServer::StartListeningObjectCreationsL |
|
1566 // -------------------------------------------------------------------------- |
|
1567 // |
|
1252 void CLocationManagerServer::StartListeningObjectCreationsL() |
1568 void CLocationManagerServer::StartListeningObjectCreationsL() |
1253 { |
1569 { |
1254 if ( !IsSessionReady() ) |
1570 if ( !IsSessionReady() ) |
1255 { |
1571 { |
1256 User::Leave( KErrNotReady ); |
1572 User::Leave( KErrNotReady ); |
1269 iMdeSession->AddObjectObserverL( *this, condition, ENotifyAdd | ENotifyModify, |
1585 iMdeSession->AddObjectObserverL( *this, condition, ENotifyAdd | ENotifyModify, |
1270 &iMdeSession->GetDefaultNamespaceDefL() ); |
1586 &iMdeSession->GetDefaultNamespaceDefL() ); |
1271 |
1587 |
1272 } |
1588 } |
1273 |
1589 |
1590 |
|
1591 // -------------------------------------------------------------------------- |
|
1592 // CLocationManagerServer::LinkObjectToTrackLogTagL |
|
1593 // -------------------------------------------------------------------------- |
|
1594 // |
|
1274 void CLocationManagerServer::LinkObjectToTrackLogTagL( const RArray<TItemId>& aObjectIdArray ) |
1595 void CLocationManagerServer::LinkObjectToTrackLogTagL( const RArray<TItemId>& aObjectIdArray ) |
1275 { |
1596 { |
1276 CMdERelationDef& containsRelDef = iMdeSession->GetDefaultNamespaceDefL() |
1597 CMdERelationDef& containsRelDef = iMdeSession->GetDefaultNamespaceDefL() |
1277 .GetRelationDefL( Relations::KContains ); |
1598 .GetRelationDefL( Relations::KContains ); |
1278 |
1599 |
1286 |
1607 |
1287 CleanupStack::PopAndDestroy( relationObject ); |
1608 CleanupStack::PopAndDestroy( relationObject ); |
1288 } |
1609 } |
1289 } |
1610 } |
1290 |
1611 |
1612 |
|
1613 // -------------------------------------------------------------------------- |
|
1614 // CLocationManagerServer::AddGpxObserver |
|
1615 // -------------------------------------------------------------------------- |
|
1616 // |
|
1291 void CLocationManagerServer::AddGpxObserver( MGpxConversionObserver* aObserver ) |
1617 void CLocationManagerServer::AddGpxObserver( MGpxConversionObserver* aObserver ) |
1292 { |
1618 { |
1293 iTrackLog->AddGpxObserver( aObserver ); |
1619 iTrackLog->AddGpxObserver( aObserver ); |
1294 } |
1620 } |
1295 |
1621 |
1622 // -------------------------------------------------------------------------- |
|
1623 // CLocationManagerServer::RemapedCompleted() |
|
1624 // -------------------------------------------------------------------------- |
|
1625 // |
|
1296 void CLocationManagerServer::RemapedCompleted() |
1626 void CLocationManagerServer::RemapedCompleted() |
1297 { |
1627 { |
1298 LOG( "CLocationManagerServer::RemapedCompleted()" ); |
1628 LOG( "CLocationManagerServer::RemapedCompleted()" ); |
1299 StopRecording(); |
1629 StopRecording(); |
1300 } |
1630 } |
1301 |
1631 |
1632 // -------------------------------------------------------------------------- |
|
1633 // CLocationManagerServer::WaitForPositioningStopTimeout() |
|
1634 // -------------------------------------------------------------------------- |
|
1635 // |
|
1302 TBool CLocationManagerServer::WaitForPositioningStopTimeout() |
1636 TBool CLocationManagerServer::WaitForPositioningStopTimeout() |
1303 { |
1637 { |
1304 LOG( "CLocationManagerServer::WaitForPositioningStopTimeout()" ); |
1638 LOG( "CLocationManagerServer::WaitForPositioningStopTimeout()" ); |
1305 return iWaitForPositioningStopTimeout; |
1639 return iWaitForPositioningStopTimeout; |
1306 } |
1640 } |
1307 |
1641 |
1642 // -------------------------------------------------------------------------- |
|
1643 // CLocationManagerServer::GeoTaggingCompleted |
|
1644 // -------------------------------------------------------------------------- |
|
1645 // |
|
1646 |
|
1647 void CLocationManagerServer::GeoTaggingCompleted( const TInt aError ) |
|
1648 { |
|
1649 LOG("CLocationManagerServer::GeoTaggingCompleted ,begin"); |
|
1650 ARG_USED(aError); |
|
1651 // do nothing because we are only handling pending request for this object. |
|
1652 #ifdef LOC_REVERSEGEOCODE |
|
1653 if(!iGeoTaggingMessage.IsNull()) |
|
1654 { |
|
1655 LOG("Completing the request"); |
|
1656 iGeoTaggingMessage.Complete(aError); |
|
1657 iGeoTaggingMessage = RMessage2 (); |
|
1658 } |
|
1659 #endif //LOC_REVERSEGEOCODE |
|
1660 // once geo tagging completed, check whether, we can terminate the server |
|
1661 if ( !iSessionCount |
|
1662 && iLocationRecord |
|
1663 && !iLocationRecord->TaggingInProgress()) |
|
1664 { |
|
1665 // Nothing in progress. shutdown the server |
|
1666 CActiveScheduler::Stop(); |
|
1667 } |
|
1668 LOG("CLocationManagerServer::GeoTaggingCompleted ,end"); |
|
1669 } |
|
1670 |
|
1671 |
|
1672 // -------------------------------------------------------------------------- |
|
1673 // CLocationManagerServer::PendingGeoTagReqComplete |
|
1674 // -------------------------------------------------------------------------- |
|
1675 // |
|
1676 void CLocationManagerServer::PendingGeoTagReqComplete( const TInt aError ) |
|
1677 { |
|
1678 LOG("CLocationManagerServer::PendingGeoTagReqComplete ,begin"); |
|
1679 ARG_USED(aError); |
|
1680 #ifdef LOC_REVERSEGEOCODE |
|
1681 if(!iTagPendingMessage.IsNull()) |
|
1682 { |
|
1683 |
|
1684 TGeoTaggingSatus pendingGeoTagEntry = EGeoTagCmpt; |
|
1685 switch(aError) |
|
1686 { |
|
1687 case KErrNotFound: |
|
1688 pendingGeoTagEntry = EGeoTaggingPending; |
|
1689 LOG("Geo tagging pending"); |
|
1690 break; |
|
1691 case KErrInUse: |
|
1692 pendingGeoTagEntry = EGeoTaggingGoingOn; |
|
1693 LOG("Geo tagging going on"); |
|
1694 break; |
|
1695 default: |
|
1696 break; |
|
1697 } |
|
1698 |
|
1699 TPckg<TGeoTaggingSatus> pendingGeoTagEntryPkg( pendingGeoTagEntry ); |
|
1700 TRAPD(err, iTagPendingMessage.WriteL( 0, pendingGeoTagEntryPkg )); |
|
1701 iTagPendingMessage.Complete((err == KErrNone) ? KErrNone : err); |
|
1702 iTagPendingMessage = RMessage2 (); |
|
1703 } |
|
1704 #endif //LOC_REVERSEGEOCODE |
|
1705 LOG("CLocationManagerServer::PendingGeoTagReqComplete ,end"); |
|
1706 } |
|
1707 |
|
1708 |
|
1709 // -------------------------------------------------------------------------- |
|
1710 // CLocationManagerServer::TagPendingRequestL |
|
1711 // -------------------------------------------------------------------------- |
|
1712 // |
|
1713 void CLocationManagerServer::TagPendingRequestL( const RMessage2& aMessage ) |
|
1714 { |
|
1715 LOG("CLocationManagerServer::TagPendingRequestL ,begin"); |
|
1716 // Only one request at a time |
|
1717 #ifdef LOC_REVERSEGEOCODE |
|
1718 if(iTagPendingMessage.IsNull() && iGeoTaggingMessage.IsNull()) |
|
1719 { |
|
1720 iTagPendingMessage = RMessage2( aMessage ); |
|
1721 // search for pending entry. |
|
1722 //Create the instance of geotagger class |
|
1723 TBool tagProgress = iLocationRecord->TaggingInProgress(); |
|
1724 if(tagProgress) |
|
1725 { |
|
1726 LOG("Tagging is going on.\n"); |
|
1727 // Let UI to send start geo tagging command. |
|
1728 PendingGeoTagReqComplete(KErrNotFound); |
|
1729 } |
|
1730 else |
|
1731 { |
|
1732 LOG("Tagging is not going on.\n"); |
|
1733 if(iGeoTaggingPendingReqObj == NULL) |
|
1734 { |
|
1735 iGeoTaggingPendingReqObj = CGeoTagger::NewL( this, NULL ); |
|
1736 } |
|
1737 iGeoTaggingPendingReqObj->PendingGeoTagsL( tagProgress); |
|
1738 } |
|
1739 } |
|
1740 else |
|
1741 { |
|
1742 LOG("Server busy\n"); |
|
1743 aMessage.Complete(KErrServerBusy); |
|
1744 } |
|
1745 #else |
|
1746 aMessage.Complete(KErrNotSupported); |
|
1747 #endif //LOC_REVERSEGEOCODE |
|
1748 LOG("CLocationManagerServer::TagPendingRequestL ,end"); |
|
1749 } |
|
1750 |
|
1751 |
|
1752 |
|
1753 // -------------------------------------------------------------------------- |
|
1754 // CLocationManagerServer::CancelTagPendingRequest |
|
1755 // -------------------------------------------------------------------------- |
|
1756 // |
|
1757 void CLocationManagerServer::CancelTagPendingRequest( const RMessage2& aMessage ) |
|
1758 { |
|
1759 LOG("CLocationManagerServer::CancelTagPendingRequest ,begin"); |
|
1760 // Only one request at a time |
|
1761 #ifdef LOC_REVERSEGEOCODE |
|
1762 if(!iTagPendingMessage.IsNull()) |
|
1763 { |
|
1764 iTagPendingMessage.Complete(KErrCancel); |
|
1765 iLocationRecord->CancelGeoTagging(); |
|
1766 } |
|
1767 aMessage.Complete(KErrNone); |
|
1768 #else |
|
1769 aMessage.Complete(KErrNotSupported); |
|
1770 #endif //LOC_REVERSEGEOCODE |
|
1771 } |
|
1772 |
|
1773 |
|
1774 // -------------------------------------------------------------------------- |
|
1775 // CLocationManagerServer::CancelGeoTaggingRequest |
|
1776 // -------------------------------------------------------------------------- |
|
1777 // |
|
1778 void CLocationManagerServer::CancelGeoTaggingRequest( const RMessage2& aMessage ) |
|
1779 { |
|
1780 LOG("CLocationManagerServer::CancelGeoTaggingRequest ,begin"); |
|
1781 // Only one request at a time |
|
1782 #ifdef LOC_REVERSEGEOCODE |
|
1783 if(!iGeoTaggingMessage.IsNull()) |
|
1784 { |
|
1785 iGeoTaggingMessage.Complete(KErrCancel); |
|
1786 iGeoTaggingMessage = RMessage2 (); |
|
1787 iLocationRecord->CancelGeoTagging(); |
|
1788 } |
|
1789 aMessage.Complete(KErrNone); |
|
1790 #else |
|
1791 aMessage.Complete(KErrNotSupported); |
|
1792 #endif //LOC_REVERSEGEOCODE |
|
1793 } |
|
1794 |
|
1795 |
|
1796 // -------------------------------------------------------------------------- |
|
1797 // CLocationManagerServer::StartGeoTaggingL |
|
1798 // -------------------------------------------------------------------------- |
|
1799 // |
|
1800 void CLocationManagerServer::StartGeoTaggingL( const RMessage2& aMessage ) |
|
1801 { |
|
1802 LOG("CLocationManagerServer::StartGeoTaggingL ,begin"); |
|
1803 #ifdef LOC_REVERSEGEOCODE |
|
1804 if(iGeoTaggingMessage.IsNull() && iTagPendingMessage.IsNull()) |
|
1805 { |
|
1806 iGeoTaggingMessage = RMessage2( aMessage ); |
|
1807 // search for pending entry. |
|
1808 //Create the instance of geotagger class |
|
1809 if(!iLocationRecord->StartGeoTagging(EInteractive)) |
|
1810 { |
|
1811 if(iGeoTaggingPendingReqObj == NULL) |
|
1812 { |
|
1813 iGeoTaggingPendingReqObj = CGeoTagger::NewL( this, NULL ); |
|
1814 } |
|
1815 iGeoTaggingPendingReqObj->CreateGeoTagsL((TConnectionOption)(aMessage.Int0())); |
|
1816 } |
|
1817 } |
|
1818 else |
|
1819 { |
|
1820 LOG("Server busy\n"); |
|
1821 aMessage.Complete(KErrServerBusy); |
|
1822 } |
|
1823 #else |
|
1824 aMessage.Complete(KErrNotSupported); |
|
1825 #endif //LOC_REVERSEGEOCODE |
|
1826 } |
|
1827 |
|
1828 |
|
1829 // ---------------------------------------------------------------------------- |
|
1830 // CLocationManagerServer::GetCurrentRegisterNw() |
|
1831 // ---------------------------------------------------------------------------- |
|
1832 RMobilePhone::TMobilePhoneNetworkInfoV2& CLocationManagerServer::GetCurrentRegisterNw() |
|
1833 { |
|
1834 LOG( "CLocationManagerServer::GetCurrentRegisterNw ,begin" ); |
|
1835 return iLocationRecord->GetCurrentRegisteredNw(); |
|
1836 } |
|
1837 |
|
1838 // ---------------------------------------------------------------------------- |
|
1839 // CLocationManagerServer::RetrieveHomeNetwork() |
|
1840 // ---------------------------------------------------------------------------- |
|
1841 void CLocationManagerServer::RetrieveHomeNetwork() |
|
1842 { |
|
1843 LOG("CLocationManagerServer::RetrieveHomeNetwork ,begin"); |
|
1844 if(iHomeNwInfoAvailableFlag) |
|
1845 { |
|
1846 RMobilePhone::TMobilePhoneNetworkInfoV1Pckg homeNetworkPckg( iHomeNetwork ); |
|
1847 |
|
1848 TRequestStatus status( KErrNone ); |
|
1849 |
|
1850 iPhone.GetHomeNetwork(status, homeNetworkPckg); |
|
1851 User::WaitForRequest( status ); |
|
1852 if(status.Int() == KErrNone) |
|
1853 { |
|
1854 iHomeNwInfoAvailableFlag = ETrue; |
|
1855 } |
|
1856 } |
|
1857 LOG("CLocationManagerServer::RetrieveHomeNetwork ,end"); |
|
1858 } |
|
1859 |
|
1860 // ---------------------------------------------------------------------------- |
|
1861 // CLocationManagerServer::GetHomeNetworkInfo() |
|
1862 // ---------------------------------------------------------------------------- |
|
1863 const RMobilePhone::TMobilePhoneNetworkInfoV1& |
|
1864 CLocationManagerServer::GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag) |
|
1865 { |
|
1866 LOG("CLocationManagerServer::RetrieveHomeNetwork ,begin"); |
|
1867 if(!iHomeNwInfoAvailableFlag) |
|
1868 { |
|
1869 RetrieveHomeNetwork(); |
|
1870 } |
|
1871 aHomeNwInfoAvailableFlag = iHomeNwInfoAvailableFlag; |
|
1872 return iHomeNetwork; |
|
1873 } |
|
1874 |
|
1875 |
|
1876 // ---------------------------------------------------------------------------- |
|
1877 // CLocationManagerServer::IsRegisteredAtHomeNetwork() |
|
1878 // ---------------------------------------------------------------------------- |
|
1879 TBool CLocationManagerServer::IsRegisteredAtHomeNetwork() |
|
1880 { |
|
1881 LOG( "CLocationManagerServer::IsRegisteredAtHomeNetwork" ); |
|
1882 return (iNwRegistrationStatusHandler && |
|
1883 (iNwRegistrationStatusHandler->GetNetworkRegistrationStatus() |
|
1884 == RMobilePhone::ERegisteredOnHomeNetwork)); |
|
1885 } |
|
1886 |
|
1308 // End of file |
1887 // End of file |