# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1273846596 -10800 # Node ID aadfb18aaac14ee2fb9e52925ac3cff2476a81b3 # Parent 2965a06983dcd25aa298f2c887cc55e187b8ad30 Revision: 201019 Kit: 201019 diff -r 2965a06983dc -r aadfb18aaac1 datasourcemodules/bluetoothgpspositioningmodule/group/lbsbtgpspsy.iby --- a/datasourcemodules/bluetoothgpspositioningmodule/group/lbsbtgpspsy.iby Mon May 03 13:50:32 2010 +0300 +++ b/datasourcemodules/bluetoothgpspositioningmodule/group/lbsbtgpspsy.iby Fri May 14 17:16:36 2010 +0300 @@ -19,7 +19,7 @@ #if !defined(SYMBIAN_EXCLUDE_LOCATION) -#if defined(SYMBIAN_INCLUDE_BLUETOOTH_GPS_PM) +#if defined(__BLUETOOTHGPSPSY) #ifdef _DEBUG ECOM_PLUGIN_UDEB(nlabtgpspsy.dll, nlabtgpspsy.rsc) #else @@ -33,7 +33,7 @@ file=ABI_DIR\DEBUG_DIR\lbsbtgpsconfig.dll System\libs\lbsbtgpsconfig.dll #endif // SYMBIAN_LOCATION_BTGPSCONFIG -#endif // SYMBIAN_INCLUDE_BLUETOOTH_GPS_PM +#endif // __BLUETOOTHGPSPSY #endif diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmolr/group/bld.inf --- a/lbstest/lbstestproduct/lbshybridmolr/group/bld.inf Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/lbshybridmolr/group/bld.inf Fri May 14 17:16:36 2010 +0300 @@ -47,6 +47,8 @@ ../scripts/uebased_molr_self_internal_value_test.script c:/testdata/scripts/uebased_molr_self_internal_value_test.script ../scripts/molr_error_assistance.script c:/testdata/scripts/molr_error_assistance.script +../scripts/hybrid_ueassisted_molr_posstatus.script c:/testdata/scripts/hybrid_ueassisted_molr_posstatus.script + //ini files ../testdata/lbs_molr.ini c:/testdata/configs/lbs_molr.ini diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmolr/group/ctlbshybridmolrserver.mmp --- a/lbstest/lbstestproduct/lbshybridmolr/group/ctlbshybridmolrserver.mmp Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/lbshybridmolr/group/ctlbshybridmolrserver.mmp Fri May 14 17:16:36 2010 +0300 @@ -65,6 +65,9 @@ // Supl tests SOURCE ctlbssuplmolrtbfutilesp.cpp +//Positioning Indicator test files +SOURCE ctlbshybridueassistednpudposstatus.cpp + // LBS libraries. LIBRARY lbs.lib LIBRARY lbsloccommon.lib @@ -78,6 +81,7 @@ LIBRARY lbsnetinternalapi.lib LIBRARY lbsinternalapi.lib LIBRARY lbspartnercommon.lib +LIBRARY lbspositioningstatus.lib // LBS test libraries. LIBRARY lbstestutils.lib diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmolr/inc/ctlbshybridueassistednpudposstatus.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lbstest/lbstestproduct/lbshybridmolr/inc/ctlbshybridueassistednpudposstatus.h Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,70 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This contains the header file for MOLR UE Assisted GPS ok +// +// + +#ifndef CTLBSHYBRIDUEASSISTEDNPUDPOSSTATUS_H +#define CTLBSHYBRIDUEASSISTEDNPUDPOSSTATUS_H + +// LBS test includes. +#include "ctlbshybridmolrstep.h" +#include +#include "lbs/lbspositioningstatus.h" + +// Literals used +_LIT(KLbsHybridUEAssistedNpudPosStatus,"LbsHybridUEAssistedNpudPosStatus"); + + +class CT_LbsHybridUEAssistedNpudPosStatus: public CT_LbsHybridMOLRStep, /*public MLbsPrivacyObserver*/ public MPosServerObserver, public MLbsPositioningStatusObserver +{ +public: + static CT_LbsHybridUEAssistedNpudPosStatus* New(CT_LbsHybridMOLRServer& aParent); + enum TVerdict doTestStepL(); + ~CT_LbsHybridUEAssistedNpudPosStatus(); + +protected: +/* // from MLbsPrivacyObserver + void ProcessNetworkLocationRequest(TUint aRequestId, const TLbsExternalRequestInfo& aRequestInfo, const TNotificationType& aNotificationType); + void ProcessNetworkPositionUpdate(TUint aRequestId, const TPositionInfo& aPosInfo); + void ProcessRequestComplete(TUint aRequestId, TInt aReason); +*/ + // MPosServerObserver + void OnGetLastKnownPosition(TInt32 aErr, const TPositionInfoBase& aPosInfo); + void OnNotifyPositionUpdate(TInt32 aErr, const TPositionInfoBase& aPosInfo); + + //MLbsPositioningStatusObserver + void OnPositioningStatusUpdate(const CLbsPositioningStatus::TLbsPositioningStatus& aPositioningStatus); + +protected: + CT_LbsHybridUEAssistedNpudPosStatus(CT_LbsHybridMOLRServer& aParent); + void ConstructL(); + +private: + enum TState + { + EInitializing, + EPrivacyCheckOk, + ERefLocReceived, + EGpsLocReceived + }; + + TState iState; + TLbsNetSessionId iSessionId; + TInt iPosStatusCount; + CLbsPositioningStatus::TLbsPositioningStatus iPositioningStatus; + CLbsPositioningStatus* iLbsPositioningStatus; +}; + +#endif // CTLBSHYBRIDUEASSISTEDNPUDPOSSTATUS_H diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmolr/inc/ctlbsmolrtracking.h --- a/lbstest/lbstestproduct/lbshybridmolr/inc/ctlbsmolrtracking.h Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/lbshybridmolr/inc/ctlbsmolrtracking.h Fri May 14 17:16:36 2010 +0300 @@ -30,11 +30,12 @@ #include #include "ctlbstestactivemanager.h" #include "ctlbsnetprotocol.h" +#include "lbs/lbspositioningstatus.h" // Literals used _LIT(KLbsMolrTracking, "LbsMolrTracking"); -class CT_LbsMolrTracking : public CT_LbsHybridMOLRStep, public MTestFlowObserver +class CT_LbsMolrTracking : public CT_LbsHybridMOLRStep, public MTestFlowObserver, public MLbsPositioningStatusObserver { private: class CT_ClientData : public CBase @@ -104,6 +105,9 @@ void StopTest(); void OnSignalNetworkStep(TInt aSessionId, TInt aSessionStep); + //MLbsPositioningStatusObserver + void OnPositioningStatusUpdate(const CLbsPositioningStatus::TLbsPositioningStatus& aPositioningStatus); + protected: CT_LbsMolrTracking(CT_LbsHybridMOLRServer& aParent); void ConstructL(); @@ -130,6 +134,10 @@ // =2 - MaxAge test // =3 - EarlyComplete test TInt iSpecialTestMode; + TInt iPositioningIndicatorCount; + TInt iPosStatusCount; + CLbsPositioningStatus* iLbsPositioningStatus; + CLbsPositioningStatus::TLbsPositioningStatus iPositioningStatus; }; #endif //__CT_LBS_MOLR_TRACKING_H__ diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmolr/scripts/hybrid_ueassisted_molr_posstatus.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lbstest/lbstestproduct/lbshybridmolr/scripts/hybrid_ueassisted_molr_posstatus.script Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,69 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +//! @File +//! @SYMTestSuiteName LBS-HybridMOLR-UEAssistedMOLR-PosStatus +//! @SYMScriptTestEnvironment TestExecute using hybrid_ueassisted_molr_posstatus.script + + +LOAD_SUITE LbsHybridMOLRTestServer -SharedData + +PRINT Run LbsHybridMOLRTestServer + + +// Before we start LBS, select the test A-GPS integration module to use. +// Make sure the default profile is used, rather than one from the c drive +PREFIX RUN_UTILS + DeleteFile c:\private\10282253\lbs\lbsprofile.ini + MkDir c:\private\10282253\ + MkDir c:\private\10282253\lbs\ + MkDir c:\private\10282253\lbs\locmods\ +// CopyFile c:\testdata\configs\xtestmodule.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini + CopyFile c:\testdata\configs\ctagpsnpetestmoduledatasource.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini + CopyFile c:\testdata\configs\lbstestconfig.txt c:\config.txt +REMOVE_PREFIX + +// Reset admin (reset will give us the EGpsPreferTerminalBased). +RUN_TEST_STEP 010 LbsHybridMOLRTestServer LbsStep_ResetDefaultAdmin + +// Use hybrid protocol module +RUN_TEST_STEP 010 LbsHybridMOLRTestServer LbsStep_SetupProtocolStub + +// Use hybrid protocol module +RUN_TEST_STEP 010 LbsHybridMOLRTestServer LbsStep_SetupRoamSelfLocate + +RUN_TEST_STEP 030 LbsHybridMOLRTestServer LbsStep_StartLbs + +START_TESTCASE LBS-HybridMOLR-UEAssistedMOLR-PosStatus-0001 +//! @SYMTestCaseID LBS-HybridMOLR-UEAssistedMOLR-PosStatus-0001 +//! @SYMTestCaseDesc Client generates MOLR request +//! @SYMTestPriority Critical +//! @SYMTestActions See test step Sequence inline comments +//! @SYMTestExpectedResults Sequence as per specified by FSM and UML Seq diagram is Followed +//! @SYMTestType CIT +//! @SYMCreationDate 26/3/2010 +//! @SYMAuthor brsengar +RUN_TEST_STEP 010 LbsHybridMOLRTestServer LbsStep_InstallScheduler +RUN_TEST_STEP 020 LbsHybridMOLRTestServer LbsStep_SetUpPsy c:\testdata\configs\lbs_molr.ini LBS-MOLR +// Configure Hybrid AGps module options +RUN_TEST_STEP 120 LbsHybridMOLRTestServer LbsStep_ConfigHybridModule c:\testdata\configs\lbs_molr.ini UEAssistedMOLRGpsOk +RUN_TEST_STEP 120 LbsHybridMOLRTestServer LbsHybridUEAssistedNpudPosStatus +END_TESTCASE LBS-HybridMOLR-UEAssistedMOLR-PosStatus-0001 + + +RUN_TEST_STEP 020 LbsHybridMOLRTestServer LbsStep_StopLbs + +RUN_UTILS DeleteFile c:\private\10282253\lbs\locmods\agpsintegmodule.ini + diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmolr/src/ctlbshybridmolrserver.cpp --- a/lbstest/lbstestproduct/lbshybridmolr/src/ctlbshybridmolrserver.cpp Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/lbshybridmolr/src/ctlbshybridmolrserver.cpp Fri May 14 17:16:36 2010 +0300 @@ -47,6 +47,7 @@ #include "ctlbssuplmolrtbfutilesp.h" #include "ctlbsuebasedmolronesl.h" #include "ctlbsmolrerrorassistance.h" +#include "ctlbshybridueassistednpudposstatus.h" /** NewL() @@ -280,6 +281,10 @@ { return CT_LbsMolrErrorAssistance::New(*this); } + else if (aStepName == KLbsHybridUEAssistedNpudPosStatus) + { + return CT_LbsHybridUEAssistedNpudPosStatus::New(*this); + } // Let base class handle any common test steps - will return NULL if test step is not supported. return CT_LbsServer::CreateTestStep(aStepName); diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmolr/src/ctlbshybridueassistednpudposstatus.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lbstest/lbstestproduct/lbshybridmolr/src/ctlbshybridueassistednpudposstatus.cpp Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,431 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This is the class implementation for the MO-LR - Accurate GPS Result scenario Tests +// +// + +// LBS includes. +#include +#include +#include + +// LBS test includes. +#include "ctlbshybridueassistednpudposstatus.h" +#include +#include "argutils.h" +#include + + +const TInt KN(2); // Number of times to send the measurement from GPS to NW + +/** +Static Constructor +*/ +CT_LbsHybridUEAssistedNpudPosStatus* CT_LbsHybridUEAssistedNpudPosStatus::New(CT_LbsHybridMOLRServer& aParent) + { + // Note that we do not use ELeave. + // This means that having insufficient memory will return NULL; + CT_LbsHybridUEAssistedNpudPosStatus* testStep = new CT_LbsHybridUEAssistedNpudPosStatus(aParent); + if (testStep) + { + TInt err = KErrNone; + + TRAP(err, testStep->ConstructL()); + if (err) + { + delete testStep; + testStep = NULL; + } + } + return testStep; + } + + +/** + * Constructor + */ +CT_LbsHybridUEAssistedNpudPosStatus::CT_LbsHybridUEAssistedNpudPosStatus(CT_LbsHybridMOLRServer& aParent) : CT_LbsHybridMOLRStep(aParent) + { + SetTestStepName(KLbsHybridUEAssistedNpudPosStatus); + iSessionId.SetSessionOwner(KRequestUid); + iSessionId.SetSessionNum(0x0005); + } + + +void CT_LbsHybridUEAssistedNpudPosStatus::ConstructL() + { + // Create the base class objects. + CT_LbsHybridMOLRStep::ConstructL(); + iLbsPositioningStatus = CLbsPositioningStatus::NewL(*this); + iPosStatusCount = 0; + } + + +/** + * Destructor + */ +CT_LbsHybridUEAssistedNpudPosStatus::~CT_LbsHybridUEAssistedNpudPosStatus() + { + delete iLbsPositioningStatus; + } + +// Hybrid - UE Assisted MO-LR GPS ok + +TVerdict CT_LbsHybridUEAssistedNpudPosStatus::doTestStepL() + { + INFO_PRINTF1(_L("CT_LbsHybridUEAssistedNpudPosStatus::doTestStepL()")); + + // Stop the test if the preable failed + TESTL(TestStepResult() == EPass); + + const TInt KTimeOut = 60*1000*1000; + + // Create Network Protocol Proxy + CNetProtocolProxy* proxy = CNetProtocolProxy::NewL(); + CleanupStack::PushL(proxy); + + // >> AdviceSystemStatus(0) - GetCurrentCapabilitiesResponse + TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgGetCurrentCapabilitiesResponse); + CLbsNetworkProtocolBase::TLbsSystemStatus status; + TInt cleanupCnt; + cleanupCnt = proxy->GetArgsLC(ENetMsgGetCurrentCapabilitiesResponse, &status); + TESTL(status == CLbsNetworkProtocolBase::ESystemStatusNone); + CleanupStack::PopAndDestroy(cleanupCnt); + + // Start Test Step + RPositionServer server; + TESTL(KErrNone == server.Connect()); + CleanupClosePushL(server); + + RPositioner pos; + TESTL(KErrNone == pos.Open(server)); + + CPosServerWatcher *pWatch = NULL; + TInt reason = KErrNone; + + CleanupClosePushL(pos); + // Set the max fix time for the client request to ensure the location server does not complete the request too soon during the test. + TPositionUpdateOptions posOpts(TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(KMOLRFixTime)); + pos.SetUpdateOptions(posOpts); + + pWatch = CPosServerWatcher::NewLC(pos, *this); + + // Request a self-locate MoLr. + pWatch->IssueNotifyPositionUpdate(); + CheckForObserverEventTestsL(KTimeOut, *this); + //We should get Positioning Indicator flag on and may be off after that + TESTL(iPosStatusCount==1); + TESTL(iPositioningStatus == CLbsPositioningStatus::ELbsPositioningStatusActive); + + // >> RequestSelfLocation() + TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestSelfLocation); + + // Process the response. + TLbsNetSessionId* sessionId = NULL; + TLbsNetPosRequestOptionsAssistance* opts = NULL; + + cleanupCnt = proxy->GetArgsLC(ENetMsgRequestSelfLocation, &sessionId, &opts); + + TBool qualitycheck = ArgUtils::CompareQuality( opts, + ETrue, + KMinHorizontalAcc, + KMinVerticalAcc, + KMOLRFixTime, + 0, + EAssistanceDataReferenceTime, + (TPositionModuleInfo::ETechnologyTerminal + | TPositionModuleInfo::ETechnologyAssisted) + ); + + TESTL(qualitycheck); + + iSessionId.SetSessionNum(sessionId->SessionNum()); + iSessionId.SetSessionOwner(sessionId->SessionOwner()); + + CleanupStack::PopAndDestroy(cleanupCnt); + sessionId = NULL; + opts = NULL; + + // << ProcessStatusUpdate(EServiceSelfLocation) + MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask activeServiceMask = MLbsNetworkProtocolObserver::EServiceSelfLocation; + proxy->CallL(ENetMsgProcessStatusUpdate, &activeServiceMask); + + // << ProcessLocationUpdate(SessionId, RefPosition) + TPositionInfo refPosInfo = ArgUtils::MolrReferencePositionInfo(); + proxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, &refPosInfo); + + // TEST: Get the ref pos app side. + CheckForObserverEventTestsL(KTimeOut, *this); + //Check for Position Status update - This event could be after reference position + //NOTE: Ref position and positioning indicator callback can be in any order + CheckForObserverEventTestsL(KTimeOut, *this); + TESTL(iPosStatusCount==2); + TESTL(iPositioningStatus == CLbsPositioningStatus::ELbsPositioningStatusNotActive); + + // << ProcessAssistanceData() + TLbsAsistanceDataGroup dataMask = EAssistanceDataReferenceTime; + RLbsAssistanceDataBuilderSet assistanceData; + ArgUtils::PopulateLC(assistanceData); + reason = KErrNone; + proxy->CallL(ENetMsgProcessAssistanceData, &dataMask, &assistanceData, &reason); + CleanupStack::PopAndDestroy(); // assistanceData + + // << ProcessLocationRequest(SessionId, HybridMode, alpha2) + TBool emergency = EFalse; + MLbsNetworkProtocolObserver::TLbsNetProtocolService service = MLbsNetworkProtocolObserver::EServiceSelfLocation; + TLbsNetPosRequestQuality quality = ArgUtils::Quality(); + quality.SetMaxFixTime(ArgUtils::Alpha2()); + TLbsNetPosRequestMethod method = ArgUtils::RequestHybridMethod(); + proxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method); + + // Now that the hybrid/alpha2 has been requested, record current time to verify alpha2 timer expires correctly. + TTime startTime; + startTime.HomeTime(); + + // >> RequestAssistanceData(0) + TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); + cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask); + TESTL(dataMask == EAssistanceDataNone); + CleanupStack::PopAndDestroy(cleanupCnt); + + // << NotifyPositionUpdate() + pWatch->IssueNotifyPositionUpdate(); + + CheckForObserverEventTestsL(KTimeOut, *this); + //We should get Positioning Indicator flag on + TESTL(iPosStatusCount==3); + TESTL(iPositioningStatus == CLbsPositioningStatus::ELbsPositioningStatusActive); + + // >> RequestAssistanceData(0) + TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); + + + cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask); + TESTL(dataMask == EAssistanceDataNone); + CleanupStack::PopAndDestroy(cleanupCnt); + // Determine the value to take off the alpha2 value. This is required because we had to wait for the assistance data response. + TTimeIntervalMicroSeconds microseconds; + TTime stopTime; + stopTime.HomeTime(); + microseconds = stopTime.MicroSecondsFrom(startTime); + TInt64 timeElapsed = microseconds.Int64(); + TInt delta = 2 * 1000 * 1000; // 2 secs. + + // >> RespondLocationRequest() + TESTL(proxy->WaitForResponse(ArgUtils::Alpha2() - timeElapsed - delta) == ENetMsgTimeoutExpired); + + // Wait for and process the response. + TESTL(proxy->WaitForResponse(2 * delta) == ENetMsgRespondLocationRequest); // DONT get because the measurement data bus has not been created... + + sessionId = NULL; + TPositionGpsMeasurementInfo* measurementInfo = NULL; + cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &measurementInfo); + TESTL(sessionId->SessionNum() == iSessionId.SessionNum()); + TESTL(reason == KErrNone); + CleanupStack::PopAndDestroy(cleanupCnt);//sessionId, measurementInfo + + // Recv -> RequestAssistanceData - we get an extra msg as the result of the A-GPS manager re-issueing a location request when it's + // max fix time timer expries. + TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); + cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask); + TESTL(dataMask == EAssistanceDataNone); + CleanupStack::PopAndDestroy(cleanupCnt); + const TInt t = 8 * 1000 * 1000; // 8 secs. + quality.SetMaxFixTime(t); + + TPositionExtendedSatelliteInfo* positionInfo = NULL; + //TPositionInfo* positionInfo = NULL; + + for (TInt i = 0; i < KN; i++) + { + // << ProcessLocationRequest(SessionId, HybridMode, t) + proxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method); + + // >> RequestAssistanceData(0) + TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); + cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask); + TESTL(dataMask == EAssistanceDataNone); + CleanupStack::PopAndDestroy(cleanupCnt); + + // >> RespondLocationRequest() - first measurement, second position. + TESTL(proxy->WaitForResponse(t + delta) == ENetMsgRespondLocationRequest); + + sessionId = NULL; + + // Expect measurement first time. + if (i < (KN-1)) + { + measurementInfo = NULL; + cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &measurementInfo); + + // Check it is measurement + TESTL(measurementInfo->PositionClassType() == EPositionGpsMeasurementInfoClass); + + // >> RequestAssistanceData - we get an extra msg as the result of the A-GPS manager re-issueing a location request when it's + // max fix time timer expries. + TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); + + cleanupCnt += proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask); + + TESTL(dataMask == EAssistanceDataNone); + TESTL(sessionId->SessionNum() == iSessionId.SessionNum()); + TESTL(reason == KErrNone); + } + + // Expect position second time. + else + { + cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &positionInfo); + + // check it is a position + TESTL(positionInfo->PositionClassType() == (EPositionInfoClass|EPositionCourseInfoClass|EPositionSatelliteInfoClass|EPositionExtendedSatelliteInfoClass)); + TESTL(sessionId->SessionNum() == iSessionId.SessionNum()); + TESTL(reason == KErrNone); + /* Check whether ExtendedSatelliteInfo data received by protocol module is the same as data fed to the GPS module or not. + Latitude(50.2454),Longitude(0.1668),Altitude(1.0),HorizontalAccuracy(10),VerticalAccuracy(10), speed(26.0),vertical speed(20.0),heading(25.0),course(30.0), + SPEED_ACCURACY(2.0),VERTICAL_SPEED_ACCURACY(3.0),HEADING_ACCURACY(10.0),COURSE_ACCURACY(4.0), + SD_OF_LONG_ERROR(5.0),SD_OF_LAT_ERROR(6.0),SD_OF_ALT_ERROR(7.0),SD_OF_SEMI_MAJOR_AXIS_ERROR(8.0), + SD_OF_SEMI_MINOR_AXIS_ERROR(9.0),ORIEN_OF_SEMI_MAJOR_AXIS_ERROR(10.0),RMS_VAL_OF_SD_OF_RANGE(11.0), + GEOIDAL_SEPARATION(12.0),MAGNETIC_VARIATION(13.0),COURSE_OVER_GROUND_MAGNETIC(14.0) + GPS_TIMING_OF_CELL_MsPart(16383),GPS_TIMING_OF_CELL_LsPart(4294967295),REFERENCE_IDENTITY(511) + SFN(4095)*/ + + TPosition gpsPos; + positionInfo->GetPosition(gpsPos); + TESTL(gpsPos.Latitude()==50.2454 && gpsPos.Longitude()== 0.1668 && gpsPos.Altitude()==1.0 + && gpsPos.HorizontalAccuracy()==10 && gpsPos.VerticalAccuracy()==10); + TCourse course; + positionInfo->GetCourse(course); + + TESTL(course.Speed()==26.0 && course.VerticalSpeed()==20.0 && course.Heading()==25.0 && course.Course()==30.0 && + course.SpeedAccuracy()==2.0 && course.VerticalSpeedAccuracy()==3.0 && course.HeadingAccuracy()==10.0 && + course.CourseAccuracy()==4.0); + + TDetailedErrorReport detErrRep; + positionInfo->GetDetailedErrorReport(detErrRep); + TESTL(detErrRep.StanDeviOfLongitudeError()==5.0 && detErrRep.StanDeviOfLatiitudeError()==6.0 && + detErrRep.StanDeviOfAltitudeError()==7.0 && detErrRep.StanDeviOfSemiMajorAxisError()==8.0 && + detErrRep.StanDeviOfSemiMinorAxisError()==9.0 && detErrRep.OrientationOfSemiMajorAxisError()==10.0 && + detErrRep.RmsValOfStanDeviOfRange()==11.0); + + TGpsTimingMeasurementData gpsTimingData; + positionInfo->GetGpsTimingData(gpsTimingData); + + TESTL(gpsTimingData.DataType()== TGpsTimingMeasurementData::EGpsTimingDataTypeUtran && + gpsTimingData.NetworkMode()== TGpsTimingMeasurementData::ENetworkModeFdd && + gpsTimingData.GPSTimingOfCellMsPart()==16383 && gpsTimingData.GPSTimingOfCellLsPart()==4294967295LL && + gpsTimingData.ReferenceIdentity()==511 && gpsTimingData.Sfn()==4095); + + + TESTL(positionInfo->GeoidalSeparation()==12.0 && positionInfo->MagneticVariation()==13.0 && + positionInfo->CourseOverGroundMagnetic()==14.0); + + + // Client recv - the gps position determined by the gps module. + CheckForObserverEventTestsL(KTimeOut, *this); + // Check Positioning Status Indicator callback - + //NOTE: GPS position and positioning indicator callback can be in any order + CheckForObserverEventTestsL(KTimeOut, *this); + //We should get Positioning Indicator flag off + TESTL(iPosStatusCount==4); + TESTL(iPositioningStatus == CLbsPositioningStatus::ELbsPositioningStatusNotActive); + + TESTL(iState == EGpsLocReceived); + + // << ProcessLocationUpdate(SessionId, FinalNetworkPosition) + // Return modules' position as FinalNetworkPosition + proxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, positionInfo); + } + CleanupStack::PopAndDestroy(cleanupCnt);// sessionId, measurementInfo/positionInfo + } + + // << ProcessSessionComplete(SessionId, KErrNone) + reason = KErrNone; + proxy->CallL(ENetMsgProcessSessionComplete, &iSessionId, &reason); + + // << ENetMsgProcessStatusUpdate() + MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask serviceMask = MLbsNetworkProtocolObserver::EServiceNone; + proxy->CallL(ENetMsgProcessStatusUpdate, &serviceMask); + + // Wait for 10 seconds to ensure no additional responses turn up. + delta = 10 * 1000 * 1000; + TNetProtocolResponseType mType = proxy->WaitForResponse(delta); + TESTL(mType == ENetMsgTimeoutExpired); + + // Done. Now cleanup... + CleanupStack::PopAndDestroy(pWatch); + CleanupStack::PopAndDestroy(); // pos + CleanupStack::PopAndDestroy(); // server + CleanupStack::PopAndDestroy(proxy); + + return TestStepResult(); + } + + +// MPosServerObserver +void CT_LbsHybridUEAssistedNpudPosStatus::OnGetLastKnownPosition(TInt32 /*aErr*/, const TPositionInfoBase& /*aPosInfo*/) + { + TEST(EFalse); // Shouldn't see this... + ReturnToTestStep(); + } + +void CT_LbsHybridUEAssistedNpudPosStatus::OnNotifyPositionUpdate(TInt32 aErr, const TPositionInfoBase& aPosInfo) + { + // Verify error. + if (aErr == KErrCancel) + { + iState = ERefLocReceived; + } + else + { + TEST(aErr == KErrNone); + + // Verify position. + TEST(aPosInfo.PositionClassType() == EPositionInfoClass); + + // Expecting ref pos. + if (iState == EInitializing) + { + iState = ERefLocReceived; + + TEST(aPosInfo.PositionMode() == TPositionModuleInfo::ETechnologyNetwork); + + // check for refpos details + const TPositionInfo posInfo = static_cast(aPosInfo); + TESTL(ArgUtils::ComparePositionInfoToMolrRefPos(posInfo)); + } + + // Expecting network pos. + else if (iState == ERefLocReceived) + { + iState = EGpsLocReceived; + + TEST(aPosInfo.PositionMode() == (TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted)); + } + + // Not expecting anything else. + else + { + TEST(EFalse); + } + } + ReturnToTestStep(); + } + +void CT_LbsHybridUEAssistedNpudPosStatus::OnPositioningStatusUpdate(const CLbsPositioningStatus::TLbsPositioningStatus& aPositioningStatus) + { + iPosStatusCount++; + iPositioningStatus = aPositioningStatus; + ReturnToTestStep(); + } diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmolr/src/ctlbsmolrtracking.cpp --- a/lbstest/lbstestproduct/lbshybridmolr/src/ctlbsmolrtracking.cpp Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/lbshybridmolr/src/ctlbsmolrtracking.cpp Fri May 14 17:16:36 2010 +0300 @@ -84,6 +84,9 @@ { // Create the base class objects. CT_LbsHybridMOLRStep::ConstructL(); + iLbsPositioningStatus = CLbsPositioningStatus::NewL(*this); + iPosStatusCount = 0; + iPositioningStatus = CLbsPositioningStatus::ELbsPositioningStatusNotActive; } /** @@ -91,6 +94,7 @@ */ CT_LbsMolrTracking::~CT_LbsMolrTracking() { + delete iLbsPositioningStatus; TRAP_IGNORE(doTestStepPostambleL()); } @@ -232,6 +236,16 @@ TEST(EFalse); } + _LIT(KPositioningIndicator, "PositioningIndicator"); + TInt positioningIndicatorCount; + if(GetIntFromConfig(ConfigSection(), KPositioningIndicator, positioningIndicatorCount)) + { + iPositioningIndicatorCount = positioningIndicatorCount; + } + else + { + iPositioningIndicatorCount = 0; + } // Get the SpecialTestModemode setting ... 0 means not in a LastKnownPosition mode _LIT(KLastKnownPosition, "SpecialTestMode"); @@ -274,6 +288,11 @@ TVerdict CT_LbsMolrTracking::doTestStepPostambleL() { INFO_PRINTF1(_L(">>CT_LbsMolrTracking::doTestStepPostambleL()")); + if(iPositioningIndicatorCount>0) + { + TESTL(iPositioningIndicatorCount==iPosStatusCount); + TESTL(iPositioningStatus == CLbsPositioningStatus::ELbsPositioningStatusNotActive); + } iClients.ResetAndDestroy(); iClientTestManagers.ResetAndDestroy(); @@ -389,7 +408,11 @@ INFO_PRINTF2(_L("Client number %d received a position"), aObjectId); INFO_PRINTF3(_L("Client now has %d of %d positions"), positionsReceived+1, numberOfNPUDs); - + if(iPositioningIndicatorCount>0) + { + TESTL(iPosStatusCount==1); + TESTL(iPositioningStatus == CLbsPositioningStatus::ELbsPositioningStatusActive); + } if (iSpecialTestMode == 2) { @@ -726,3 +749,8 @@ CleanupStack::PopAndDestroy(moduleUpdate); CleanupStack::PopAndDestroy(db); } +void CT_LbsMolrTracking::OnPositioningStatusUpdate(const CLbsPositioningStatus::TLbsPositioningStatus& aPositioningStatus) + { + iPosStatusCount++; + iPositioningStatus = aPositioningStatus; + } diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmolr/testdata/lbs_molr_tracking.ini --- a/lbstest/lbstestproduct/lbshybridmolr/testdata/lbs_molr_tracking.ini Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/lbshybridmolr/testdata/lbs_molr_tracking.ini Fri May 14 17:16:36 2010 +0300 @@ -9,6 +9,7 @@ // It is expected that the network will return the position PositionOriginator = 2 expected_api_behaviour = 1 +PositioningIndicator = 2 // The client information // first client: session ID delay = 0, session step delay = 0, NPUDs = 15, interval = 5s, time out = 3s, max age = 0s, accept partial = false @@ -24,6 +25,7 @@ // It is expected that the network will return the position PositionOriginator = 2 expected_api_behaviour = 1 +PositioningIndicator = 2 // The client information // first client: session ID delay = 0, session step delay = 0, NPUDs = 8, interval = 10s, time out = 5s, max age = 0s, accept partial = false @@ -39,6 +41,7 @@ // It is expected that the network will return the position PositionOriginator = 2 expected_api_behaviour = 1 +PositioningIndicator = 2 // The client information // first client: session ID delay = 0, session step delay = 0, interval = 5s, time out = 3s, max age = 0s, accept partial = false @@ -57,6 +60,7 @@ // It is expected that the module will return the position PositionOriginator = 1 expected_api_behaviour = 1 +PositioningIndicator = 2 // The client information // first client: session ID delay = 0, session step delay = 0, NPUDs = 15, interval = 5s, time out = 3s, max age = 0s, accept partial = false @@ -72,6 +76,7 @@ // It is expected that the module will return the position PositionOriginator = 1 expected_api_behaviour = 1 +PositioningIndicator = 2 // The client information // first client: session ID delay = 0, session step delay = 0, NPUDs = 8, interval = 10s, time out = 5s, max age = 0s, accept partial = false @@ -87,6 +92,7 @@ // It is expected that the module will return the position PositionOriginator = 1 expected_api_behaviour = 1 +PositioningIndicator = 2 // The client information // first client: session ID delay = 0, session step delay = 0, interval = 5s, time out = 3s, max age = 0s, accept partial = false @@ -167,6 +173,7 @@ // It is expected that the network will return the position PositionOriginator = 2 expected_api_behaviour = 1 +PositioningIndicator = 2 // The client information // first client: session ID delay = 0, session step delay = 0, NPUDs = 2, interval = 5s, time out = 3s, max age = 0s, accept partial = false, cancel = true, cancel session ID = 2, cancel session step = 1 @@ -183,6 +190,7 @@ // It is expected that the network will return the position PositionOriginator = 2 expected_api_behaviour = 1 +PositioningIndicator = 2 // The client information // first client: session ID delay = 0, session step delay = 0, NPUDs = 2, interval = 5s, time out = 3s, max age = 0s, accept partial = false, cancel = true, cancel session ID = 2, cancel session step = 1 @@ -198,6 +206,7 @@ // It is expected that the network will return the position PositionOriginator = 2 expected_api_behaviour = 1 +PositioningIndicator = 2 // The client information // first client: session ID delay = 0, session step delay = 0, NPUDs = 2, interval = 5s, time out = 3s, max age = 0s, accept partial = false, cancel = true, cancel session ID = 2, cancel session step = 1 @@ -213,6 +222,7 @@ // It is expected that the module will return the position PositionOriginator = 1 expected_api_behaviour = 1 +PositioningIndicator = 2 // The client information // first client: session ID delay = 0, session step delay = 0, NPUDs = 2, interval = 5s, time out = 3s, max age = 0s, accept partial = false, cancel = true, cancel session ID = 2, cancel session step = 1 @@ -229,6 +239,7 @@ // It is expected that the module will return the position PositionOriginator = 1 expected_api_behaviour = 1 +PositioningIndicator = 2 // The client information // first client: session ID delay = 0, session step delay = 0, NPUDs = 2, interval = 5s, time out = 3s, max age = 0s, accept partial = false, cancel = true, cancel session ID = 2, cancel session step = 1 @@ -245,6 +256,7 @@ // It is expected that the module will return the position PositionOriginator = 1 expected_api_behaviour = 1 +PositioningIndicator = 2 // The client information // first client: session ID delay = 0, session step delay = 0, NPUDs = 2, interval = 5s, time out = 3s, max age = 0s, accept partial = false, cancel = true, cancel session ID = 2, cancel session step = 1 @@ -266,6 +278,7 @@ $modulemodes,3* // PTB $modulemodes,1* +PositioningIndicator = 2 // The client information @@ -290,6 +303,7 @@ $modulemodes,1* // Auto $modulemodes,3* +PositioningIndicator = 2 // The client information // first client: session ID delay = 0, session step delay = 0, NPUDs = 5, interval = 5s, time out = 3s, max age = 0s, accept partial = false, cancel = false(, cancel session id = 0, cancel step id = 0), psy uid = agps module @@ -310,6 +324,7 @@ // The module should be set to ATA and then not set again // ATA $modulemodes,4* +PositioningIndicator = 2 // The client information @@ -317,6 +332,3 @@ $clientdetails,0,0,3,5000000,3000000,0,false,false,0,0,270526860* // second client: session ID delay = 1, session step delay = 0, NPUDs = 1, interval = 5s, time out = 3s, max age = 0s, accept partial = false, cancel = false(, cancel session id = 0, cancel step id = 0), psy uid = gps module, expected error = KErrInUse $clientdetails,1,0,1,5000000,3000000,0,false,false,0,0,270526858,-14* - - - diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmtlr/group/bld.inf --- a/lbstest/lbstestproduct/lbshybridmtlr/group/bld.inf Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/lbshybridmtlr/group/bld.inf Fri May 14 17:16:36 2010 +0300 @@ -26,6 +26,7 @@ ../scripts/mtlr_reset_assistance.script c:/testdata/scripts/mtlr_reset_assistance.script ../scripts/mtlr_network_induced.script c:/testdata/scripts/mtlr_network_induced.script ../scripts/lbs_oom.script c:/testdata/scripts/lbs_oom.script +../scripts/hybrid_ueassisted_mtlr_posstatus.script c:/testdata/scripts/hybrid_ueassisted_mtlr_posstatus.script ../testdata/lbs_mtlr.ini c:/testdata/configs/lbs_mtlr.ini diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmtlr/group/ctlbshybridmtlrserver.mmp --- a/lbstest/lbstestproduct/lbshybridmtlr/group/ctlbshybridmtlrserver.mmp Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/lbshybridmtlr/group/ctlbshybridmtlrserver.mmp Fri May 14 17:16:36 2010 +0300 @@ -47,6 +47,7 @@ SOURCE ctlbsmtlrresetassistance.cpp SOURCE ctlbsnetworkinducedmtlr.cpp SOURCE ctlbsoom.cpp +SOURCE ctlbshybridueassistedmtlrposstatus.cpp // LBS libraries. LIBRARY lbs.lib @@ -61,6 +62,7 @@ LIBRARY lbsinternalapi.lib LIBRARY lbspartnercommon.lib LIBRARY lbsdebug.lib +LIBRARY lbspositioningstatus.lib // LBS test libraries. LIBRARY lbstestutils.lib LIBRARY lbstestclient.lib diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmtlr/inc/ctlbshybridueassistedmtlrposstatus.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lbstest/lbstestproduct/lbshybridmtlr/inc/ctlbshybridueassistedmtlrposstatus.h Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,76 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This contains the header file for MTLR UE Assisted GPS ok +// +// + +#ifndef __CT_LBS_HYBRID_UEASSISTED_MTLR_POS_STATUS_H__ +#define __CT_LBS_HYBRID_UEASSISTED_MTLR_POS_STATUS_H__ + +// LBS includes. +#include +#include +#include +#include + +// LBS test includes. +#include "ctlbshybridmtlrstep.h" +#include +#include "lbs/lbspositioningstatus.h" + + +// Literals used +_LIT(KLbsHybridUEAssistedMTLRPosStatus,"LbsHybridUEAssistedMTLRPosStatus"); + +class CT_LbsHybridUEAssistedMTLRPosStatus: public CT_LbsHybridMTLRStep, public MLbsPrivacyObserver, public MLbsPositioningStatusObserver +{ +public: + static CT_LbsHybridUEAssistedMTLRPosStatus* New(CT_LbsHybridMTLRServer& aParent); + enum TVerdict doTestStepL(); + ~CT_LbsHybridUEAssistedMTLRPosStatus(); + +protected: + // from MLbsPrivacyObserver + void ProcessNetworkLocationRequest(TUint aRequestId, const TLbsExternalRequestInfo& aRequestInfo, const TNotificationType& aNotificationType); + void ProcessNetworkPositionUpdate(TUint aRequestId, const TPositionInfo& aPosInfo); + void ProcessRequestComplete(TUint aRequestId, TInt aReason); + + //MLbsPositioningStatusObserver + void OnPositioningStatusUpdate(const CLbsPositioningStatus::TLbsPositioningStatus& aPositioningStatus); + +protected: + CT_LbsHybridUEAssistedMTLRPosStatus(CT_LbsHybridMTLRServer& aParent); + void ConstructL(); + +private: + enum TState + { + EInitializing, + EPrivacyCheckOk, + ERefLocReceived, + EGpsLocReceived, + ERequestComplete + }; + + TState iState; + TLbsNetSessionId iSessionId; + CLbsPrivacyController* iController; + CNetProtocolProxy* iProxy; + + CLbsPositioningStatus* iLbsPostioningStatus; + TInt iPosStatusCount; + CLbsPositioningStatus::TLbsPositioningStatus iPositioningStatus; +}; + +#endif //__CT_LBS_HYBRID_UEASSISTED_MTLR_POS_STATUS_H__ diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmtlr/scripts/hybrid_ueassisted_mtlr_posstatus.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lbstest/lbstestproduct/lbshybridmtlr/scripts/hybrid_ueassisted_mtlr_posstatus.script Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,75 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +LOAD_SUITE LbsHybridMTLRTestServer -SharedData + +PRINT Run LbsHybridMTLRTestServer + + +// Before we start LBS, select the test A-GPS integration module to use. +PREFIX RUN_UTILS + MkDir c:\private\10282253\ + MkDir c:\private\10282253\lbs\ + MkDir c:\private\10282253\lbs\locmods\ +// CopyFile c:\testdata\configs\xtestmodule.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini + CopyFile c:\testdata\configs\ctagpsnpetestmoduledatasource.ini c:\private\10282253\lbs\locmods\agpsintegmodule.ini + CopyFile c:\testdata\configs\lbstestconfig.txt c:\config.txt +REMOVE_PREFIX + +// Reset admin (reset will give us the EGpsPreferTerminalBased). +RUN_TEST_STEP 010 LbsHybridMTLRTestServer LbsStep_ResetDefaultAdmin + +// Select MTLR privacy controller. +RUN_TEST_STEP 010 LbsHybridMTLRTestServer LbsStep_SetPrivacyHandler c:\testdata\configs\lbs_mtlr.ini PrivHandler + +// Use hybrid protocol module +RUN_TEST_STEP 010 LbsHybridMTLRTestServer LbsStep_SetupProtocolStub + +RUN_TEST_STEP 030 LbsHybridMTLRTestServer LbsStep_StartLbs + + + +START_TESTCASE LBS-HybridMTLR-UEAssistedMTLR-PosStatus-0001 +//!@SYMTestCaseID LBS-HybridMTLR-UEAssistedMTLR-PosStatus-0001 + +//!@SYMTestCaseDesc MTLR Request received +//! GPS Module generates an accurate position in UE Assisted Mode +//! See: lbshybridmtlr/documentation/mtlr.htm#HybridUEAssistedMTLRAccurate +//! +//! +//!@SYMTestActions +//! See test step Sequence inline comments +//! +//! +//!@SYMTestExpectedResults Sequence as per specified by FSM and UML Seq diagram is Followed +//!@SYMPREQ PREQ1624 +//!@SYMREQ REQ1624.xyz +//! +//!@SYMTestType CIT +//!@SYMTestPriority 1 +//!@SYMTestStatus Implemented. + +RUN_TEST_STEP 010 LbsHybridMTLRTestServer LbsStep_InstallScheduler + +// Configure Hybrid AGps module options +RUN_TEST_STEP 120 LbsHybridMTLRTestServer LbsStep_ConfigHybridModule c:\testdata\configs\lbs_mtlr.ini HybridUEAssistedMTLRGPSOK + +RUN_TEST_STEP 120 LbsHybridMTLRTestServer LbsHybridUEAssistedMTLRPosStatus + +END_TESTCASE LBS-HybridMTLR-UEAssistedMTLR-PosStatus-0001 + + + +RUN_TEST_STEP 020 LbsHybridMTLRTestServer LbsStep_StopLbs diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmtlr/src/ctlbshybridmtlrserver.cpp --- a/lbstest/lbstestproduct/lbshybridmtlr/src/ctlbshybridmtlrserver.cpp Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/lbshybridmtlr/src/ctlbshybridmtlrserver.cpp Fri May 14 17:16:36 2010 +0300 @@ -35,6 +35,8 @@ #include "ctlbsmtlrresetassistance.h" #include "ctlbsnetworkinducedmtlr.h" #include "ctlbsoom.h" +#include "ctlbshybridueassistedmtlrposstatus.h" + /** MainL() Description : This is the main function which installs the @@ -220,6 +222,11 @@ { return CT_LbsOom::New(*this); } + else if (aStepName == KLbsHybridUEAssistedMTLRPosStatus) + { + return CT_LbsHybridUEAssistedMTLRPosStatus::New(*this); + } + // Let base class handle any common test steps - will return NULL if test step is not supported. return CT_LbsServer::CreateTestStep(aStepName); } diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/lbshybridmtlr/src/ctlbshybridueassistedmtlrposstatus.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lbstest/lbstestproduct/lbshybridmtlr/src/ctlbshybridueassistedmtlrposstatus.cpp Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,282 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +// LBS includes. +#include +#include +#include + +// LBS test includes. +#include "ctlbshybridueassistedmtlrposstatus.h" +#include +#include "argutils.h" +#include + + + +/** +Static Constructor +*/ +CT_LbsHybridUEAssistedMTLRPosStatus* CT_LbsHybridUEAssistedMTLRPosStatus::New(CT_LbsHybridMTLRServer& aParent) + { + // Note that we do not use ELeave. + // This means that having insufficient memory will return NULL; + CT_LbsHybridUEAssistedMTLRPosStatus* testStep = new CT_LbsHybridUEAssistedMTLRPosStatus(aParent); + if (testStep) + { + TInt err = KErrNone; + + TRAP(err, testStep->ConstructL()); + if (err) + { + delete testStep; + testStep = NULL; + } + } + return testStep; + } + + +/** + * Constructor + */ +CT_LbsHybridUEAssistedMTLRPosStatus::CT_LbsHybridUEAssistedMTLRPosStatus(CT_LbsHybridMTLRServer& aParent) : CT_LbsHybridMTLRStep(aParent) + { + SetTestStepName(KLbsHybridUEAssistedMTLRPosStatus); + iState = EInitializing; + iSessionId.SetSessionOwner(KRequestUid); + iSessionId.SetSessionNum(0x0005); + } + + +void CT_LbsHybridUEAssistedMTLRPosStatus::ConstructL() + { + // Create the base class objects. + CT_LbsHybridMTLRStep::ConstructL(); + iController = CLbsPrivacyController::NewL(*this); + iProxy = CNetProtocolProxy::NewL(); + iLbsPostioningStatus = CLbsPositioningStatus::NewL(*this); + iPosStatusCount = 0; + } + + +/** + * Destructor + */ +CT_LbsHybridUEAssistedMTLRPosStatus::~CT_LbsHybridUEAssistedMTLRPosStatus() + { + delete iLbsPostioningStatus; + delete iController; + delete iProxy; + } + + +TVerdict CT_LbsHybridUEAssistedMTLRPosStatus::doTestStepL() + { + INFO_PRINTF1(_L("CT_LbsHybridUEAssistedMTLRPosStatus::doTestStepL()")); + // Stop the test if the preamble failed + TESTL(TestStepResult() == EPass); + + const TInt KTimeOut = 60*1000*1000; + const TInt KAdviceSystemStatusTimeout = 40*1000*1000; + const TInt KSmallTimeOut = 3*1000*1000; + + // >> AdviceSystemStatus(0) + TESTL(iProxy->WaitForResponse(KAdviceSystemStatusTimeout) == ENetMsgGetCurrentCapabilitiesResponse); + CLbsNetworkProtocolBase::TLbsSystemStatus status; + TInt cleanupCnt; + cleanupCnt = iProxy->GetArgsLC(ENetMsgGetCurrentCapabilitiesResponse, &status); + TESTL(status == CLbsNetworkProtocolBase::ESystemStatusNone); + CleanupStack::PopAndDestroy(cleanupCnt); + + // Initiate MTLR Start + // << ProcessStatusUpdate() + MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask activeServiceMask = MLbsNetworkProtocolObserver::EServiceMobileTerminated; + iProxy->CallL(ENetMsgProcessStatusUpdate, &activeServiceMask); + + // << ProcessPrivacyRequest() + const TBool emergency = ETrue; + TLbsNetPosRequestPrivacy privacy = ArgUtils::Privacy(); + TLbsExternalRequestInfo requestInfo = ArgUtils::RequestInfo(); + iProxy->CallL(ENetMsgProcessPrivacyRequest, &iSessionId, &emergency, &privacy, &requestInfo); + + // >> Callback from RespondNetworkLocationRequest(ERequestAccepted) + CheckForObserverEventTestsL(KTimeOut, *this); + + // Since its emergency request, Position request must be accepted and we should get UI indicator on + CheckForObserverEventTestsL(KTimeOut, *this); + TESTL(iPosStatusCount==1); + TESTL(iPositioningStatus == CLbsPositioningStatus::ELbsPositioningStatusActive); + + // >> Respond Privacy Request + TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRespondPrivacyRequest); + TLbsNetSessionId* getSessionId = NULL; + CLbsNetworkProtocolBase::TLbsPrivacyResponse getPrivacy; + cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondPrivacyRequest, &getSessionId, &getPrivacy); + TESTL(getSessionId->SessionNum()==iSessionId.SessionNum()); + TESTL(getPrivacy==CLbsNetworkProtocolBase::EPrivacyResponseAccepted); + CleanupStack::PopAndDestroy(cleanupCnt);//getSessionId + // Initiate MTLR End + + // MTLR Reference Position Notification Start + // << ProcessLocationUpdate() + TPositionInfo positionInfo = ArgUtils::ReferencePositionInfo(); + iProxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, &positionInfo); + // MTLR Reference Position Notification Stop + + // MTLR Assistance Data Notification Start + // << ProcessAssistanceData() + TLbsAsistanceDataGroup dataRequestMask = EAssistanceDataReferenceTime; + RLbsAssistanceDataBuilderSet assistanceData; + ArgUtils::PopulateLC(assistanceData); + TInt reason = KErrNone; + iProxy->CallL(ENetMsgProcessAssistanceData, &dataRequestMask, &assistanceData, &reason); + CleanupStack::PopAndDestroy(); //assistanceData + // MTLR Assistance Data Notification Stop + + // MTLR Network Location Request Start + // << ProcessLocationRequest() + MLbsNetworkProtocolObserver::TLbsNetProtocolService service = MLbsNetworkProtocolObserver::EServiceMobileTerminated; + TLbsNetPosRequestQuality quality = ArgUtils::QualityAlpha2(); + TLbsNetPosRequestMethod method = ArgUtils::RequestHybridMethod(); + iProxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method); + // MTLR Network Location Request Stop + + //Start the timer + TTime timerStart; + timerStart.HomeTime(); + + // >> Callback from ProcessNetworkPostionUpdate(refPosition) + CheckForObserverEventTestsL(KSmallTimeOut, *this); + + // >> RequestAssistanceData(0) + TESTL(iProxy->WaitForResponse(KSmallTimeOut) == ENetMsgRequestAssistanceData); + TLbsAsistanceDataGroup dataGroup; + cleanupCnt = iProxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataGroup); + TESTL(dataGroup == EAssistanceDataNone); + CleanupStack::PopAndDestroy(cleanupCnt); + + //Find the time elapsed from timer + TTimeIntervalMicroSeconds microseconds; + TTime timerStop; + timerStop.HomeTime(); + microseconds = timerStop.MicroSecondsFrom(timerStart); + TInt64 timeElapsed = microseconds.Int64(); + + // >> RespondLocationRequest() + //Test that we do not get response before alpha2 has expired + TESTL(iProxy->WaitForResponse(KAlpha2Timeout-timeElapsed-KDelta) == ENetMsgTimeoutExpired); + TESTL(iProxy->WaitForResponse(2*KDelta) == ENetMsgRespondLocationRequest); + + getSessionId = NULL; + TInt getReason = KErrNone; + TPositionSatelliteInfo* getPositionInfo = NULL; + cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondLocationRequest, &getSessionId, &getReason, &getPositionInfo); + TESTL(getSessionId->SessionNum() == iSessionId.SessionNum()); + TESTL(getReason==KErrNone); + CleanupStack::PopAndDestroy(cleanupCnt); //getSessionId,getPositionInfo + + //NHR's timer alpha2 times out -> Hybrid Positioning Start + //<< ProcessLocationRequest() + quality = ArgUtils::Quality(); //Set timeout to t + iProxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method); + + // >> RequestAssistanceData(0) + TESTL(iProxy->WaitForResponse(KSmallTimeOut) == ENetMsgRequestAssistanceData); + cleanupCnt = iProxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataGroup); + TESTL(dataGroup == EAssistanceDataNone); + CleanupStack::PopAndDestroy(cleanupCnt); + + // >> RespondLocationRequest() + TESTL(iProxy->WaitForResponse(KTTimeout) == ENetMsgRespondLocationRequest); + getSessionId = NULL; + getReason = KErrNone; + getPositionInfo = NULL; + cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondLocationRequest, &getSessionId, &getReason, &getPositionInfo); + TESTL(getSessionId->SessionNum() == iSessionId.SessionNum()); + TESTL(getReason==KErrNone); + CleanupStack::PopAndDestroy(cleanupCnt);//getSessionId,getPositionInfo + + //<< ProcessNetworkPositionUpdate() | GPS Pos[Accurate Fix] + CheckForObserverEventTestsL(KTimeOut, *this); + TESTL(iState==EGpsLocReceived); + + // MTLR Session Completion Start + // << ProcessSessionComplete() + reason = KErrNone; + iProxy->CallL(ENetMsgProcessSessionComplete, &iSessionId, &reason); + + // << ProcessStatusUpdate() + MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask activeServiceMask2 = MLbsNetworkProtocolObserver::EServiceNone; + iProxy->CallL(ENetMsgProcessStatusUpdate, &activeServiceMask2); + + // >> Callback from ProcessRequestComplete() + CheckForObserverEventTestsL(KTimeOut, *this); + + CheckForObserverEventTestsL(KTimeOut, *this); + TESTL(iPosStatusCount==2); + TESTL(iPositioningStatus == CLbsPositioningStatus::ELbsPositioningStatusNotActive); + + // Verify that the last callback was to ProcessSessionComplete() + TESTL(iState==ERequestComplete); + // MTLR Session Completion Stop + + return TestStepResult(); + } + +void CT_LbsHybridUEAssistedMTLRPosStatus::ProcessNetworkLocationRequest(TUint aRequestId, const TLbsExternalRequestInfo& /*aRequestInfo*/, const TNotificationType& /*aNotificationType*/) + { + INFO_PRINTF1(_L(">>CT_LbsHybridUEAssistedMTLRPosStatus::ProcessNetworkLocationRequest()")); + TEST(iState==EInitializing); + iController->RespondNetworkLocationRequest(aRequestId, CLbsPrivacyController::ERequestAccepted); + iState = EPrivacyCheckOk; + ReturnToTestStep(); + } + +void CT_LbsHybridUEAssistedMTLRPosStatus::ProcessNetworkPositionUpdate(TUint /*aRequestId*/, const TPositionInfo& aPosInfo) + { + if(iState==EPrivacyCheckOk) + { + iState=ERefLocReceived; + INFO_PRINTF1(_L(">>CT_LbsHybridUEAssistedMTLRPosStatus::ProcessNetworkPositionUpdate(RefPosition)")); + } + else if(iState==ERefLocReceived) + { + // Test for $update,1,2,51.5015,-0.105,50,2,3* + TPosition getPos; + aPosInfo.GetPosition(getPos); + if(getPos.Latitude()==51.5015 && getPos.Longitude()==-0.105 && getPos.Altitude()==50 && getPos.HorizontalAccuracy()==2 && getPos.VerticalAccuracy()==3) + { + INFO_PRINTF1(_L(">>CT_LbsHybridUEAssistedMTLRPosStatus::ProcessNetworkPositionUpdate(GpsPosition)")); + iState=EGpsLocReceived; + } + } + ReturnToTestStep(); + } + +void CT_LbsHybridUEAssistedMTLRPosStatus::ProcessRequestComplete(TUint /*aRequestId*/, TInt /*aReason*/) + { + INFO_PRINTF1(_L(">>CT_LbsHybridUEAssistedMTLRPosStatus::ProcessRequestComplete()")); + TEST(iState==EGpsLocReceived); + iState=ERequestComplete; + ReturnToTestStep(); + } + +void CT_LbsHybridUEAssistedMTLRPosStatus::OnPositioningStatusUpdate(const CLbsPositioningStatus::TLbsPositioningStatus& aPositioningStatus) + { + iPosStatusCount++; + iPositioningStatus = aPositioningStatus; + ReturnToTestStep(); + } diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/tdxml/LbsSuite/LbsIntegrationSuite/LbsHybridMolrSuite.xml --- a/lbstest/lbstestproduct/tdxml/LbsSuite/LbsIntegrationSuite/LbsHybridMolrSuite.xml Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/tdxml/LbsSuite/LbsIntegrationSuite/LbsHybridMolrSuite.xml Fri May 14 17:16:36 2010 +0300 @@ -21,6 +21,7 @@ lbshybridmolr_uebased_values lbshybridmolr_uebased_partial lbshybridmolr_error_assistance + hybrid_ueassisted_molr_posstatus LbsHybridMOLRTestServer diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/tdxml/LbsSuite/LbsIntegrationSuite/LbsHybridMolrSuite/hybrid_ueassisted_molr_posstatus.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lbstest/lbstestproduct/tdxml/LbsSuite/LbsIntegrationSuite/LbsHybridMolrSuite/hybrid_ueassisted_molr_posstatus.xml Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,23 @@ + + + + + + hybrid_ueassisted_molr_posstatus + 600 + + + + + LbsHybridMOLRTestServer + + + + lbstest\lbstestproduct\lbshybridmolr\testdata\lbs_molr.ini + c:\testdata\configs\lbs_molr.ini + + + diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/tdxml/LbsSuite/LbsIntegrationSuite/LbsHybridMtlrSuite.xml --- a/lbstest/lbstestproduct/tdxml/LbsSuite/LbsIntegrationSuite/LbsHybridMtlrSuite.xml Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/tdxml/LbsSuite/LbsIntegrationSuite/LbsHybridMtlrSuite.xml Fri May 14 17:16:36 2010 +0300 @@ -4,6 +4,7 @@ LbsHybridMtlrSuite + hybrid_ueassisted_mtlr_posstatus lbshybridmtlr_uebased lbshybridmtlr_ueassisted_gps_ok lbshybridmtlr_ueassisted_no_gps diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/tdxml/LbsSuite/LbsIntegrationSuite/LbsHybridMtlrSuite/hybrid_ueassisted_mtlr_posstatus.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lbstest/lbstestproduct/tdxml/LbsSuite/LbsIntegrationSuite/LbsHybridMtlrSuite/hybrid_ueassisted_mtlr_posstatus.xml Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,23 @@ + + + + + + hybrid_ueassisted_mtlr_posstatus + 600 + + + + + LbsHybridMTLRTestServer + + + + lbstest\lbstestproduct\lbshybridmtlr\testdata\lbs_mtlr.ini + c:\testdata\configs\lbs_mtlr.ini + + + diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/tdxml/LbsSuite/LbsUnitSuite.xml --- a/lbstest/lbstestproduct/tdxml/LbsSuite/LbsUnitSuite.xml Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/tdxml/LbsSuite/LbsUnitSuite.xml Fri May 14 17:16:36 2010 +0300 @@ -45,6 +45,7 @@ tsuplasn1suite te_suplproxypmsuite te_npeintegrationmodulesuite + te_lbspositioningstatussuite diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/tdxml/LbsSuite/LbsUnitSuite/te_lbspositioningstatussuite.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lbstest/lbstestproduct/tdxml/LbsSuite/LbsUnitSuite/te_lbspositioningstatussuite.xml Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,11 @@ + + + te_lbspositioningstatussuite + + te_lbspositioningstatustest + + + te_lbspositioningstatussuite + + + diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/tdxml/LbsSuite/LbsUnitSuite/te_lbspositioningstatussuite/te_lbspositioningstatustest.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lbstest/lbstestproduct/tdxml/LbsSuite/LbsUnitSuite/te_lbspositioningstatussuite/te_lbspositioningstatustest.xml Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,16 @@ + + + + + te_lbspositioningstatustest + 300 + + + + + te_lbspositioningstatussuite + + diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/tdxml/LbsSuite/LbsUnitSuite/te_lbspositioningstatussuite/testexecuteservers/te_lbspositioningstatussuite.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lbstest/lbstestproduct/tdxml/LbsSuite/LbsUnitSuite/te_lbspositioningstatussuite/testexecuteservers/te_lbspositioningstatussuite.xml Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,6 @@ + + + te_lbspositioningstatussuite + te_lbspositioningstatus.mmp + locationmgmt\locationcore\lbspositioningstatus\test\te_lbspositioningstatus\group\bld.inf + diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/ut/lbsgpsdatasourcemodules/lbslocbtgpspsy/te_lbsbtgpspsy/group/bld.inf --- a/lbstest/lbstestproduct/ut/lbsgpsdatasourcemodules/lbslocbtgpspsy/te_lbsbtgpspsy/group/bld.inf Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/ut/lbsgpsdatasourcemodules/lbslocbtgpspsy/te_lbsbtgpspsy/group/bld.inf Fri May 14 17:16:36 2010 +0300 @@ -27,7 +27,10 @@ ../testdata/te_lbsbtgpspsy.ini c:/testdata/configs/te_lbsbtgpspsy.ini -../testdata/featuredatabase.xml /epoc32/rom/include/featuredatabase.xml + +//comment out: default featuredatabase.xml file does want we want..i.e includes the by psy. +//../testdata/featuredatabase.xml /epoc32/rom/include/featuredatabase.xml + ./te_lbsbtgpspsy.iby /epoc32/rom/include/te_lbsbtgpspsy.iby diff -r 2965a06983dc -r aadfb18aaac1 lbstest/lbstestproduct/ut/lbsgpsdatasourcemodules/lbslocbtgpspsy/te_lbsbtgpspsy/testdata/featuredatabase.xml --- a/lbstest/lbstestproduct/ut/lbsgpsdatasourcemodules/lbslocbtgpspsy/te_lbsbtgpspsy/testdata/featuredatabase.xml Mon May 03 13:50:32 2010 +0300 +++ b/lbstest/lbstestproduct/ut/lbsgpsdatasourcemodules/lbslocbtgpspsy/te_lbsbtgpspsy/testdata/featuredatabase.xml Fri May 14 17:16:36 2010 +0300 @@ -46,19 +46,19 @@ - + - + - + - + - + @@ -76,32 +76,32 @@ - + - + - + - + - + - + - + @@ -110,7 +110,7 @@ - + @@ -125,16 +125,16 @@ - + - + - + - + diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/LbsInternalApi/BWINS/LbsInternalApiU.DEF --- a/locationmgmt/locationcore/LbsInternalApi/BWINS/LbsInternalApiU.DEF Mon May 03 13:50:32 2010 +0300 +++ b/locationmgmt/locationcore/LbsInternalApi/BWINS/LbsInternalApiU.DEF Fri May 14 17:16:36 2010 +0300 @@ -98,4 +98,6 @@ ?ShutDownL@RLbsSystemModuleEvent@@SAXXZ @ 97 NONAME ; void RLbsSystemModuleEvent::ShutDownL(void) ?OpenL@RLbsPositionUpdateRequests@@QAEXABUTChannelIdentifer@1@@Z @ 98 NONAME ; void RLbsPositionUpdateRequests::OpenL(struct RLbsPositionUpdateRequests::TChannelIdentifer const &) ??0TLbsPositionUpdateRequestStatus@@QAE@XZ @ 99 NONAME ; TLbsPositionUpdateRequestStatus::TLbsPositionUpdateRequestStatus(void) + ?InitializeMoPropertyL@LbsPositioningStatusProps@@SAXXZ @ 100 NONAME ; void LbsPositioningStatusProps::InitializeMoPropertyL(void) + ?InitializeNiPropertyL@LbsPositioningStatusProps@@SAXXZ @ 101 NONAME ; void LbsPositioningStatusProps::InitializeNiPropertyL(void) diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/LbsInternalApi/EABI/LbsInternalApiU.DEF --- a/locationmgmt/locationcore/LbsInternalApi/EABI/LbsInternalApiU.DEF Mon May 03 13:50:32 2010 +0300 +++ b/locationmgmt/locationcore/LbsInternalApi/EABI/LbsInternalApiU.DEF Fri May 14 17:16:36 2010 +0300 @@ -110,4 +110,6 @@ _ZNK25TLbsPositionUpdateRequest9NewClientEv @ 109 NONAME _ZNK26RLbsPositionUpdateRequests24GetPositionUpdateRequestER29TLbsPositionUpdateRequestBase @ 110 NONAME _ZNK31TLbsPositionUpdateRequestStatus8TrackingEv @ 111 NONAME + _ZN25LbsPositioningStatusProps21InitializeMoPropertyLEv @ 112 NONAME + _ZN25LbsPositioningStatusProps21InitializeNiPropertyLEv @ 113 NONAME diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/LbsInternalApi/group/LbsInternalApi.mmp --- a/locationmgmt/locationcore/LbsInternalApi/group/LbsInternalApi.mmp Mon May 03 13:50:32 2010 +0300 +++ b/locationmgmt/locationcore/LbsInternalApi/group/LbsInternalApi.mmp Fri May 14 17:16:36 2010 +0300 @@ -32,6 +32,7 @@ SOURCE lbsqualityprofile.cpp SOURCE LbsGpsMeasurementUpdates.cpp SOURCE lbssuplpushprops.cpp +SOURCE lbspositioningstatusprops.cpp USERINCLUDE ../inc //Todo - remove. USERINCLUDE ../../lbsrootapi/inc diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/LbsInternalApi/inc/lbspositioningstatusprops.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsInternalApi/inc/lbspositioningstatusprops.h Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,56 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// lbspositioningstatusprops.h +// A class for the defining of the Lbs Positioning Status Publish and Subscribe properties +// +// + +/** + @file + @internalTechnology + @released +*/ + +#ifndef POSITIONING_STATUS_PROPS_H +#define POSITIONING_STATUS_PROPS_H + + +#include +#include "lbspropertykeydefs.h" + + +/** The key for the NI Positioning Status property*/ +const TUint KLbsNiPositioningStatusKey = KLbsPositioningStatusAPIBase; +/** The key for the MO Positioning Status property*/ +const TUint KLbsMoPositioningStatusKey = KLbsNiPositioningStatusKey+1; + + +/** +The LbsPositioningStatusProps class provides the InitializeL function that allows the process-owner of +the LBS Positioning Status API RProperties to define them. + +@internalTechnology +@released + +@see CLbsPositioningStatus +*/ +NONSHARABLE_CLASS(LbsPositioningStatusProps) + { +public: + IMPORT_C static void InitializeNiPropertyL(); + IMPORT_C static void InitializeMoPropertyL(); + }; + +#endif //POSITIONING_STATUS_PROPS_H + diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/LbsInternalApi/src/lbspositioningstatusprops.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/LbsInternalApi/src/lbspositioningstatusprops.cpp Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,95 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// lbspositioningstatusprops.cpp +// A class for the defining the Lbs Positioning Status Publish and Subscribe properties +// +// + +#include +#include +#include +#include "lbsdevloggermacros.h" + +#include "lbspositioningstatusprops.h" +#include "lbsrootcenrepdefs.h" + + +/** +Defines the property used by the Positioning Status API implementation for +receiving updates regarding MT-LR positioning sessions in progress + +Note that this may be created by a different process to the MO property +due to different processes being persistant in different LBS configurations. + +This key is created by LbsRoot. + +@leave If a error happens, it leaves with the correspondent error code. +*/ +EXPORT_C void LbsPositioningStatusProps::InitializeNiPropertyL() + { + LBSLOG(ELogP1, "LbsPositioningStatusProps::InitializeNiPropertyL() Begin\n"); + LBSLOG(ELogP9, "->S LbsPositioningStatusProps::InitializeNiPropertyL() InitializeNiPropertyL \n"); + const TSecurityPolicy KPositioningStatusPolicy(ECapabilityReadDeviceData, ECapabilityLocation); + + // Define the NI Positioning Status property + TInt err = RProperty::Define(KLbsNiPositioningStatusKey, RProperty::EInt, KPositioningStatusPolicy, KPositioningStatusPolicy); + if (err != KErrNone && err != KErrAlreadyExists) + { + User::Leave(err); + } + if (err != KErrAlreadyExists) + { + // store the Uid of the process that defined the property + CRepository* rep = CRepository::NewLC(KLbsCenRepUid); + User::LeaveIfError(rep->Set(KNiPositioningStatusAPIKey, TInt(RProcess().SecureId()))); + CleanupStack::PopAndDestroy(rep); + } + + LBSLOG(ELogP1, "LbsPositioningStatusProps::InitializeNiPropertyL() End\n"); + } + +/** +Defines the property used by the Positioning Status API implementation for +receiving updates regarding MO-LR positioning sessions in progress + +Note that this may be created by a different process to the MO property +due to different processes being persistant in different LBS configurations. + +This key is created by the Location Server by default. + +@leave If a error happens, it leaves with the correspondent error code. +*/ +EXPORT_C void LbsPositioningStatusProps::InitializeMoPropertyL() + { + LBSLOG(ELogP1, "LbsPositioningStatusProps::InitializeMoPropertyL() Begin\n"); + LBSLOG(ELogP9, "->S LbsPositioningStatusProps::InitializeMoPropertyL() InitializeMoPropertyL \n"); + const TSecurityPolicy KPositioningStatusPolicy(ECapabilityReadDeviceData, ECapabilityLocation); + + // Define the NI Positioning Status property + TInt err = RProperty::Define(KLbsMoPositioningStatusKey, RProperty::EInt, KPositioningStatusPolicy, KPositioningStatusPolicy); + if (err != KErrNone && err != KErrAlreadyExists) + { + User::Leave(err); + } + if (err != KErrAlreadyExists) + { + // store the Uid of the process that defined the property + CRepository* rep = CRepository::NewLC(KLbsCenRepUid); + User::LeaveIfError(rep->Set(KMoPositioningStatusAPIKey, TInt(RProcess().SecureId()))); + CleanupStack::PopAndDestroy(rep); + } + + LBSLOG(ELogP1, "LbsPositioningStatusProps::InitializeMoPropertyL() End\n"); + } + diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/group/bld.inf --- a/locationmgmt/locationcore/group/bld.inf Mon May 03 13:50:32 2010 +0300 +++ b/locationmgmt/locationcore/group/bld.inf Fri May 14 17:16:36 2010 +0300 @@ -44,6 +44,8 @@ #include "../../locmonitor/lbslocmonitorclient/group/bld.inf" #include "../LbsRefLocDataSource/group/bld.inf" +#include "../lbspositioningstatus/group/bld.inf" + // Test code #include "../test/group/bld.inf" diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/group/lbs_admin.mrp --- a/locationmgmt/locationcore/group/lbs_admin.mrp Mon May 03 13:50:32 2010 +0300 +++ b/locationmgmt/locationcore/group/lbs_admin.mrp Fri May 14 17:16:36 2010 +0300 @@ -36,6 +36,7 @@ source \sf\os\lbs\locationmgmt\locationcore\lbslocsettings source \sf\os\lbs\locationmgmt\locationcore\lbsmlfwutilities source \sf\os\lbs\locationmgmt\locationcore\lbslocindicatorlib +source \sf\os\lbs\locationmgmt\locationcore\lbspositioningstatus binary \sf\os\lbs\locationmgmt\locationcore\group all @@ -61,3 +62,4 @@ ipr T \sf\os\lbs\locationmgmt\locationcore\test ipr T \sf\os\lbs\locationmgmt\locationcore\lbslocindicatorlib\test ipr T \sf\os\lbs\locationmgmt\locationcore\LbsPartnerCommon\test +ipr T \sf\os\lbs\locationmgmt\locationcore\lbspositioningstatus\test diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/group/lbsadmin.iby --- a/locationmgmt/locationcore/group/lbsadmin.iby Mon May 03 13:50:32 2010 +0300 +++ b/locationmgmt/locationcore/group/lbsadmin.iby Fri May 14 17:16:36 2010 +0300 @@ -28,6 +28,7 @@ #include "lbsinternalapi.iby" #include "lbsnetprotocol.iby" #include "lbspartnercommon.iby" +#include "lbspositioningstatus.iby" #include "lbsnetinternalapi.iby" #include "lbsadatacache.iby" diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/bwins/lbspositioningstatusu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/bwins/lbspositioningstatusu.def Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,7 @@ +EXPORTS + ?CurrentPositioningStatus@CLbsPositioningStatusImpl@@QAEKXZ @ 1 NONAME ; unsigned long CLbsPositioningStatusImpl::CurrentPositioningStatus(void) + ?NewL@CLbsPositioningStatusImpl@@SAPAV1@AAVMLbsPositioningStatusObserver@@@Z @ 2 NONAME ; class CLbsPositioningStatusImpl * CLbsPositioningStatusImpl::NewL(class MLbsPositioningStatusObserver &) + ?NewL@CLbsPositioningStatus@@SAPAV1@AAVMLbsPositioningStatusObserver@@@Z @ 3 NONAME ; class CLbsPositioningStatus * CLbsPositioningStatus::NewL(class MLbsPositioningStatusObserver &) + ?CurrentPositioningStatus@CLbsPositioningStatus@@QAEKXZ @ 4 NONAME ; unsigned long CLbsPositioningStatus::CurrentPositioningStatus(void) + ?Version@MLbsPositioningStatusObserver@@UBE?AVTVersion@@XZ @ 5 NONAME ; class TVersion MLbsPositioningStatusObserver::Version(void) const + diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/eabi/lbspositioningstatusu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/eabi/lbspositioningstatusu.def Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,11 @@ +EXPORTS + _ZN21CLbsPositioningStatus24CurrentPositioningStatusEv @ 1 NONAME + _ZN21CLbsPositioningStatus4NewLER29MLbsPositioningStatusObserver @ 2 NONAME + _ZN25CLbsPositioningStatusImpl24CurrentPositioningStatusEv @ 3 NONAME + _ZN25CLbsPositioningStatusImpl4NewLER29MLbsPositioningStatusObserver @ 4 NONAME + _ZNK29MLbsPositioningStatusObserver7VersionEv @ 5 NONAME + _ZTI28CLbsInternalPosStatusWatcher @ 6 NONAME + _ZTI29MLbsPositioningStatusObserver @ 7 NONAME + _ZTV28CLbsInternalPosStatusWatcher @ 8 NONAME + _ZTV29MLbsPositioningStatusObserver @ 9 NONAME + diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/group/bld.inf Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,26 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// bld.inf file for the Lbs Positioning Status component +// +// + +PRJ_EXPORTS +../inc/lbspositioningstatus.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(lbs/lbspositioningstatus.h) +lbspositioningstatus.iby /epoc32/rom/include/lbspositioningstatus.iby + +PRJ_MMPFILES +lbspositioningstatus.mmp + +#include "../test/te_lbspositioningstatus/group/bld.inf" + diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/group/lbspositioningstatus.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/group/lbspositioningstatus.iby Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,25 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __LBS_POSITIONING_STATUS_IBY__ +#define __LBS_POSITIONING_STATUS_IBY__ + +#if !defined(SYMBIAN_EXCLUDE_LOCATION) + +file=ABI_DIR\DEBUG_DIR\lbspositioningstatus.dll System\libs\lbspositioningstatus.dll + +#endif // SYMBIAN_EXCLUDE_LOCATION + +#endif // __LBS_POSITIONING_STATUS_IBY__ diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/group/lbspositioningstatus.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/group/lbspositioningstatus.mmp Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,40 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET lbspositioningstatus.dll +TARGETTYPE dll +UID 0x1000008d 0x1028720E +CAPABILITY ALL -Tcb +MACRO ENABLE_LBS_DEV_LOGGER + +USERINCLUDE ../inc +USERINCLUDE ../../lbsrootapi/inc +USERINCLUDE ../../LbsInternalApi/inc +USERINCLUDE ../../lbsroot/inc +USERINCLUDE ../../LbsPartnerCommon/inc + +// system include paths +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../src +SOURCE lbspositioningstatus.cpp +SOURCE lbspositioningstatusimpl.cpp +SOURCE lbsinternalposstatuswatcher.cpp + + +LIBRARY euser.lib centralrepository.lib lbspartnercommon.lib + + +SMPSAFE diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/inc/lbsinternalposstatuswatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/inc/lbsinternalposstatuswatcher.h Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,90 @@ +/** +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +/** + @file cmopositioningstatuswatcher.h + @internalTechnology +*/ +#ifndef MO_POSITIONING_STATUS_LISTENER_H_ +#define MO_POSITIONING_STATUS_LISTENER_H_ + +#include +#include + +/** A type for the internal positioning status updates */ +typedef TUint32 TLbsPositioningStatusType; + +/** The response to a privacy request. + +Note that the _TLbsPositioningStatusType enum may be extended in the future +by adding more enumerated values. To maintain compatibility any unrecognized +values must be handled as ELbsPositioningStatusUnknown. +*/ +enum _TLbsPositioningStatusType + { + /** Not used/unknown */ + ELbsPositioningStatusUnknown = 0, + /** Used to indicate Mobile Originated positioning status. */ + ELbsPositioningStatusMO = 1, + /** Used to indicate Network Initiated positioning status. */ + ELbsPositioningStatusNI = 2 + }; + + +class MLbsInternalPosStatusObserver + { +public: + + /** Send Positioning Status to the Observer. + Called whenever a change to the devices positioning status occurs. + @param aType The positioning status type being reported + @param aStatus The current positioning status + */ + virtual void OnInternalStatusUpdate(const TLbsPositioningStatusType& aType, const TInt& aStatus) = 0; + }; + + +class CLbsInternalPosStatusWatcher : public CActive + { +public: + static CLbsInternalPosStatusWatcher* NewL(const TLbsPositioningStatusType& aType, MLbsInternalPosStatusObserver& aObserver); + ~CLbsInternalPosStatusWatcher(); + +private: + // Constructors + void ConstructL(); + CLbsInternalPosStatusWatcher(const TLbsPositioningStatusType& aType, MLbsInternalPosStatusObserver& aObserver); + + // CActive + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + +private: + // Observer + MLbsInternalPosStatusObserver& iObserver; + + // the positioning status type watched. + TLbsPositioningStatusType iType; + + // handle to the P&S property being watched + RProperty iProperty; + }; + + +#endif // MO_POSITIONING_STATUS_LISTENER_H_ diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/inc/lbspositioningstatus.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/inc/lbspositioningstatus.h Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,90 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file + @publishedPartner + */ + +#ifndef POSITIONING_STATUS_H +#define POSITIONING_STATUS_H + +#include + +class CLbsPositioningStatusImpl; +class MLbsPositioningStatusObserver; + +/** +Positioning Status Library's API. + +This class provides an API by which an observer can register for notifications +regarding the current status of LBS, i.e. if one or more positioning sessions +are currently in progress or otherwise. + +@see MLbsPositioningStatusObserver +@capability Location +*/ +NONSHARABLE_CLASS(CLbsPositioningStatus) : public CBase + { +public: + /** Positioning Status define */ + typedef TUint32 TLbsPositioningStatus; + + /** Positioning Status enumeration + * Note that this enumeration may be extended by future updates */ + enum _TLbsPositioningStatus + { + ELbsPositioningStatusNotActive = 0, + ELbsPositioningStatusActive = 1 + }; + +public: + IMPORT_C static CLbsPositioningStatus* NewL(MLbsPositioningStatusObserver& aObserver); + virtual ~CLbsPositioningStatus(); + +public: + /** Returns the current positioning status */ + IMPORT_C TLbsPositioningStatus CurrentPositioningStatus(); + +private: + CLbsPositioningStatus(); + void ConstructL(MLbsPositioningStatusObserver& aObserver); + +private: + /** Handle to the internal implementation */ + CLbsPositioningStatusImpl* iImpl; + }; + + +/** Positioning Status observer definition. +This interface is implemented by observers to handle calls from +the Positioning Status manager. + +@see CLbsPositioningStatus +*/ +class MLbsPositioningStatusObserver + { +public: + IMPORT_C virtual TVersion Version() const; + + /** Send Positioning Status to the Observer. + Called whenever a change to the devices positioning status occurs. + @param aPositioningStatus The current positioning status + */ + virtual void OnPositioningStatusUpdate(const CLbsPositioningStatus::TLbsPositioningStatus& aPositioningStatus) = 0; + }; + + +#endif // POSITIONING_STATUS_H diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/inc/lbspositioningstatusimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/inc/lbspositioningstatusimpl.h Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,77 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file + @internalTechnology +*/ + +#ifndef POSITIONING_STATUS_IMPL_H +#define POSITIONING_STATUS_IMPL_H + +#include +#include "lbspositioningstatus.h" +#include "lbsinternalposstatuswatcher.h" + +/** +The class provides an internal implementation of the functionality exposed +by the CLbsPositioningStatus interface. + +@see CLbsPositioningStatus +@see MLbsInternalPosStatusObserver + +@internalComponent +@prototype +*/ +NONSHARABLE_CLASS(CLbsPositioningStatusImpl) : public CBase, + public MLbsInternalPosStatusObserver + { +public: + IMPORT_C static CLbsPositioningStatusImpl* NewL(MLbsPositioningStatusObserver& aObserver); + virtual ~CLbsPositioningStatusImpl(); + +public: + /** Returns the current positioning status */ + IMPORT_C CLbsPositioningStatus::TLbsPositioningStatus CurrentPositioningStatus(); + +private: + CLbsPositioningStatusImpl(MLbsPositioningStatusObserver& aObserver); + void ConstructL(); + + /** from MLbsInternalPosStatusObserver */ + void OnInternalStatusUpdate(const TLbsPositioningStatusType& aType, const TInt& aCount); + + /** Returns the combined MO/NI positioning status */ + CLbsPositioningStatus::TLbsPositioningStatus CombinedStatus(); + +private: + /** Prohibit copy constructor */ + CLbsPositioningStatusImpl(const CLbsPositioningStatusImpl&); + /** Prohibit assigment operator */ + CLbsPositioningStatusImpl& operator= (const CLbsPositioningStatusImpl&); + +private: + /** Consumer for positioning status updates, SysApp */ + MLbsPositioningStatusObserver& iObserver; + + TUint iLastKnownMoStatus; + TUint iLastKnownNiStatus; + + /** P&S API Watchers */ + CLbsInternalPosStatusWatcher* iMoWatcher; + CLbsInternalPosStatusWatcher* iNiWatcher; + }; + +#endif // POSITIONING_STATUS_IMPL_H diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/src/lbsinternalposstatuswatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/src/lbsinternalposstatuswatcher.cpp Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,118 @@ +/** +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include + +#include "lbsrootcenrepdefs.h" +#include "lbsinternalposstatuswatcher.h" +#include "lbspositioningstatusprops.h" + + + +CLbsInternalPosStatusWatcher* CLbsInternalPosStatusWatcher::NewL(const TLbsPositioningStatusType& aType, MLbsInternalPosStatusObserver& aObserver) + { + CLbsInternalPosStatusWatcher* me=new(ELeave) CLbsInternalPosStatusWatcher(aType, aObserver); + CleanupStack::PushL(me); + me->ConstructL(); + CleanupStack::Pop(me); + return me; + } + +CLbsInternalPosStatusWatcher::~CLbsInternalPosStatusWatcher() + { + Cancel(); + iProperty.Close(); + } + +CLbsInternalPosStatusWatcher::CLbsInternalPosStatusWatcher(const TLbsPositioningStatusType& aType, MLbsInternalPosStatusObserver& aObserver) + : CActive(EPriorityStandard), iObserver(aObserver), iType(aType) + { + } + +/** +The 2nd phase constructor. Attaches to the property, completes the async +request to cause the RunL method to be called for the first time and check +if there has already been an update to the property. + +@leave If a error happens, it leaves with one of the system error codes. +*/ +void CLbsInternalPosStatusWatcher::ConstructL() + { + // Get the CategoryUid from the cenrep file owned by LbsRoot. + TInt category; + CRepository* rep = CRepository::NewLC(KLbsCenRepUid); + + // attach to the property + if (iType == ELbsPositioningStatusMO) + { + // Mobile Originated Status P&S Property + User::LeaveIfError(rep->Get(KMoPositioningStatusAPIKey, category)); + TSecureId propOwnerSecureId(category); + User::LeaveIfError(iProperty.Attach(propOwnerSecureId, KLbsMoPositioningStatusKey, EOwnerThread)); + } + else if (iType == ELbsPositioningStatusNI) + { + // Network Initiated Status P&S Property + User::LeaveIfError(rep->Get(KNiPositioningStatusAPIKey, category)); + TSecureId propOwnerSecureId(category); + User::LeaveIfError(iProperty.Attach(propOwnerSecureId, KLbsNiPositioningStatusKey, EOwnerThread)); + } + else + { + // Any other value indicates a programming error + User::Leave(KErrArgument); + } + + CleanupStack::PopAndDestroy(rep); + + CActiveScheduler::Add(this); + // initial subscription and process current property value + RunL(); + } + +void CLbsInternalPosStatusWatcher::RunL() + { + // resubscribe before processing new value to prevent missing updates + iProperty.Subscribe(iStatus); + SetActive(); + + TInt newStatus; + // property updated, get new value + if (iProperty.Get(newStatus)==KErrNotFound) + { + // property deleted, there's no sessions of this type! + iObserver.OnInternalStatusUpdate(iType, 0); + } + else + { + // inform the positioning status observer + iObserver.OnInternalStatusUpdate(iType, newStatus); + } + } + +void CLbsInternalPosStatusWatcher::DoCancel() + { + iProperty.Cancel(); + } + +TInt CLbsInternalPosStatusWatcher::RunError(TInt aError) + { + // TODO: Handle RunL leaving... + return aError; + } + diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/src/lbspositioningstatus.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/src/lbspositioningstatus.cpp Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,80 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "lbspositioningstatus.h" +#include "lbspositioningstatusimpl.h" +#include "lbsdevloggermacros.h" + + + +//============================================================================= +// MLbsPositioningStatusObserver +//============================================================================= +/** +Provides the version of the observer interface. This can be used by the library +to determine the functionality supported by the client application. + +@return Version of the observer interface. +*/ +EXPORT_C TVersion MLbsPositioningStatusObserver::Version() const + { + LBSLOG(ELogP1, "MLbsPositioningStatusObserver::Version() Begin\n"); + LBSLOG(ELogP1, "MLbsPositioningStatusObserver::Version() End\n"); + return TVersion(1, 0, 0); + } + +EXPORT_C CLbsPositioningStatus* CLbsPositioningStatus::NewL(MLbsPositioningStatusObserver& aObserver) + { + LBSLOG(ELogP1, "CLbsPositioningStatus::NewL() Begin\n"); + LBSLOG(ELogP8, "->S CLbsPositioningStatus::NewL() CLbsPositioningStatus\n"); + CLbsPositioningStatus* me = new (ELeave) CLbsPositioningStatus(); + CleanupStack::PushL(me); + me->ConstructL(aObserver); + LBSLOG(ELogP1, "CLbsPositioningStatus::NewL() End\n"); + CleanupStack::Pop(me); + return me; + } + +CLbsPositioningStatus::~CLbsPositioningStatus() + { + LBSLOG(ELogP1, "CLbsPositioningStatus::~CLbsPositioningStatus() Begin\n"); + LBSLOG(ELogP8, "->S CLbsPositioningStatus::~CLbsPositioningStatus() CLbsPositioningStatus\n"); + delete iImpl; + iImpl = NULL; + LBSLOG(ELogP1, "CLbsPositioningStatus::~CLbsPositioningStatus() End\n"); + } + +CLbsPositioningStatus::CLbsPositioningStatus() + { + LBSLOG(ELogP1, "CLbsPositioningStatus::CLbsPositioningStatus() Begin\n"); + LBSLOG(ELogP1, "CLbsPositioningStatus::CLbsPositioningStatus() End\n"); + } + +void CLbsPositioningStatus::ConstructL(MLbsPositioningStatusObserver& aObserver) + { + LBSLOG(ELogP1, "CLbsPositioningStatus::ConstructL() Begin\n"); + iImpl = CLbsPositioningStatusImpl::NewL(aObserver); + LBSLOG(ELogP1, "CLbsPositioningStatus::ConstructL() End\n"); + } + + +EXPORT_C CLbsPositioningStatus::TLbsPositioningStatus CLbsPositioningStatus::CurrentPositioningStatus() + { + LBSLOG(ELogP1, "CLbsPositioningStatus::CurrentPositioningStatus() Begin\n"); + LBSLOG(ELogP1, "CLbsPositioningStatus::CurrentPositioningStatus() Begin\n"); + return iImpl->CurrentPositioningStatus(); + } + + diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/src/lbspositioningstatusimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/src/lbspositioningstatusimpl.cpp Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,108 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "lbspositioningstatusimpl.h" +#include "lbsdevloggermacros.h" + +EXPORT_C CLbsPositioningStatusImpl* CLbsPositioningStatusImpl::NewL(MLbsPositioningStatusObserver& aObserver) + { + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::NewL() Begin\n"); + LBSLOG(ELogP8, "->S CLbsPositioningStatusImpl::NewL() CLbsPositioningStatusImpl\n"); + CLbsPositioningStatusImpl* me = new (ELeave) CLbsPositioningStatusImpl(aObserver); + CleanupStack::PushL(me); + me->ConstructL(); + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::NewL() End\n"); + CleanupStack::Pop(me); + return me; + } + +CLbsPositioningStatusImpl::~CLbsPositioningStatusImpl() + { + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::~CLbsPositioningStatusImpl() Begin\n"); + LBSLOG(ELogP8, "->S CLbsPositioningStatusImpl::~CLbsPositioningStatusImpl() CLbsPositioningStatus\n"); + delete iMoWatcher; + delete iNiWatcher; + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::~CLbsPositioningStatusImpl() End\n"); + } + +CLbsPositioningStatusImpl::CLbsPositioningStatusImpl(MLbsPositioningStatusObserver& aObserver) + : iObserver(aObserver) + { + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::CLbsPositioningStatusImpl() Begin\n"); + iLastKnownMoStatus = CLbsPositioningStatus::ELbsPositioningStatusNotActive; + iLastKnownNiStatus = CLbsPositioningStatus::ELbsPositioningStatusNotActive; + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::CLbsPositioningStatusImpl() End\n"); + } + +void CLbsPositioningStatusImpl::ConstructL() + { + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::ConstructL() Begin\n"); + iMoWatcher = CLbsInternalPosStatusWatcher::NewL(ELbsPositioningStatusMO, *this); + iNiWatcher = CLbsInternalPosStatusWatcher::NewL(ELbsPositioningStatusNI, *this); + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::ConstructL() End\n"); + } + + +EXPORT_C CLbsPositioningStatus::TLbsPositioningStatus CLbsPositioningStatusImpl::CurrentPositioningStatus() + { + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::CurrentPositioningStatus() Begin\n"); + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::CurrentPositioningStatus() End\n"); + return CombinedStatus(); + } + +/** from MLbsInternalPosStatusObserver + * + * @param aType mobile or network originated positioning status + * @param aCount count current service requests of the type being reported + * */ +void CLbsPositioningStatusImpl::OnInternalStatusUpdate(const TLbsPositioningStatusType& aType, const TInt& aCount) + { + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::OnInternalStatusUpdate() Begin\n"); + CLbsPositioningStatus::TLbsPositioningStatus previous = CombinedStatus(); + + // update the appropriate status + if (aType==ELbsPositioningStatusMO) + { + iLastKnownMoStatus = aCount; + } + else + { + iLastKnownNiStatus = aCount; + } + + // update the observer if the combined status has changed. + if (previous != CombinedStatus()) + { + iObserver.OnPositioningStatusUpdate(CombinedStatus()); + } + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::OnInternalStatusUpdate() End\n"); + } + + +CLbsPositioningStatus::TLbsPositioningStatus CLbsPositioningStatusImpl::CombinedStatus() + { + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::CombinedStatus() Begin\n"); + if (iLastKnownMoStatus + iLastKnownNiStatus != 0) + { + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::CombinedStatus() Active End\n"); + return CLbsPositioningStatus::ELbsPositioningStatusActive; + } + else + { + LBSLOG(ELogP1, "CLbsPositioningStatusImpl::CombinedStatus() NOT Active End\n"); + return CLbsPositioningStatus::ELbsPositioningStatusNotActive; + } + } + diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/group/bld.inf Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,20 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRJ_TESTEXPORTS +../scripts/te_lbspositioningstatus.script c:/testdata/scripts/te_lbspositioningstatus.script + +PRJ_TESTMMPFILES +te_lbspositioningstatus.mmp diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/group/te_lbspositioningstatus.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/group/te_lbspositioningstatus.mmp Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,47 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + +TARGET te_lbspositioningstatusserver.exe +TARGETTYPE exe +UID 0x1000007A 0x102869EE +CAPABILITY ALL -TCB + +//Please add any change under here +SOURCEPATH ../src +SOURCE te_lbspositioningstatusserver.cpp +SOURCE te_lbspositioningstatusstep.cpp +SOURCE te_lbsstatustestmanager.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../inc +USERINCLUDE ../../../../lbsroot/inc +USERINCLUDE ../../../../lbsrootapi/inc +USERINCLUDE ../../../../LbsInternalApi/inc + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY lbspositioningstatus.lib +LIBRARY bafl.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY centralrepository.lib +LIBRARY lbsinternalapi.lib + +LIBRARY testexecuteutils.lib +LIBRARY testexecutelogclient.lib + + +SMPSAFE diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/inc/te_lbspositioningstatusserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/inc/te_lbspositioningstatusserver.h Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,41 @@ +/** +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +/** + @file te_lbspositioningstatusserver.h +*/ + +#ifndef TE_LBSPOSITIONINGSTATUSSERVER_H +#define TE_LBSPOSITIONINGSTATUSSERVER_H + +#include + + +class CTe_LbsPositioningStatusServer : public CTestServer + { +public: + static CTe_LbsPositioningStatusServer* NewL(); + // Base class pure virtual override + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + +// Please Add/modify your class members +private: + }; + +#endif // TE_LBSPOSITIONINGSTATUSSERVER_H diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/inc/te_lbspositioningstatusstep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/inc/te_lbspositioningstatusstep.h Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,46 @@ +/** +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +/** + @file te_lbspositioningstatusstepbase.h +*/ + +#ifndef TE_LBSPOSITIONINGSTATUSSTEPBASE_H +#define TE_LBSPOSITIONINGSTATUSSTEPBASE_H + +#include + +_LIT(KStatusStep,"StatusStep"); + +class CTe_LbsStatusTestManager; + +class CTe_LbsPositioningStatusStep : public CTestStep + { +public: + virtual ~CTe_LbsPositioningStatusStep(); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepPostambleL(); + virtual TVerdict doTestStepL(); + + CTe_LbsPositioningStatusStep(); + +protected: + CTe_LbsStatusTestManager* iTestManager; + CActiveScheduler* iSched; + }; + +#endif // TE_LBSPOSITIONINGSTATUSSTEPBASE_H diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/inc/te_lbsstatustestmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/inc/te_lbsstatustestmanager.h Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,77 @@ +/** +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +/** + @file te_lbsstatusstep.h +*/ + +#ifndef TE_LBSSTATUSSTEP_H +#define TE_LBSSTATUSSTEP_H + +#include +#include + +class CTe_LbsPositioningStatusStep; +class CLbsPositioningStatus; + +class CTe_LbsStatusTestManager : public CActive, public MLbsPositioningStatusObserver + { +private: + enum TTestStep + { + EStepInitial, + EStepFirstRequest, + EStepSecondRequest, + EStepThirdRequest, + EStepFourthRequest, + EStepFifthRequest, + EStepStop + }; +public: + static CTe_LbsStatusTestManager* NewL(CTe_LbsPositioningStatusStep& aTest); + ~CTe_LbsStatusTestManager(); + + void StartTest(); + +private: // from MLbsPositioningStatusObserver + void OnPositioningStatusUpdate(const CLbsPositioningStatus::TLbsPositioningStatus& aPositioningStatus); + +private: + CTe_LbsStatusTestManager(CTe_LbsPositioningStatusStep& aTest); + void ConstructL(); + void RunL(); + TInt RunError(TInt aError); + void DoCancel(); + void CompleteSelf(); + +private: + CTe_LbsPositioningStatusStep& iTest; + TTestStep iStep; + + CLbsPositioningStatus* iPositioningStatus; + RTimer iTimer; + TUid iMoPosStatusCategory; + TUid iNiPosStatusCategory; + + TBool iPosStatusUpdateReceived; + CLbsPositioningStatus::TLbsPositioningStatus iReceivedPosStatus; + TBool iUpdateExpected; + TBool iTestFailed; + + }; + +#endif // TE_LBSSTATUSSTEP_H diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/scripts/te_lbspositioningstatus.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/scripts/te_lbspositioningstatus.script Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,41 @@ +// +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +//! @File +//! @SYMTestSuiteName LBS-POSITIONING-STATUS +//! @SYMScriptTestEnvironment TEF + +PRINT Run all te_lbspositioningstatusserver Suite Tests +LOAD_SUITE te_lbspositioningstatusserver + + +START_TESTCASE LBS-POSITIONING-STATUS-1001 +//! @SYMTestCaseID LBS-POSITIONING-STATUS-1001 +//! @SYMTestCaseDesc Checking that the positioining status component works correctly +//! @SYMTestPriority Low +//! @SYMTestActions 1. Change the MO-LR flag to be 1 +//! 2. Change the NI flag to be 1 +//! 2. Change the MO-LR and NI flags to be 0 +//! 2. Change the NI flag to be 1 +//! 2. Change the NI flag to be 2 +//! 2. Change the NI flag to be 0 +//! @SYMTestExpectedResults The client of the API gets notified correctly when there is a change in the positioning status +//! @SYMTestType UT +//! @SYMCreationDate 24/3/2010 +//! @SYMAuthor SorinBasca +//! @SYMTestStatus 3. Released +RUN_TEST_STEP 30 te_lbspositioningstatusserver StatusStep +END_TESTCASE LBS-POSITIONING-STATUS-1001 + diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/src/te_lbspositioningstatusserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/src/te_lbspositioningstatusserver.cpp Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,112 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +// + +/** + @file te_lbspositioningstatusserver.cpp + @internalComponent +*/ + +#include "te_lbspositioningstatusserver.h" +#include "te_lbspositioningstatusstep.h" + +_LIT(KServerName,"te_lbspositioningstatusserver"); + + +CTe_LbsPositioningStatusServer* CTe_LbsPositioningStatusServer::NewL() +/** + * @return - Instance of the test server + * Same code for Secure and non-secure variants + * Called inside the MainL() function to create and start the + * CTestServer derived server. + */ + { + CTe_LbsPositioningStatusServer * server = new (ELeave) CTe_LbsPositioningStatusServer(); + CleanupStack::PushL(server); + + server->ConstructL(KServerName); + CleanupStack::Pop(server); + return server; + } + + +// Secure variants much simpler +// For EKA2, just an E32Main and a MainL() +LOCAL_C void MainL() +/** + * Secure variant + * Much simpler, uses the new Rendezvous() call to sync with the client + */ + { + // Leave the hooks in for platform security +#if (defined __DATA_CAGING__) + RProcess().DataCaging(RProcess::EDataCagingOn); + RProcess().DataCaging(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CTe_LbsPositioningStatusServer* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CTe_LbsPositioningStatusServer::NewL()); + if(!err) + { + // Sync with the client and enter the active scheduler + RProcess::Rendezvous(KErrNone); + sched->Start(); + } + delete server; + delete sched; + } + + + +GLDEF_C TInt E32Main() +/** + * @return - Standard Epoc error code on process exit + * Secure variant only + * Process entry point. Called by client using RProcess API + */ + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + if(cleanup == NULL) + { + return KErrNoMemory; + } + TRAPD(err,MainL()); + delete cleanup; + __UHEAP_MARKEND; + return err; + } + + +CTestStep* CTe_LbsPositioningStatusServer::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + * Secure and non-secure variants + * Implementation of CTestServer pure virtual + */ + { + CTestStep* testStep = NULL; + if(aStepName == KStatusStep) + { + testStep = new CTe_LbsPositioningStatusStep(); + } + + return testStep; + } +//end of file + diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/src/te_lbspositioningstatusstep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/src/te_lbspositioningstatusstep.cpp Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,78 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file te_lbspositioningstatusstepbase.cpp +*/ + +#include "te_lbspositioningstatusstep.h" +#include "te_lbsstatustestmanager.h" +#include "lbspositioningstatusprops.h" // from internal API + + +TVerdict CTe_LbsPositioningStatusStep::doTestStepPreambleL() + { + + INFO_PRINTF1(_L("CTe_LbsPositioningStatusStep::doTestStepPreambleL()")); + __UHEAP_MARK; + iSched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(iSched); + + LbsPositioningStatusProps::InitializeNiPropertyL(); + LbsPositioningStatusProps::InitializeMoPropertyL(); + + iTestManager = CTe_LbsStatusTestManager::NewL(*this); + SetTestStepResult(EPass); + return TestStepResult(); + } + +TVerdict CTe_LbsPositioningStatusStep::doTestStepPostambleL() + { + INFO_PRINTF1(_L("CTe_LbsPositioningStatusStep::doTestStepPostambleL()")); + iTestManager->Cancel(); + delete iTestManager; + iTestManager = NULL; + delete iSched; + iSched = NULL; + __UHEAP_MARKEND; + return TestStepResult(); + } + +TVerdict CTe_LbsPositioningStatusStep::doTestStepL() + { + INFO_PRINTF1(_L("CTe_LbsPositioningStatusStep::doTestStepL()")); + iTestManager->StartTest(); + return TestStepResult(); + } + +CTe_LbsPositioningStatusStep::CTe_LbsPositioningStatusStep() + { + SetTestStepName(KStatusStep); + } + +CTe_LbsPositioningStatusStep::~CTe_LbsPositioningStatusStep() + { + if(iTestManager) + { + iTestManager->Cancel(); + } + delete iTestManager; + delete iSched; + } + + +// end of file + + diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/src/te_lbsstatustestmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationmgmt/locationcore/lbspositioningstatus/test/te_lbspositioningstatus/src/te_lbsstatustestmanager.cpp Fri May 14 17:16:36 2010 +0300 @@ -0,0 +1,254 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file te_lbsstatusstep.cpp + @internalComponent +*/ + +#include "te_lbsstatustestmanager.h" +#include "te_lbspositioningstatusstep.h" +#include "lbsrootcenrepdefs.h" +#include "lbspositioningstatusprops.h" +#include +#include +#include + +const TTimeIntervalMicroSeconds32 KTimerInterval = 2*1000*1000; + +CTe_LbsStatusTestManager* CTe_LbsStatusTestManager::NewL(CTe_LbsPositioningStatusStep& aTest) + { + CTe_LbsStatusTestManager* self = new(ELeave) CTe_LbsStatusTestManager(aTest); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CTe_LbsStatusTestManager::~CTe_LbsStatusTestManager() + { + delete iPositioningStatus; + iTimer.Cancel(); + iTimer.Close(); + } + +void CTe_LbsStatusTestManager::StartTest() + { + iUpdateExpected = EFalse; + CompleteSelf(); + CActiveScheduler::Start(); + } + +CTe_LbsStatusTestManager::CTe_LbsStatusTestManager(CTe_LbsPositioningStatusStep& aTest) + : CActive(EPriorityStandard), iTest(aTest), iStep(EStepInitial) + { + CActiveScheduler::Add(this); + } + +void CTe_LbsStatusTestManager::ConstructL() + { + iPositioningStatus = CLbsPositioningStatus::NewL(*this); + CRepository* rep = CRepository::NewLC(KLbsCenRepUid); + TInt posStatusCat; + User::LeaveIfError(rep->Get(KMoPositioningStatusAPIKey, posStatusCat)); + iMoPosStatusCategory = TUid::Uid(posStatusCat); + User::LeaveIfError(rep->Get(KNiPositioningStatusAPIKey, posStatusCat)); + iNiPosStatusCategory = TUid::Uid(posStatusCat); + CleanupStack::PopAndDestroy(rep); + iTimer.CreateLocal(); + } + +void CTe_LbsStatusTestManager::RunL() + { + iTest.TESTL(!iTestFailed); + switch(iStep) + { + case EStepInitial: + { + // checks that the current status is not active + iTest.INFO_PRINTF1(_L("Checking that initial status is not active")); + iTest.TESTL(CLbsPositioningStatus::ELbsPositioningStatusNotActive == iPositioningStatus->CurrentPositioningStatus()); + // sets the MO-LR property to 1... + iTest.INFO_PRINTF1(_L("Setting the MO-LR property to 1 (expect update)")); + iTest.TESTL(KErrNone == RProperty::Set(iMoPosStatusCategory, KLbsMoPositioningStatusKey, 1)); + iStep = EStepFirstRequest; + iUpdateExpected = ETrue; + iPosStatusUpdateReceived = EFalse; + iTimer.After(iStatus, KTimerInterval); + SetActive(); + break; + } + case EStepFirstRequest: + { + // ...and expects to be notified with status active + iTest.INFO_PRINTF1(_L("Checking that status now active")); + iTest.TESTL(iPosStatusUpdateReceived); + iTest.TESTL(iReceivedPosStatus == CLbsPositioningStatus::ELbsPositioningStatusActive); + iTest.TESTL(CLbsPositioningStatus::ELbsPositioningStatusActive == iPositioningStatus->CurrentPositioningStatus()); + // sets the NI property to 1 as well (so now both are 1)... + iTest.INFO_PRINTF1(_L("Setting the NI property to be 1 (don't expect update)")); + iTest.TESTL(KErrNone == RProperty::Set(iNiPosStatusCategory, KLbsNiPositioningStatusKey, 1)); + iStep = EStepSecondRequest; + iUpdateExpected = EFalse; + iPosStatusUpdateReceived = EFalse; + iTimer.After(iStatus, KTimerInterval); + SetActive(); + break; + } + case EStepSecondRequest: + { + // ...and expects not to be notified and status should be active + iTest.INFO_PRINTF1(_L("Checking that the update wasn't received and that the status is active")); + iTest.TESTL(!iPosStatusUpdateReceived); + iTest.TESTL(CLbsPositioningStatus::ELbsPositioningStatusActive == iPositioningStatus->CurrentPositioningStatus()); + // sets both the MO-LR and the NI properties to 0... + iTest.INFO_PRINTF1(_L("Setting both MO-LR and NI properties to 0 (expect update)")); + iTest.TESTL(KErrNone == RProperty::Set(iMoPosStatusCategory, KLbsMoPositioningStatusKey, 0)); + iTest.TESTL(KErrNone == RProperty::Set(iNiPosStatusCategory, KLbsNiPositioningStatusKey, 0)); + iStep = EStepThirdRequest; + iUpdateExpected = ETrue; + iPosStatusUpdateReceived = EFalse; + iTimer.After(iStatus, KTimerInterval); + SetActive(); + break; + } + case EStepThirdRequest: + { + // ...and expects to be notified with status not active + iTest.INFO_PRINTF1(_L("Checking update was received and status is not active")); + iTest.TESTL(iPosStatusUpdateReceived); + iTest.TESTL(iReceivedPosStatus == CLbsPositioningStatus::ELbsPositioningStatusNotActive); + iTest.TESTL(CLbsPositioningStatus::ELbsPositioningStatusNotActive == iPositioningStatus->CurrentPositioningStatus()); + // sets the NI property to 1... + iTest.INFO_PRINTF1(_L("Setting NI property to 1 (expect update)")); + iTest.TESTL(KErrNone == RProperty::Set(iNiPosStatusCategory, KLbsNiPositioningStatusKey, 1)); + iStep = EStepFourthRequest; + iUpdateExpected = ETrue; + iPosStatusUpdateReceived = EFalse; + iTimer.After(iStatus, KTimerInterval); + SetActive(); + break; + } + case EStepFourthRequest: + { + // ...and expects to be notified with status active + iTest.INFO_PRINTF1(_L("Checking update was received and status is now active")); + iTest.TESTL(iPosStatusUpdateReceived); + iTest.TESTL(iReceivedPosStatus == CLbsPositioningStatus::ELbsPositioningStatusActive); + iTest.TESTL(CLbsPositioningStatus::ELbsPositioningStatusActive == iPositioningStatus->CurrentPositioningStatus()); + // sets the NI property to 2... + iTest.INFO_PRINTF1(_L("Setting NI property to 2 (don't expect update)")); + iTest.TESTL(KErrNone == RProperty::Set(iNiPosStatusCategory, KLbsNiPositioningStatusKey, 2)); + iStep = EStepFifthRequest; + iUpdateExpected = EFalse; + iPosStatusUpdateReceived = EFalse; + iTimer.After(iStatus, KTimerInterval); + SetActive(); + break; + } + case EStepFifthRequest: + { + // ...and expects no update and status to be active + iTest.INFO_PRINTF1(_L("Checking no update was received and status is still active")); + iTest.TESTL(!iPosStatusUpdateReceived); + iTest.TESTL(CLbsPositioningStatus::ELbsPositioningStatusActive == iPositioningStatus->CurrentPositioningStatus()); + // sets the NI property to 0... + iTest.INFO_PRINTF1(_L("Setting the NI property to 0 (expect update)")); + iTest.TESTL(KErrNone == RProperty::Set(iNiPosStatusCategory, KLbsNiPositioningStatusKey, 0)); + iStep = EStepStop; + iUpdateExpected = ETrue; + iPosStatusUpdateReceived = EFalse; + iTimer.After(iStatus, KTimerInterval); + SetActive(); + break; + } + case EStepStop: + { + // ...and expects to be notified with status not active + iTest.INFO_PRINTF1(_L("Checking that an update was received and the status is now not active")); + iTest.TESTL(iPosStatusUpdateReceived); + iTest.TESTL(iReceivedPosStatus == CLbsPositioningStatus::ELbsPositioningStatusNotActive); + iTest.TESTL(CLbsPositioningStatus::ELbsPositioningStatusNotActive == iPositioningStatus->CurrentPositioningStatus()); + CActiveScheduler::Stop(); + break; + } + default: + { + iTest.INFO_PRINTF1(_L("Unexpected step setting")); + iTest.TESTL(EFalse); + } + } + } + +void CTe_LbsStatusTestManager::OnPositioningStatusUpdate(const CLbsPositioningStatus::TLbsPositioningStatus& aPositioningStatus) + { + Cancel(); + iTest.INFO_PRINTF1(_L("Received a status update")); + if(!iUpdateExpected) + { + iTest.INFO_PRINTF1(_L("It was an unexpected update, test failed")); + iTestFailed = ETrue; + } + else + { + switch(iStep) + { + case EStepInitial: + case EStepFirstRequest: + case EStepThirdRequest: + case EStepFourthRequest: + case EStepStop: + { + iPosStatusUpdateReceived = ETrue; + iReceivedPosStatus = aPositioningStatus; + break; + } + case EStepSecondRequest: + case EStepFifthRequest: + default: + { + iTest.INFO_PRINTF1(_L("Update received when in the wrong test step")); + iTestFailed = ETrue; + } + } + + } + iUpdateExpected = EFalse; + CompleteSelf(); + } + +TInt CTe_LbsStatusTestManager::RunError(TInt /*aError*/) + { + iTest.INFO_PRINTF1(_L("Test failed, stopping")); + CActiveScheduler::Stop(); + return KErrNone; + } + +void CTe_LbsStatusTestManager::DoCancel() + { + iTimer.Cancel(); + } + + +void CTe_LbsStatusTestManager::CompleteSelf() + { + iStatus = KRequestPending; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + +// end of file + diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbsroot/group/10282266.cre Binary file locationmgmt/locationcore/lbsroot/group/10282266.cre has changed diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbsroot/group/10282266.txt Binary file locationmgmt/locationcore/lbsroot/group/10282266.txt has changed diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbsroot/inc/lbsrootcenrepdefs.h --- a/locationmgmt/locationcore/lbsroot/inc/lbsrootcenrepdefs.h Mon May 03 13:50:32 2010 +0300 +++ b/locationmgmt/locationcore/lbsroot/inc/lbsrootcenrepdefs.h Fri May 14 17:16:36 2010 +0300 @@ -90,5 +90,8 @@ // SUPL Push API const TUint32 KSuplPushAPIKey = 0x0000B000; +// Positioning Status API +const TUint32 KNiPositioningStatusAPIKey = 0x0000C000; +const TUint32 KMoPositioningStatusAPIKey = 0x0000C001; #endif // LBSROOTCENREPDEFS_H diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbsroot/src/lbsroot.cpp --- a/locationmgmt/locationcore/lbsroot/src/lbsroot.cpp Mon May 03 13:50:32 2010 +0300 +++ b/locationmgmt/locationcore/lbsroot/src/lbsroot.cpp Fri May 14 17:16:36 2010 +0300 @@ -51,6 +51,7 @@ #include "LbsExtendModuleInfo.h" #include "lbsqualityprofile.h" #include "lbssuplpushprops.h" +#include "lbspositioningstatusprops.h" #if defined(_DEBUG) #include "LbsOomTest.h" #endif @@ -449,6 +450,12 @@ LbsSuplPushProps::InitializeL(); + + // Initialize the NI-LR Positioning Status Property. + // Note the MO-LR Positioning Status Property is initialized by the + // location server + LbsPositioningStatusProps::InitializeNiPropertyL(); + #if defined(_DEBUG) //Initialize the OOM Test property. ROomRequest::InitializeL(); diff -r 2965a06983dc -r aadfb18aaac1 locationmgmt/locationcore/lbsrootapi/inc/lbspropertykeydefs.h --- a/locationmgmt/locationcore/lbsrootapi/inc/lbspropertykeydefs.h Mon May 03 13:50:32 2010 +0300 +++ b/locationmgmt/locationcore/lbsrootapi/inc/lbspropertykeydefs.h Fri May 14 17:16:36 2010 +0300 @@ -99,6 +99,7 @@ const TUint KLbsAssistDataApiBase = 0x08001000; //Base value for Assistance Data Api keys const TUint KLbsQualityProfileKeyBase = 0x09001000; //Base value for Quality Profile keys const TUint KLbsSuplPushAPIBase = 0x0A001000; //Base value for SUPL Push API keys +const TUint KLbsPositioningStatusAPIBase = 0x0B001000; //Base value for Positioning Status API keys #endif //LBSPROPERTYKEYDEFS_H diff -r 2965a06983dc -r aadfb18aaac1 locationrequestmgmt/locationserver/group/EPos_Server.mmp --- a/locationrequestmgmt/locationserver/group/EPos_Server.mmp Mon May 03 13:50:32 2010 +0300 +++ b/locationrequestmgmt/locationserver/group/EPos_Server.mmp Fri May 14 17:16:36 2010 +0300 @@ -58,6 +58,9 @@ USERINCLUDE ../inc USERINCLUDE ../resource +USERINCLUDE ../../../locationmgmt/locationcore/lbsroot/inc +USERINCLUDE ../../../locationmgmt/locationcore/lbsrootapi/inc +USERINCLUDE ../../../locationmgmt/locationcore/LbsInternalApi/inc // for the lbspositioningstatusprops.h USERINCLUDE ../../../locationmgmt/locationcore/LbsNetInternalApi/inc // for the lbsnetinternalapi.h USERINCLUDE ../../../locationmgmt/locationcore/LbsPartnerCommon/inc // for the lbsdevloggermacros.h USERINCLUDE ../../../locationmgmt/locationcore/LbsCommonInternalDataTypes/inc @@ -84,8 +87,10 @@ LIBRARY bafl.lib LIBRARY efsrv.lib LIBRARY ecom.lib +LIBRARY centralrepository.lib LIBRARY lbsadmin.lib LIBRARY lbsnetinternalapi.lib +LIBRARY lbsinternalapi.lib LIBRARY lbslocmonclient.lib LIBRARY lbsnetregstatusint.lib #ifdef SYMBIAN_FEATURE_MANAGER diff -r 2965a06983dc -r aadfb18aaac1 locationrequestmgmt/locationserver/inc/EPos_CPositionRequest.h --- a/locationrequestmgmt/locationserver/inc/EPos_CPositionRequest.h Mon May 03 13:50:32 2010 +0300 +++ b/locationrequestmgmt/locationserver/inc/EPos_CPositionRequest.h Fri May 14 17:16:36 2010 +0300 @@ -141,6 +141,7 @@ // CPosLocMonitorReqHandlerHub& iLastPositionHandler; CPosLocMonitorReqHandlerHub& iLocMonitorReqHandler; CPosModuleSettings& iModuleSettings; + TUid iPosStatusCategory; }; #endif // CPOSITIONREQUEST_H diff -r 2965a06983dc -r aadfb18aaac1 locationrequestmgmt/locationserver/src/EPos_CPosServer.cpp --- a/locationrequestmgmt/locationserver/src/EPos_CPosServer.cpp Mon May 03 13:50:32 2010 +0300 +++ b/locationrequestmgmt/locationserver/src/EPos_CPosServer.cpp Fri May 14 17:16:36 2010 +0300 @@ -41,6 +41,7 @@ #include "EPos_CPosLocMonitorReqHandlerHub.h" #include "EPos_Global.h" +#include "lbspositioningstatusprops.h" // CONSTANTS _LIT(KPosResourceFile, "\\private\\101F97B2\\eposserver.rsc"); @@ -180,10 +181,11 @@ DEBUG_TRACE("Setting Location Settings observer...", __LINE__) iModuleSettings->AddListenerL(*this); + // Define the MO Positioning Status property + LbsPositioningStatusProps::InitializeMoPropertyL(); + DEBUG_TRACE("Starting server active object...", __LINE__) StartL(KPositionServerName); - - } /** @@ -203,7 +205,6 @@ */ CPosServer::~CPosServer() { - delete iLocMonitorReqHandlerHub; delete iShutdown; @@ -211,7 +212,7 @@ delete iModuleSettings; delete iBackupListener; - + // This is needed because CPositioner might have used ECom (PSYs) REComSession::FinalClose(); } diff -r 2965a06983dc -r aadfb18aaac1 locationrequestmgmt/locationserver/src/EPos_CPositionRequest.cpp --- a/locationrequestmgmt/locationserver/src/EPos_CPositionRequest.cpp Mon May 03 13:50:32 2010 +0300 +++ b/locationrequestmgmt/locationserver/src/EPos_CPositionRequest.cpp Fri May 14 17:16:36 2010 +0300 @@ -21,6 +21,7 @@ #include #include #include +#include #include "lbsdevloggermacros.h" #include "EPos_ServerPanic.h" #include "EPos_Global.h" @@ -34,6 +35,8 @@ #ifdef OST_TRACE_COMPILER_IN_USE #include "EPos_CPositionRequestTraces.h" #endif +#include "lbsrootcenrepdefs.h" +#include "lbspositioningstatusprops.h" @@ -102,6 +105,14 @@ User::Leave(KErrNotFound); } + // Get the CategoryUid from the cenrep file owned by LbsRoot. + CRepository* rep = CRepository::NewLC(KLbsCenRepUid); + TInt posStatusCategory; + TInt err = rep->Get(KMoPositioningStatusAPIKey, posStatusCategory); + User::LeaveIfError(err); + CleanupStack::PopAndDestroy(rep); + iPosStatusCategory = TUid::Uid(posStatusCategory); + LoadPositionerL(); } @@ -166,6 +177,21 @@ } __ASSERT_DEBUG(iPositioner, DebugPanic(EPosServerPanicPositionerNotInitialized)); + + //Increment the StatusKeyValue for Positioning Indicator clients + if(iTrackingState == EPosNoTracking || iTrackingState == EPosFirstTrackingRequest) + { + TInt count, err; + err = RProperty::Get(iPosStatusCategory, KLbsMoPositioningStatusKey, count); + if(err == KErrNone) + { + err = RProperty::Set(iPosStatusCategory, KLbsMoPositioningStatusKey, count+1); + } + if(err != KErrNone) + { + DEBUG_TRACE("CPositionRequest::MakeRequestL() - Error in setting or getting Positioning Status", __LINE__) + } + } iMessage = aMessage; // Store parameter here in case of leave. @@ -505,6 +531,25 @@ LBS_RDEBUG_ARGINT("LBS","Client", "RunL", aReason); iMessage.Complete(aReason); } + //Decrement the StatusKeyValue for Positioning Indicator clients + if(iTrackingState == EPosNoTracking) + { + TInt count, err; + err = RProperty::Get(iPosStatusCategory, KLbsMoPositioningStatusKey, count); + if(err == KErrNone && count > 0) + { + err = RProperty::Set(iPosStatusCategory, KLbsMoPositioningStatusKey, count-1); + } + + if(err != KErrNone) + { + DEBUG_TRACE("CPositionRequest::StopTracking() - error in getting or setting Positioning Status", __LINE__) + } + else if (count <=0) + { + DEBUG_TRACE("CPositionRequest::StopTracking() - Incorrect Positioning Status tracking count", __LINE__) + } + } } void CPositionRequest::CompleteRequest(TInt aReason) @@ -704,6 +749,23 @@ iTrackingState = EPosNoTracking; StopPsyTracking(); + + //Set PositionIndicator Off + TInt count, err; + err = RProperty::Get(iPosStatusCategory, KLbsMoPositioningStatusKey, count); + if(err == KErrNone && count > 0) + { + err = RProperty::Set(iPosStatusCategory, KLbsMoPositioningStatusKey, count-1); + } + + if(err != KErrNone) + { + DEBUG_TRACE("CPositionRequest::StopTracking() - error in getting or setting Positioning Status", __LINE__) + } + else if (count <=0) + { + DEBUG_TRACE("CPositionRequest::StopTracking() - Incorrect Positioning Status tracking count", __LINE__) + } } void CPositionRequest::StopPsyTracking() diff -r 2965a06983dc -r aadfb18aaac1 locationrequestmgmt/networkrequesthandler/group/lbsnetworkrequesthandler.mmp --- a/locationrequestmgmt/networkrequesthandler/group/lbsnetworkrequesthandler.mmp Mon May 03 13:50:32 2010 +0300 +++ b/locationrequestmgmt/networkrequesthandler/group/lbsnetworkrequesthandler.mmp Fri May 14 17:16:36 2010 +0300 @@ -91,6 +91,7 @@ USERINCLUDE ../inc USERINCLUDE ../../../locationmgmt/locationcore/LbsCommonInternalDataTypes/inc +USERINCLUDE ../../../locationmgmt/locationcore/lbsroot/inc USERINCLUDE ../../../locationmgmt/locationcore/lbsrootapi/inc USERINCLUDE ../../../locationmgmt/locationcore/LbsInternalApi/inc USERINCLUDE ../../../locationmgmt/locationcore/LbsNetInternalApi/inc @@ -112,6 +113,7 @@ LIBRARY euser.lib LIBRARY estor.lib +LIBRARY centralrepository.lib LIBRARY lbs.lib LIBRARY lbsloccommon.lib LIBRARY lbsx3p.lib diff -r 2965a06983dc -r aadfb18aaac1 locationrequestmgmt/networkrequesthandler/inc/privacyandlocationrequesthandler.h --- a/locationrequestmgmt/networkrequesthandler/inc/privacyandlocationrequesthandler.h Mon May 03 13:50:32 2010 +0300 +++ b/locationrequestmgmt/networkrequesthandler/inc/privacyandlocationrequesthandler.h Fri May 14 17:16:36 2010 +0300 @@ -121,6 +121,8 @@ TPositionModuleInfoExtended::TDeviceGpsModeCapabilities DeviceGpsModeCaps(); CLbsAdmin::TLbsBehaviourMode BehaviourMode(); RLbsNetworkRegistrationStatus& NetworkRegistrationStatus(); + void IncrementPositioningStatus(); + void DecrementPositioningStatus(); private: static TBool IsSessionIdEqual( @@ -162,6 +164,12 @@ CLbsPrivLocFsm* iMolRFsm; CLbsPrivLocFsm* iX3pFsm; + + // ETrue if location management is supported + TBool iLocationManagementSupported; + + // Category of the Positioning Status P&S Keys + TUid iPosStatusCategory; }; @@ -437,7 +445,7 @@ RLbsNetworkRegistrationStatus& LbsNetworkRegistrationStatus(); TPositionModuleInfoExtended::TDeviceGpsModeCapabilities DeviceGpsModeCaps(); CLbsAdmin::TLbsBehaviourMode BehaviourMode(); - + void IncrementPositioningStatus(); protected: CLbsPrivLocFsm* iFsm; @@ -776,9 +784,16 @@ TLbsNetSessionIdInt& LastLocReqSessionId() { return iLastLocReqSessionId; } - TBool& WasPrivacyResponseReceivedStateExited() + TBool& WasPrivacyResponseReceivedStateExited() { return iWasPrivacyResponseReceivedStateExited; } + TLbsExternalRequestInfo::TRequestType& ExternalRequestType() + { return iExternalRequestType; } + + TBool& WasPositioningStatusIncremented() + { return iPositioningStatusIncremented; } + + private: // Allow access for friend classes (the states and the NRH) friend class CLbsPrivLocStateBase; friend class CLbsNetworkRequestHandler; @@ -860,6 +875,12 @@ // Has a privacy request been rejected? TBool iWasPrivacyResponseReceivedStateExited; + // The type of external request that has been recieved. + TLbsExternalRequestInfo::TRequestType iExternalRequestType; + + // Indicates if this session resulted in the positioning status being incremented. + TBool iPositioningStatusIncremented; + private: // the states CLbsPrivLocStateBase* iCurrentState; diff -r 2965a06983dc -r aadfb18aaac1 locationrequestmgmt/networkrequesthandler/src/privacyandlocationrequesthandler.cpp --- a/locationrequestmgmt/networkrequesthandler/src/privacyandlocationrequesthandler.cpp Mon May 03 13:50:32 2010 +0300 +++ b/locationrequestmgmt/networkrequesthandler/src/privacyandlocationrequesthandler.cpp Fri May 14 17:16:36 2010 +0300 @@ -15,6 +15,12 @@ #include #include +#include + +#ifdef SYMBIAN_FEATURE_MANAGER + #include + #include +#endif // LBS-specific #include @@ -25,6 +31,8 @@ #include "nrhpanic.h" #include "lbsdevloggermacros.h" #include "lbsqualityprofile.h" +#include "lbsrootcenrepdefs.h" +#include "lbspositioningstatusprops.h" #include "privacyandlocationrequesthandler.h" @@ -93,6 +101,10 @@ iFsmArray.ResetAndDestroy(); + // force the count of active network initiated positioning sessions to 0 + // this supports the pre-APE centric architecture wherein the NRH is + // destroyed on completion of network initiated positioning. + RProperty::Set(iPosStatusCategory, KLbsNiPositioningStatusKey, 0); delete iEmergencyFsm; delete iAgpsInterface; @@ -161,6 +173,20 @@ } LBSLOG2(ELogP3, "Using KLbsSpecialFeatureIntermediateFutileUpdate = %d", specialFeature); iSpecialFeatureIntermediateFutileUpdate = (specialFeature == CLbsAdmin::ESpecialFeatureOn) ? ETrue : EFalse; + +#ifdef SYMBIAN_FEATURE_MANAGER + iLocationManagementSupported = CFeatureDiscovery::IsFeatureSupportedL(NFeature::KLocationManagement); +#else + __ASSERT_ALWAYS(EFalse, User::Invariant()); // Would happen on older versions of symbian OS if this code ever backported +#endif + + // Get the CategoryUid from the cenrep file owned by LbsRoot for accessing Positioning Status P&S Keys + CRepository* rep = CRepository::NewLC(KLbsCenRepUid); + TInt posStatusCategory; + err = rep->Get(KNiPositioningStatusAPIKey, posStatusCategory); + User::LeaveIfError(err); + CleanupStack::PopAndDestroy(rep); + iPosStatusCategory = TUid::Uid(posStatusCategory); } @@ -685,6 +711,36 @@ { return iNetRegStatus; } + +// increments the P&S key tracking mobile terminated positioning requests +void CPrivacyAndLocationHandler::IncrementPositioningStatus() + { + TInt count; + RProperty::Get(iPosStatusCategory, KLbsNiPositioningStatusKey, count); + RProperty::Set(iPosStatusCategory, KLbsNiPositioningStatusKey, count+1); + } + +// decrements the P&S key tracking mobile terminated positioning requests +// if location management is supported. In the alternative architecture, +// the NRH is not aware of the positioning session's progress, but is +// transient. Therefore the positioning status is set to zero in the +// class destructor. +void CPrivacyAndLocationHandler::DecrementPositioningStatus() + { + if (iLocationManagementSupported) + { + TInt count; + RProperty::Get(iPosStatusCategory, KLbsNiPositioningStatusKey, count); + if(count>0) + { + RProperty::Set(iPosStatusCategory, KLbsNiPositioningStatusKey, count-1); + } + else + { + LBSLOG_ERR(ELogP3, "CPrivacyAndLocationHandler::DecrementPositioningStatus() - Incorrect Positioning Status count\n"); + } + } + } /** @@ -915,7 +971,7 @@ if(aSessionId == iFsm->SessionId()) { iFsm->ExitData().SetExitData(TPrivLocStateExitData::EExitSessionComplete, aReason); - iFsm->ChangeState(CLbsPrivLocFsm::EStateIdle, aSessionId); + iFsm->ChangeState(CLbsPrivLocFsm::EStateIdle, aSessionId); } } @@ -1054,6 +1110,17 @@ return iFsm->PrivLocHandler().NetworkRegistrationStatus(); } +/* + * increments the network initiated positioning status count + * and remembers that it has done + */ +void CLbsPrivLocStateBase::IncrementPositioningStatus() + { + iFsm->PrivLocHandler().IncrementPositioningStatus(); + iFsm->WasPositioningStatusIncremented() = ETrue; + } + + // ----------------------------------------------------------------------------- // // ----------------------- Class CLbsPrivLocIdleState -------------------- @@ -1129,7 +1196,7 @@ // The request relates to a rejected privacy request // or a request for this session which has already been answered. // In either case, it should be refused. The message is sent to the - // network gateway as apart of exit from the state, but we want to + // network gateway as a part of exit from the state, but we want to // remain in Idle state. iFsm->ExitData().SetExitData(TPrivLocStateExitData::EExitCancelledByPrivacyController, KErrAccessDenied); iFsm->ChangeState(CLbsPrivLocFsm::EStateIdle, aSessionId); @@ -1183,6 +1250,7 @@ const TLbsNetPosRequestPrivacyInt& aNetPosRequestPrivacy) { iFsm->SessionType() = aSessionType; + iFsm->ExternalRequestType() = aExternalRequestInfo.RequestType(); iFsm->ExitData().SetExitData(TPrivLocStateExitData::EExitPrivacyRequestReceived, KErrNone); TPrivLocWaitPrivResponseParams privacyRequestParams( aSessionId, aSessionType, @@ -1292,7 +1360,7 @@ } } - // For MtLrs the Protcol module should not + // For MtLrs the Protocol module should not // send a REF position until after we have sent the Priv response to the PM // Inform network of the privacy response for normal privacy requests. @@ -1366,6 +1434,13 @@ // Tell the AGPS handler that we are going to start a location request soon. AgpsInterface()->PreStartPositioning(iFsm->SessionId(), iFsm->IsEmergency()); + // Set the Positioning Status for the UI indicator. + // Not done for silent requests. + if (iFsm->ExternalRequestType() < TLbsExternalRequestInfo::ERequestSingleShotSilent) + { + IncrementPositioningStatus(); + } + if(iFsm->LocReqReceived()) { TPrivLocWaitLocationUpdateParams updateRequestParams(iFsm->SessionId(), @@ -2487,7 +2562,8 @@ iRefPosProcessed(EFalse), iLocReqReceived(EFalse), iReqCancelled(EFalse), - iWasPrivacyResponseReceivedStateExited(EFalse) + iWasPrivacyResponseReceivedStateExited(EFalse), + iPositioningStatusIncremented(EFalse) { } @@ -2612,6 +2688,14 @@ { LBSLOG3(ELogP3, "FSM(%d) OnSessionComplete reason=%d",iSessionId.SessionNum(),aReason); iCurrentState->OnSessionComplete(aSessionId, aReason); + + // update the positioning status. Note this is updated only if it was previously + // incremented as a result of this session. + if (WasPositioningStatusIncremented()) + { + PrivLocHandler().DecrementPositioningStatus(); + WasPositioningStatusIncremented() = EFalse; + } } // ----------------------------------------------------------------------------- diff -r 2965a06983dc -r aadfb18aaac1 locationrequestmgmt/networkrequesthandler/test/group/t_lbsnetworkrequesthandler.mmp --- a/locationrequestmgmt/networkrequesthandler/test/group/t_lbsnetworkrequesthandler.mmp Mon May 03 13:50:32 2010 +0300 +++ b/locationrequestmgmt/networkrequesthandler/test/group/t_lbsnetworkrequesthandler.mmp Fri May 14 17:16:36 2010 +0300 @@ -99,6 +99,7 @@ USERINCLUDE ../../inc USERINCLUDE ../../../../locationmgmt/locationcore/LbsCommonInternalDataTypes/inc +USERINCLUDE ../../../../locationmgmt/locationcore/lbsroot/inc USERINCLUDE ../../../../locationmgmt/locationcore/lbsrootapi/inc USERINCLUDE ../../../../locationmgmt/locationcore/LbsInternalApi/inc USERINCLUDE ../../../../locationmgmt/locationcore/LbsNetInternalApi/inc @@ -119,6 +120,7 @@ LIBRARY euser.lib LIBRARY estor.lib +LIBRARY centralrepository.lib LIBRARY lbs.lib LIBRARY lbsloccommon.lib LIBRARY lbsx3p.lib