equal
deleted
inserted
replaced
19 #include <e32base.h> |
19 #include <e32base.h> |
20 #include <lbspositioninfo.h> |
20 #include <lbspositioninfo.h> |
21 #include <lbs/epos_cpositioner.h> |
21 #include <lbs/epos_cpositioner.h> |
22 #include <lbs/epos_cposmodules.h> |
22 #include <lbs/epos_cposmodules.h> |
23 #include <lbs/epos_mposmodulesobserver.h> |
23 #include <lbs/epos_mposmodulesobserver.h> |
24 #include <centralrepository.h> |
|
25 #include "lbsdevloggermacros.h" |
24 #include "lbsdevloggermacros.h" |
26 #include "EPos_ServerPanic.h" |
25 #include "EPos_ServerPanic.h" |
27 #include "EPos_Global.h" |
26 #include "EPos_Global.h" |
28 #include "EPos_CPosCallbackTimer.h" |
27 #include "EPos_CPosCallbackTimer.h" |
29 #include "EPos_CPositionRequest.h" |
28 #include "EPos_CPositionRequest.h" |
33 #include "EPos_CPosLocMonitorReqHandlerHub.h" |
32 #include "EPos_CPosLocMonitorReqHandlerHub.h" |
34 #include "OstTraceDefinitions.h" |
33 #include "OstTraceDefinitions.h" |
35 #ifdef OST_TRACE_COMPILER_IN_USE |
34 #ifdef OST_TRACE_COMPILER_IN_USE |
36 #include "EPos_CPositionRequestTraces.h" |
35 #include "EPos_CPositionRequestTraces.h" |
37 #endif |
36 #endif |
38 #include "lbsrootcenrepdefs.h" |
|
39 #include "lbspositioningstatusprops.h" |
|
40 |
|
41 |
37 |
42 |
38 |
43 |
39 |
44 // CONSTANTS |
40 // CONSTANTS |
45 #ifdef _DEBUG |
41 #ifdef _DEBUG |
103 if (!iModuleInfo.IsAvailable()) |
99 if (!iModuleInfo.IsAvailable()) |
104 { |
100 { |
105 User::Leave(KErrNotFound); |
101 User::Leave(KErrNotFound); |
106 } |
102 } |
107 |
103 |
108 // Get the CategoryUid from the cenrep file owned by LbsRoot. |
|
109 CRepository* rep = CRepository::NewLC(KLbsCenRepUid); |
|
110 TInt posStatusCategory; |
|
111 TInt err = rep->Get(KMoPositioningStatusAPIKey, posStatusCategory); |
|
112 User::LeaveIfError(err); |
|
113 CleanupStack::PopAndDestroy(rep); |
|
114 iPosStatusCategory = TUid::Uid(posStatusCategory); |
|
115 |
|
116 LoadPositionerL(); |
104 LoadPositionerL(); |
117 } |
105 } |
118 |
106 |
119 /** |
107 /** |
120 * Two-phased constructor. |
108 * Two-phased constructor. |
176 User::Leave(KErrNotFound); |
164 User::Leave(KErrNotFound); |
177 } |
165 } |
178 |
166 |
179 __ASSERT_DEBUG(iPositioner, DebugPanic(EPosServerPanicPositionerNotInitialized)); |
167 __ASSERT_DEBUG(iPositioner, DebugPanic(EPosServerPanicPositionerNotInitialized)); |
180 |
168 |
181 //Increment the StatusKeyValue for Positioning Indicator clients |
|
182 if(iTrackingState == EPosNoTracking || iTrackingState == EPosFirstTrackingRequest) |
|
183 { |
|
184 TInt count, err; |
|
185 err = RProperty::Get(iPosStatusCategory, KLbsMoPositioningStatusKey, count); |
|
186 if(err == KErrNone) |
|
187 { |
|
188 err = RProperty::Set(iPosStatusCategory, KLbsMoPositioningStatusKey, count+1); |
|
189 } |
|
190 if(err != KErrNone) |
|
191 { |
|
192 DEBUG_TRACE("CPositionRequest::MakeRequestL() - Error in setting or getting Positioning Status", __LINE__) |
|
193 } |
|
194 } |
|
195 |
|
196 iMessage = aMessage; // Store parameter here in case of leave. |
169 iMessage = aMessage; // Store parameter here in case of leave. |
197 |
170 |
198 // Clear previous position data |
171 // Clear previous position data |
199 delete iPositionBuffer; |
172 delete iPositionBuffer; |
200 iPositionBuffer = NULL; |
173 iPositionBuffer = NULL; |
529 if (!iMessage.IsNull()) |
502 if (!iMessage.IsNull()) |
530 { |
503 { |
531 LBS_RDEBUG_ARGINT("LBS","Client", "RunL", aReason); |
504 LBS_RDEBUG_ARGINT("LBS","Client", "RunL", aReason); |
532 iMessage.Complete(aReason); |
505 iMessage.Complete(aReason); |
533 } |
506 } |
534 //Decrement the StatusKeyValue for Positioning Indicator clients |
|
535 if(iTrackingState == EPosNoTracking) |
|
536 { |
|
537 TInt count, err; |
|
538 err = RProperty::Get(iPosStatusCategory, KLbsMoPositioningStatusKey, count); |
|
539 if(err == KErrNone && count > 0) |
|
540 { |
|
541 err = RProperty::Set(iPosStatusCategory, KLbsMoPositioningStatusKey, count-1); |
|
542 } |
|
543 |
|
544 if(err != KErrNone) |
|
545 { |
|
546 DEBUG_TRACE("CPositionRequest::StopTracking() - error in getting or setting Positioning Status", __LINE__) |
|
547 } |
|
548 else if (count <=0) |
|
549 { |
|
550 DEBUG_TRACE("CPositionRequest::StopTracking() - Incorrect Positioning Status tracking count", __LINE__) |
|
551 } |
|
552 } |
|
553 } |
507 } |
554 |
508 |
555 void CPositionRequest::CompleteRequest(TInt aReason) |
509 void CPositionRequest::CompleteRequest(TInt aReason) |
556 { |
510 { |
557 // Return fix to the client |
511 // Return fix to the client |
747 LBS_RDEBUG_INFO("CPositionRequest::StopTracking()"); |
701 LBS_RDEBUG_INFO("CPositionRequest::StopTracking()"); |
748 iTrackingTimer->Cancel(); |
702 iTrackingTimer->Cancel(); |
749 iTrackingState = EPosNoTracking; |
703 iTrackingState = EPosNoTracking; |
750 |
704 |
751 StopPsyTracking(); |
705 StopPsyTracking(); |
752 |
|
753 //Set PositionIndicator Off |
|
754 TInt count, err; |
|
755 err = RProperty::Get(iPosStatusCategory, KLbsMoPositioningStatusKey, count); |
|
756 if(err == KErrNone && count > 0) |
|
757 { |
|
758 err = RProperty::Set(iPosStatusCategory, KLbsMoPositioningStatusKey, count-1); |
|
759 } |
|
760 |
|
761 if(err != KErrNone) |
|
762 { |
|
763 DEBUG_TRACE("CPositionRequest::StopTracking() - error in getting or setting Positioning Status", __LINE__) |
|
764 } |
|
765 else if (count <=0) |
|
766 { |
|
767 DEBUG_TRACE("CPositionRequest::StopTracking() - Incorrect Positioning Status tracking count", __LINE__) |
|
768 } |
|
769 } |
706 } |
770 |
707 |
771 void CPositionRequest::StopPsyTracking() |
708 void CPositionRequest::StopPsyTracking() |
772 { |
709 { |
773 if (iPositioner && iPositionerTrackingStarted) |
710 if (iPositioner && iPositionerTrackingStarted) |