locationrequestmgmt/networkrequesthandler/src/privacyandlocationrequesthandler.cpp
equal
deleted
inserted
replaced
13 // Description: |
13 // Description: |
14 // |
14 // |
15 |
15 |
16 #include <e32std.h> |
16 #include <e32std.h> |
17 #include <e32property.h> |
17 #include <e32property.h> |
|
18 #include <centralrepository.h> |
|
19 |
|
20 #ifdef SYMBIAN_FEATURE_MANAGER |
|
21 #include <featdiscovery.h> |
|
22 #include <featureuids.h> |
|
23 #endif |
18 |
24 |
19 // LBS-specific |
25 // LBS-specific |
20 #include <lbs.h> |
26 #include <lbs.h> |
21 #include <lbs/lbsadmin.h> |
27 #include <lbs/lbsadmin.h> |
22 #include <lbs/lbslocerrors.h> |
28 #include <lbs/lbslocerrors.h> |
23 #include <lbs/lbslocclasstypes.h> |
29 #include <lbs/lbslocclasstypes.h> |
24 |
30 |
25 #include "nrhpanic.h" |
31 #include "nrhpanic.h" |
26 #include "lbsdevloggermacros.h" |
32 #include "lbsdevloggermacros.h" |
27 #include "lbsqualityprofile.h" |
33 #include "lbsqualityprofile.h" |
|
34 #include "lbsrootcenrepdefs.h" |
|
35 #include "lbspositioningstatusprops.h" |
28 |
36 |
29 #include "privacyandlocationrequesthandler.h" |
37 #include "privacyandlocationrequesthandler.h" |
30 |
38 |
31 // Special 'invalid session' SessionId. |
39 // Special 'invalid session' SessionId. |
32 const TLbsNetSessionIdInt KInvalidSessionId(TUid::Uid(0), 0); |
40 const TLbsNetSessionIdInt KInvalidSessionId(TUid::Uid(0), 0); |
91 iFsmArray.Remove(index); |
99 iFsmArray.Remove(index); |
92 } |
100 } |
93 |
101 |
94 iFsmArray.ResetAndDestroy(); |
102 iFsmArray.ResetAndDestroy(); |
95 |
103 |
|
104 // force the count of active network initiated positioning sessions to 0 |
|
105 // this supports the pre-APE centric architecture wherein the NRH is |
|
106 // destroyed on completion of network initiated positioning. |
|
107 RProperty::Set(iPosStatusCategory, KLbsNiPositioningStatusKey, 0); |
96 |
108 |
97 delete iEmergencyFsm; |
109 delete iEmergencyFsm; |
98 delete iAgpsInterface; |
110 delete iAgpsInterface; |
99 delete iPrivacyHandler; |
111 delete iPrivacyHandler; |
100 } |
112 } |
159 { |
171 { |
160 LBSLOG_ERR2(ELogP3, "Failed to get KLbsSpecialFeatureIntermediateFutileUpdate (err %d)", err); |
172 LBSLOG_ERR2(ELogP3, "Failed to get KLbsSpecialFeatureIntermediateFutileUpdate (err %d)", err); |
161 } |
173 } |
162 LBSLOG2(ELogP3, "Using KLbsSpecialFeatureIntermediateFutileUpdate = %d", specialFeature); |
174 LBSLOG2(ELogP3, "Using KLbsSpecialFeatureIntermediateFutileUpdate = %d", specialFeature); |
163 iSpecialFeatureIntermediateFutileUpdate = (specialFeature == CLbsAdmin::ESpecialFeatureOn) ? ETrue : EFalse; |
175 iSpecialFeatureIntermediateFutileUpdate = (specialFeature == CLbsAdmin::ESpecialFeatureOn) ? ETrue : EFalse; |
|
176 |
|
177 #ifdef SYMBIAN_FEATURE_MANAGER |
|
178 iLocationManagementSupported = CFeatureDiscovery::IsFeatureSupportedL(NFeature::KLocationManagement); |
|
179 #else |
|
180 __ASSERT_ALWAYS(EFalse, User::Invariant()); // Would happen on older versions of symbian OS if this code ever backported |
|
181 #endif |
|
182 |
|
183 // Get the CategoryUid from the cenrep file owned by LbsRoot for accessing Positioning Status P&S Keys |
|
184 CRepository* rep = CRepository::NewLC(KLbsCenRepUid); |
|
185 TInt posStatusCategory; |
|
186 err = rep->Get(KNiPositioningStatusAPIKey, posStatusCategory); |
|
187 User::LeaveIfError(err); |
|
188 CleanupStack::PopAndDestroy(rep); |
|
189 iPosStatusCategory = TUid::Uid(posStatusCategory); |
164 } |
190 } |
165 |
191 |
166 |
192 |
167 |
193 |
168 /** |
194 /** |
683 |
709 |
684 RLbsNetworkRegistrationStatus& CPrivacyAndLocationHandler::NetworkRegistrationStatus() |
710 RLbsNetworkRegistrationStatus& CPrivacyAndLocationHandler::NetworkRegistrationStatus() |
685 { |
711 { |
686 return iNetRegStatus; |
712 return iNetRegStatus; |
687 } |
713 } |
|
714 |
|
715 // increments the P&S key tracking mobile terminated positioning requests |
|
716 void CPrivacyAndLocationHandler::IncrementPositioningStatus() |
|
717 { |
|
718 TInt count; |
|
719 RProperty::Get(iPosStatusCategory, KLbsNiPositioningStatusKey, count); |
|
720 RProperty::Set(iPosStatusCategory, KLbsNiPositioningStatusKey, count+1); |
|
721 } |
|
722 |
|
723 // decrements the P&S key tracking mobile terminated positioning requests |
|
724 // if location management is supported. In the alternative architecture, |
|
725 // the NRH is not aware of the positioning session's progress, but is |
|
726 // transient. Therefore the positioning status is set to zero in the |
|
727 // class destructor. |
|
728 void CPrivacyAndLocationHandler::DecrementPositioningStatus() |
|
729 { |
|
730 if (iLocationManagementSupported) |
|
731 { |
|
732 TInt count; |
|
733 RProperty::Get(iPosStatusCategory, KLbsNiPositioningStatusKey, count); |
|
734 if(count>0) |
|
735 { |
|
736 RProperty::Set(iPosStatusCategory, KLbsNiPositioningStatusKey, count-1); |
|
737 } |
|
738 else |
|
739 { |
|
740 LBSLOG_ERR(ELogP3, "CPrivacyAndLocationHandler::DecrementPositioningStatus() - Incorrect Positioning Status count\n"); |
|
741 } |
|
742 } |
|
743 } |
688 |
744 |
689 |
745 |
690 /** |
746 /** |
691 */ |
747 */ |
692 MX3pStatusHandler& CPrivacyAndLocationHandler::X3pStatusHandler() |
748 MX3pStatusHandler& CPrivacyAndLocationHandler::X3pStatusHandler() |
913 TInt aReason) |
969 TInt aReason) |
914 { |
970 { |
915 if(aSessionId == iFsm->SessionId()) |
971 if(aSessionId == iFsm->SessionId()) |
916 { |
972 { |
917 iFsm->ExitData().SetExitData(TPrivLocStateExitData::EExitSessionComplete, aReason); |
973 iFsm->ExitData().SetExitData(TPrivLocStateExitData::EExitSessionComplete, aReason); |
918 iFsm->ChangeState(CLbsPrivLocFsm::EStateIdle, aSessionId); |
974 iFsm->ChangeState(CLbsPrivLocFsm::EStateIdle, aSessionId); |
919 } |
975 } |
920 } |
976 } |
921 |
977 |
922 /** Called when a reference position arrives from the network. |
978 /** Called when a reference position arrives from the network. |
923 */ |
979 */ |
1052 RLbsNetworkRegistrationStatus& CLbsPrivLocStateBase::LbsNetworkRegistrationStatus() |
1108 RLbsNetworkRegistrationStatus& CLbsPrivLocStateBase::LbsNetworkRegistrationStatus() |
1053 { |
1109 { |
1054 return iFsm->PrivLocHandler().NetworkRegistrationStatus(); |
1110 return iFsm->PrivLocHandler().NetworkRegistrationStatus(); |
1055 } |
1111 } |
1056 |
1112 |
|
1113 /* |
|
1114 * increments the network initiated positioning status count |
|
1115 * and remembers that it has done |
|
1116 */ |
|
1117 void CLbsPrivLocStateBase::IncrementPositioningStatus() |
|
1118 { |
|
1119 iFsm->PrivLocHandler().IncrementPositioningStatus(); |
|
1120 iFsm->WasPositioningStatusIncremented() = ETrue; |
|
1121 } |
|
1122 |
|
1123 |
1057 // ----------------------------------------------------------------------------- |
1124 // ----------------------------------------------------------------------------- |
1058 // |
1125 // |
1059 // ----------------------- Class CLbsPrivLocIdleState -------------------- |
1126 // ----------------------- Class CLbsPrivLocIdleState -------------------- |
1060 // |
1127 // |
1061 // Implements the Idle state of the Privacy and Location Request Handler |
1128 // Implements the Idle state of the Privacy and Location Request Handler |
1127 if(iFsm->WasPrivacyResponseReceivedStateExited()) |
1194 if(iFsm->WasPrivacyResponseReceivedStateExited()) |
1128 { |
1195 { |
1129 // The request relates to a rejected privacy request |
1196 // The request relates to a rejected privacy request |
1130 // or a request for this session which has already been answered. |
1197 // or a request for this session which has already been answered. |
1131 // In either case, it should be refused. The message is sent to the |
1198 // In either case, it should be refused. The message is sent to the |
1132 // network gateway as apart of exit from the state, but we want to |
1199 // network gateway as a part of exit from the state, but we want to |
1133 // remain in Idle state. |
1200 // remain in Idle state. |
1134 iFsm->ExitData().SetExitData(TPrivLocStateExitData::EExitCancelledByPrivacyController, KErrAccessDenied); |
1201 iFsm->ExitData().SetExitData(TPrivLocStateExitData::EExitCancelledByPrivacyController, KErrAccessDenied); |
1135 iFsm->ChangeState(CLbsPrivLocFsm::EStateIdle, aSessionId); |
1202 iFsm->ChangeState(CLbsPrivLocFsm::EStateIdle, aSessionId); |
1136 } |
1203 } |
1137 else |
1204 else |
1181 TBool aIsEmergency, |
1248 TBool aIsEmergency, |
1182 const TLbsExternalRequestInfo& aExternalRequestInfo, |
1249 const TLbsExternalRequestInfo& aExternalRequestInfo, |
1183 const TLbsNetPosRequestPrivacyInt& aNetPosRequestPrivacy) |
1250 const TLbsNetPosRequestPrivacyInt& aNetPosRequestPrivacy) |
1184 { |
1251 { |
1185 iFsm->SessionType() = aSessionType; |
1252 iFsm->SessionType() = aSessionType; |
|
1253 iFsm->ExternalRequestType() = aExternalRequestInfo.RequestType(); |
1186 iFsm->ExitData().SetExitData(TPrivLocStateExitData::EExitPrivacyRequestReceived, KErrNone); |
1254 iFsm->ExitData().SetExitData(TPrivLocStateExitData::EExitPrivacyRequestReceived, KErrNone); |
1187 TPrivLocWaitPrivResponseParams privacyRequestParams( aSessionId, |
1255 TPrivLocWaitPrivResponseParams privacyRequestParams( aSessionId, |
1188 aSessionType, |
1256 aSessionType, |
1189 aExternalRequestInfo, |
1257 aExternalRequestInfo, |
1190 aNetPosRequestPrivacy, |
1258 aNetPosRequestPrivacy, |
1290 } |
1358 } |
1291 |
1359 |
1292 } |
1360 } |
1293 } |
1361 } |
1294 |
1362 |
1295 // For MtLrs the Protcol module should not |
1363 // For MtLrs the Protocol module should not |
1296 // send a REF position until after we have sent the Priv response to the PM |
1364 // send a REF position until after we have sent the Priv response to the PM |
1297 |
1365 |
1298 // Inform network of the privacy response for normal privacy requests. |
1366 // Inform network of the privacy response for normal privacy requests. |
1299 if (iFsm->SessionType() == TLbsNetworkEnumInt::EServiceMobileTerminated) |
1367 if (iFsm->SessionType() == TLbsNetworkEnumInt::EServiceMobileTerminated) |
1300 { |
1368 { |
1363 iFsm->PrivacyResponse() = aRequestResult; |
1431 iFsm->PrivacyResponse() = aRequestResult; |
1364 if(iFsm->PrivacyResponse() == TLbsNetworkEnumInt::EPrivacyResponseAccepted) |
1432 if(iFsm->PrivacyResponse() == TLbsNetworkEnumInt::EPrivacyResponseAccepted) |
1365 { |
1433 { |
1366 // Tell the AGPS handler that we are going to start a location request soon. |
1434 // Tell the AGPS handler that we are going to start a location request soon. |
1367 AgpsInterface()->PreStartPositioning(iFsm->SessionId(), iFsm->IsEmergency()); |
1435 AgpsInterface()->PreStartPositioning(iFsm->SessionId(), iFsm->IsEmergency()); |
|
1436 |
|
1437 // Set the Positioning Status for the UI indicator. |
|
1438 // Not done for silent requests. |
|
1439 if (iFsm->ExternalRequestType() < TLbsExternalRequestInfo::ERequestSingleShotSilent) |
|
1440 { |
|
1441 IncrementPositioningStatus(); |
|
1442 } |
1368 |
1443 |
1369 if(iFsm->LocReqReceived()) |
1444 if(iFsm->LocReqReceived()) |
1370 { |
1445 { |
1371 TPrivLocWaitLocationUpdateParams updateRequestParams(iFsm->SessionId(), |
1446 TPrivLocWaitLocationUpdateParams updateRequestParams(iFsm->SessionId(), |
1372 iFsm->PosRequestMethod(), |
1447 iFsm->PosRequestMethod(), |
2485 iIsEmergency(EFalse), |
2560 iIsEmergency(EFalse), |
2486 iSessionType(TLbsNetworkEnumInt::EServiceNone), |
2561 iSessionType(TLbsNetworkEnumInt::EServiceNone), |
2487 iRefPosProcessed(EFalse), |
2562 iRefPosProcessed(EFalse), |
2488 iLocReqReceived(EFalse), |
2563 iLocReqReceived(EFalse), |
2489 iReqCancelled(EFalse), |
2564 iReqCancelled(EFalse), |
2490 iWasPrivacyResponseReceivedStateExited(EFalse) |
2565 iWasPrivacyResponseReceivedStateExited(EFalse), |
|
2566 iPositioningStatusIncremented(EFalse) |
2491 { |
2567 { |
2492 } |
2568 } |
2493 |
2569 |
2494 // ----------------------------------------------------------------------------- |
2570 // ----------------------------------------------------------------------------- |
2495 // CLbsPrivLocFsm::~CLbsPrivLocFsm |
2571 // CLbsPrivLocFsm::~CLbsPrivLocFsm |
2610 const TLbsNetSessionIdInt& aSessionId, |
2686 const TLbsNetSessionIdInt& aSessionId, |
2611 TInt aReason) |
2687 TInt aReason) |
2612 { |
2688 { |
2613 LBSLOG3(ELogP3, "FSM(%d) OnSessionComplete reason=%d",iSessionId.SessionNum(),aReason); |
2689 LBSLOG3(ELogP3, "FSM(%d) OnSessionComplete reason=%d",iSessionId.SessionNum(),aReason); |
2614 iCurrentState->OnSessionComplete(aSessionId, aReason); |
2690 iCurrentState->OnSessionComplete(aSessionId, aReason); |
|
2691 |
|
2692 // update the positioning status. Note this is updated only if it was previously |
|
2693 // incremented as a result of this session. |
|
2694 if (WasPositioningStatusIncremented()) |
|
2695 { |
|
2696 PrivLocHandler().DecrementPositioningStatus(); |
|
2697 WasPositioningStatusIncremented() = EFalse; |
|
2698 } |
2615 } |
2699 } |
2616 |
2700 |
2617 // ----------------------------------------------------------------------------- |
2701 // ----------------------------------------------------------------------------- |
2618 // CLbsPrivLocFsm::OnNetLocRequest |
2702 // CLbsPrivLocFsm::OnNetLocRequest |
2619 // Description: The Message Switch has passed on a request for a position update |
2703 // Description: The Message Switch has passed on a request for a position update |