# HG changeset patch # User Maciej Seroka # Date 1257861058 0 # Node ID e13acd883fbe11620a838de22ed6421e8b8ada56 # Parent 76f9aaeefbab1f2613d44753298a611dd46cb5e0 Added new smoketest diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/Group/bld.inf --- a/common/tools/ats/smoketest/Group/bld.inf Tue Nov 10 11:33:04 2009 +0000 +++ b/common/tools/ats/smoketest/Group/bld.inf Tue Nov 10 13:50:58 2009 +0000 @@ -26,3 +26,4 @@ #include "../profiles/group/Bld.inf" #include "../notepad/group/bld.inf" #include "../appinstall/group/Bld.inf" +#include "../lbs/group/bld.inf" diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/Group/smoketest.pl --- a/common/tools/ats/smoketest/Group/smoketest.pl Tue Nov 10 11:33:04 2009 +0000 +++ b/common/tools/ats/smoketest/Group/smoketest.pl Tue Nov 10 13:50:58 2009 +0000 @@ -30,6 +30,8 @@ copy($epoc . "data/z/smoketest/smoketest_timew.script", "temp/smoketest/general/smoketest_timew.script"); copy($epoc . "data/z/smoketest/smoketest_email.ini", "temp/smoketest/general/smoketest_email.ini"); copy($epoc . "data/z/smoketest/smoketest_email.script", "temp/smoketest/general/smoketest_email.script"); +copy($epoc . "data/z/smoketest/smoketest_lbs.ini", "temp/smoketest/general/smoketest_lbs.ini"); +copy($epoc . "data/z/smoketest/smoketest_lbs.script", "temp/smoketest/general/smoketest_lbs.script"); copy($epoc . "data/z/smoketest/sms/message1.txt", "temp/smoketest/sms/general/message1.txt"); copy($epoc . "data/z/smoketest/MachineName.txt", "temp/smoketest/general/MachineName.txt"); copy($epoc . "data/z/smoketest/emailmessage/20KBody.txt", "temp/smoketest/emailmessage/general/20KBody.txt"); @@ -46,6 +48,12 @@ copy($epoc . "release/winscw/udeb/t_msgutilityserver.dll", "temp/smoketest/winscw_udeb/t_msgutilityserver.dll"); copy($epoc . "release/winscw/udeb/t_msgpopserver.exe", "temp/smoketest/winscw_udeb/t_msgpopserver.exe"); copy($epoc . "release/winscw/udeb/t_msgsmtpserver.exe", "temp/smoketest/winscw_udeb/t_msgsmtpserver.exe"); +copy($epoc . "release/winscw/udeb/lbstestutils.dll", "temp/smoketest/winscw_udeb/lbstestutils.dll"); +copy($epoc . "release/winscw/udeb/lbstestclient.dll", "temp/smoketest/winscw_udeb/lbstestclient.dll"); +copy($epoc . "release/winscw/udeb/lbstestchannel.dll", "temp/smoketest/winscw_udeb/lbstestchannel.dll"); +copy($epoc . "release/winscw/udeb/lbstestserver.exe", "temp/smoketest/winscw_udeb/lbstestserver.exe"); +copy($epoc . "release/winscw/udeb/ctlbsexeclient.exe", "temp/smoketest/winscw_udeb/ctlbsexeclient.exe"); +copy($epoc . "release/winscw/udeb/lbsclienttestserver.exe", "temp/smoketest/winscw_udeb/lbsclienttestserver.exe"); copy($epoc . "release/winscw/udeb/ProfileSmokeTestModule.dll", "temp/smoketest/winscw_udeb/ProfileSmokeTestModule.dll"); copy($epoc . "winscw/c/smoketest/ProfileSmokeTestModule.cfg", "temp/smoketest/general/ProfileSmokeTestModule.cfg"); diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/Group/smoketest.xml --- a/common/tools/ats/smoketest/Group/smoketest.xml Tue Nov 10 11:33:04 2009 +0000 +++ b/common/tools/ats/smoketest/Group/smoketest.xml Tue Nov 10 13:50:58 2009 +0000 @@ -176,6 +176,60 @@ + + install + + + + + + + + + install + + + + + + + + + install + + + + + + + + + install + + + + + + + + + install + + + + + + + + + install + + + + + + + execute @@ -242,6 +296,17 @@ + + execute + + + + + + + + + @@ -363,6 +428,8 @@ smoketest/general/smoketest_timew.script smoketest/general/smoketest_email.ini smoketest/general/smoketest_email.script + smoketest/general/smoketest_lbs.ini + smoketest/general/smoketest_lbs.script smoketest/sms/general/message1.txt smoketest/general/MachineName.txt smoketest/emailmessage/general/20KBody.txt @@ -379,6 +446,12 @@ smoketest/winscw_udeb/t_msgutilityserver.dll smoketest/winscw_udeb/t_msgpopserver.exe smoketest/winscw_udeb/t_msgsmtpserver.exe + smoketest/winscw_udeb/lbstestutils.dll + smoketest/winscw_udeb/lbstestclient.dll + smoketest/winscw_udeb/lbstestchannel.dll + smoketest/winscw_udeb/lbstestserver.exe + smoketest/winscw_udeb/ctlbsexeclient.exe + smoketest/winscw_udeb/lbsclienttestserver.exe smoketest/winscw_udeb/ProfileSmokeTestModule.dll smoketest/general/ProfileSmokeTestModule.cfg smoketest/winscw_udeb/TestNpdApi.dll diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/group/ctlbscommon.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/group/ctlbscommon.mmp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,81 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbscommon.mmp +// +// + +SYSTEMINCLUDE /epoc32/include +SYSTEMINCLUDE /epoc32/include/test +SYSTEMINCLUDE /epoc32/include/lbs +SYSTEMINCLUDE /epoc32/include/lbs/test + +USERINCLUDE ../inc +//USERINCLUDE ../../../../locationmgmt/locationcore/LbsLogging/inc +// Common framework code. +SOURCEPATH ../src +SOURCE ctlbsserver.cpp +SOURCE ctlbsshareddata.cpp +SOURCE ctlbsstep.cpp +SOURCE ctlbsnetsimstep.cpp + +// Common test step code. +SOURCE ctlbsstepinstallscheduler.cpp +SOURCE ctlbsstepcreateverifymoduledata.cpp +SOURCE ctlbsstepcreateverifyposinfos.cpp +SOURCE ctlbsstepverifymodinfo.cpp +SOURCE ctlbsstepverifyposinfos.cpp +SOURCE ctlbsstepverifyroughposinfos.cpp +SOURCE ctlbsstepverifyloginfo.cpp +SOURCE ctlbsstepverifymodstatus.cpp +SOURCE ctlbsstepstartlbs.cpp +SOURCE ctlbsstepstoplbs.cpp +SOURCE ctlbsstepsetautonomousmode.cpp +SOURCE ctlbsstepresetdefaultadmin.cpp +SOURCE ctlbsdoposupdate.cpp +SOURCE ctlbsstepcreateverifymodinfo.cpp +SOURCE ctlbsstepsetprivhandler.cpp +SOURCE ctlbsstepsetupprotocolstub.cpp +SOURCE ctlbsstepsetuproamselflocate.cpp +SOURCE ctlbsstepclearlog.cpp +SOURCE ctlbsstepconfighybridmodule.cpp +SOURCE ctlbsactiveyield.cpp +SOURCE ctlbsstepsetupstandaloneprivacymode.cpp +SOURCE ctlbsstepsetupstandaloneprivacyandsimplectlr.cpp +SOURCE ctlbsstepsetupstandaloneprivacywithnoctlr.cpp +SOURCE ctlbsportedstepbase.cpp +SOURCE ctlbsrequester.cpp +SOURCE ctlbsposclient.cpp +SOURCE ctlbsposclientholder.cpp +SOURCE ctlbsclientrequestor.cpp +SOURCE ctlbsclientlog.cpp +SOURCE ctlbsstepsetbehaviourmodeoriginal.cpp +SOURCE ctlbsstepsetptamode.cpp +SOURCE ctlbsstepsetatamode.cpp +SOURCE ctlbsstepsetptbmode.cpp + +// EPOC + Test Execute libraries. +LIBRARY euser.lib +LIBRARY testexecuteutils.lib +LIBRARY testexecutelogclient.lib + +// For logging +LIBRARY logcli.lib +LIBRARY logwrap.lib +LIBRARY lbsloggerapi.lib +LIBRARY efsrv.lib +LIBRARY centralrepository.lib +LIBRARY bafl.lib // BaflUtils + +// Lbs Libraries +LIBRARY eposmodset.lib diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/LbsAssistanceDataLogEvent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/LbsAssistanceDataLogEvent.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,64 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + +/** + @file + @publishedPartner + @released +*/ + +#ifndef LBS_ASSISTANCE_DATA_LOG_EVENT_H +#define LBS_ASSISTANCE_DATA_LOG_EVENT_H + +#include + +/** log event object for assistance data request */ + +class CLbsAssistanceDataLogEvent : public CLbsLogEvent + { +public: + IMPORT_C static CLbsAssistanceDataLogEvent* NewL(const TUint32 aRequestType, const TUint32 aReceiveType); + ~CLbsAssistanceDataLogEvent(); + // for assistance data + IMPORT_C void SetRequestAssistanceDataType(const TUint32 aMask); + IMPORT_C TUint32 RequestAssistanceDataType() const; + IMPORT_C void SetReceiveAssistanceDataType(const TUint32 aMask); + IMPORT_C TUint32 ReceiveAssistanceDataType() const; + +protected: + void DoExternalizeL(RWriteStream& aWriteStream) const; + void DoInternalizeL(RReadStream& aReadStream); + void DoUpdateL(const CLbsLogEvent& aSourceLogEvent); + void DoCopyL(CLbsLogEvent*& aTargetLogEvent) const; + TInt DataSize() const; +private: + CLbsAssistanceDataLogEvent(); + void ConstructL(const TUint32 aRequestType, const TUint32 aReceiveType); +private: + /** requested assistance data type from application */ + TUint32 iRequestAssistanceDataType; + /** received assistance data type from network */ + TUint32 iReceiveAssistanceDataType; + + }; // class CLbsAssistanceDataLogEvent + + +#endif // LBS_ASSISTANCE_LOG_EVENT_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/LbsExternalLocateLogEvent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/LbsExternalLocateLogEvent.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,103 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + +/** + @file + @publishedPartner + @released +*/ + +#ifndef LBS_EXTERNAL_LOCATE_LOG_EVENT_H +#define LBS_EXTERNAL_LOCATE_LOG_EVENT_H + +#include +#include + +#include // For TLbsExternalRequestInfo +#include "lbsnetcommon.h" // For TLbsNetSessionId + +/** +the privacy request parameter structure +*/ +class TLbsLoggingPrivacyRequestParams + { +public: + TLbsNetSessionId iSessionId; + TLbsExternalRequestInfo iRequestInfo; + TLbsNetPosRequestPrivacy iRequestPrivacy; + }; + +/** +the privacy response parameter structure +*/ +class TLbsLoggingPrivacyResponseParams + { +public: + TLbsNetSessionId iSessionId; + /** verification result to the privacy request */ + CLbsNetworkProtocolBase::TLbsPrivacyResponse iResult; + } ; + +/** log event object for external locate request */ +class CLbsExternalLocateLogEvent : public CLbsLogEvent + { +public: + IMPORT_C static CLbsExternalLocateLogEvent* NewL(TUid aRequestOriginator,TPositionInfoBase* aRefPosInfo, TPositionInfoBase* aPosInfo); + IMPORT_C void SetPrivacyRequestParams(const TLbsLoggingPrivacyRequestParams& aParams); + IMPORT_C void SetPrivacyResponseParams(const TLbsLoggingPrivacyResponseParams& aParams); + IMPORT_C void SetReferenceLocation(TPositionInfoBase* aPosInfo); + ~CLbsExternalLocateLogEvent(); + + // for external locate + IMPORT_C TPositionInfoBase* ReferenceLocation() const; + IMPORT_C void SetRequestOriginator(TUid aRequestor); + IMPORT_C TUid RequestOriginator() const; + IMPORT_C TLbsLoggingPrivacyRequestParams PrivacyRequestParams() const; + IMPORT_C TLbsLoggingPrivacyResponseParams PrivacyResponseParams() const; + +protected: + void DoExternalizeL(RWriteStream& aWriteStream) const; + void DoInternalizeL(RReadStream& aReadStream); + void DoUpdateL(const CLbsLogEvent& aSourceLogEvent); + void DoCopyL(CLbsLogEvent*& aTargetLogEvent) const; + TInt DataSize() const; +private: + CLbsExternalLocateLogEvent(); + void ConstructL(TUid aRequestOriginator, TPositionInfoBase* aRefPosInfo, TPositionInfoBase* aPosInfo); + void CopyPrivacyRequestParams(TLbsLoggingPrivacyRequestParams& aTargetPrivacyInfo, + const TLbsLoggingPrivacyRequestParams& aSourcePrivacyInfo); + void CopyPrivacyResponseParams(TLbsLoggingPrivacyResponseParams& aTargetPrivacyInfo, + const TLbsLoggingPrivacyResponseParams& aSourcePrivacyInfo); +private: + /** Descriptor of the request originator */ + TUid iRequestOriginator; + /** Privacy request/response info */ + TLbsLoggingPrivacyRequestParams iPrivacyReqInfo; + /** Indicate whether the MT-LR access is granted or not */ + TLbsLoggingPrivacyResponseParams iPrivacyResInfo; + /** The calculation method indicates MS-Based or Autonomous GPS is withint TPositionInfoBase */ + /** The positioning mode used to calculate this location fix. */ + // TPositionModuleInfo::TTechnologyType iPositionMode; + /** The returned reference location information if the request is completed successfully */ + TPositionInfo* iRefPosInfo; + }; // class CLbsExternalLocateLogEvent + +#endif // LBS_EXTERNAL_LOCATE_LOG_EVENT_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/LbsLogEvent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/LbsLogEvent.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,127 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + +/** + @file + @publishedPartner + @released +*/ + +#ifndef LBS_LOG_EVENT_H +#define LBS_LOG_EVENT_H + +#include +#include +#include +#include +#include + +#include +#include +/** + class for the privacy request information +*/ +class TPrivacyRequestParams; + +/** + class for the privacy response information +*/ +class TPrivacyResponseParams; + +enum TLbsRequestOutcome +/** + enum for the request outcomes +*/ + { + ELbsRequestOutcomeInconclusive =0, + ELbsRequestOutcomeSuccess, + ELbsRequestOutcomeFail, + ELbsRequestOutcomeCancel, + }; + +class CLbsLogEvent : public CBase +/** + Base class for the classes representing LBS events to be logged. It provides the common + functionality (internalising, externalising, updating this class from another one and creating + a copy of this class). + + @prototype +*/ + { +public: + IMPORT_C static CLbsLogEvent* NewL(const CLogEvent& aLogEvent); + IMPORT_C CLogEvent* ExternalizeL() const; + IMPORT_C void SetPositionInfo(TPositionInfoBase* aPosInfo); + + virtual ~CLbsLogEvent(); + void UpdateL(const CLbsLogEvent& aLogEvent); + void UpdateRootEvent(CLogEvent* aTargetEvent); + CLbsLogEvent* CopyL() const; + + // Inline functions + IMPORT_C void SetDirection(TBool aDirection); + IMPORT_C TBool Direction() const; + IMPORT_C TUid EventType() const; + IMPORT_C void SetEventType(TUid aId); + IMPORT_C void SetRequestOutcome(TLbsRequestOutcome aRequestOutcome); + IMPORT_C TLbsRequestOutcome RequestOutcome() const; + IMPORT_C TBool IsCostInformationAvailable() const; + IMPORT_C void SetCostInformation(TUint aCostInformation); + IMPORT_C TUint CostInformation() const; + IMPORT_C TPositionInfoBase* PositionInfo() const; + +protected: + CLbsLogEvent(); + void InternalizeL(const CLogEvent& aLogEvent); + TPositionInfo* CopyPosInfoToEvent(const TPositionInfoBase* aSrcosInfo); + void WritePosInfo(RWriteStream& aWriteStream, const TPositionInfo* aPosInfo) const; + void ReadPosInfo(RReadStream& aReadStream, TPositionInfo*& aPosInfo); + // for BC consideration, possible handling TAny* data member + // called by derived 3rd party classes + void BaseConstructL(); + virtual void DoExternalizeL(RWriteStream& aReadStream) const = 0; + virtual void DoInternalizeL(RReadStream& aReadStream) = 0; + virtual void DoUpdateL(const CLbsLogEvent& aSourceLogEvent) = 0; + virtual void DoCopyL(CLbsLogEvent*& aTargetLogEvent) const = 0; + virtual TInt DataSize() const = 0; +protected: + /** The size of the data from a TPositionInfo that is written to disk */ + const TInt iPosInfoWriteSize; + /** The Location Request Event Type */ + TUid iEventType; + /** The returned location information if the request is completed successfully */ + TPositionInfo* iPosInfo; + /** Data for BC consideration, and inherited by derived CLbsLog classes */ + TAny* iReservedData; + +private: + /** MO-LR (True) to R_LOG_DIR_OUT and MT-LR to R_LOG_DIR_IN */ + TBool iDirection; + /** The outcome of the request */ + TLbsRequestOutcome iRequestOutcome; + /** Flag which specifies if the cost information is available or not */ + TBool iCostInformationAvailable; + /** The cost information */ + TUint iCostInformation; + }; // class CLbsLogEvent + + +#endif // LBS_LOG_EVENT_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/LbsLogWriterEngine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/LbsLogWriterEngine.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,122 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + +/** + @file + @internalTechnology + @released +*/ + +#ifndef LBS_LOG_WRITER_ENGINE_H +#define LBS_LOG_WRITER_ENGINE_H + +#include +#include + +enum TLbsLogEventType +/** + enum for type of LbsLogging event handled by Lbs Logging Engine +*/ + { + ELbsLogNoEvent = 0, + ELbsLogAddEvent, + ELbsLogUpdateEvent + }; + + +typedef TUint32 TLbsLogWriterEventTypeGroup; + +enum TLbsLogWriterEventTypes + { + ELbsNoEventType = 0x00000000, + ELbsSelfLocateEventType = 0x00000001, + ELbsExternalLocateEventType = 0x00000002, + ELbsTransmitLocationEventType = 0x00000004, + ELbsNetworkLocateEventType = 0x00000008, + ELbsAssistanceDataEventType = 0x00000010 + }; + +class CLbsLogWriterEngine : public CActive +/** + Active class which does the logging of LBS events. When it receives a new event, + if it isn't processing anything it starts logging that event, otherwise it elaves it + on a waiting queue. + +*/ + { +public: + static CLbsLogWriterEngine* NewL(TUint aMaxBufferSize); + ~CLbsLogWriterEngine(); + + TInt AddEventL(CLbsLogEvent& aLogEvent); + TInt UpdateEventL(CLbsLogEvent& aLogEvent); + // Start to log the event request asyn + TInt StartAddingEventType(CLogEventType& aType); + +private: + CLbsLogWriterEngine(TUint aMaxBufferSize); + void ConstructL(); + + // Start to log the event request asyn + void StartLoggingEventL(CLbsLogEvent& aLogEvent); + void InitialiseLogEventTypeL(CLbsLogEvent& aLogEvent); + void AddLogEventToQueueL(CLbsLogEvent& aLogEvent); + +private: // from CActive + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + +private: + /** The maximum numer of events that can be queued */ + TUint iMaxBufferSize; + /** Flag indicating if there is an ID available of the last logged event */ + TBool iLastLogIdAvailable; + /** The ID of the last logged event */ + TLogId iLastLogId; + /** The array with the queued events */ + RPointerArray iLogEvents; + /** The array with the queued event types */ + RArray iLogEventTypes; + /** Current processing event type */ + TLbsLogEventType iLastLogEventType; + /** Bitmask listing which event types have already been added */ + TLbsLogWriterEventTypeGroup iInitLogEventTypes; + /** The event type currently being logged */ + CLogEventType* iEventTypeBeingLogged; + /** Flag indicating if an event type is currently being added */ + TBool iLogEventTypeInit; + /** The event that is being logged now */ + CLogEvent* iEventBeingLogged; + + /***/ + TBool iLoggingType; + /** Handle to the db file file sesstion */ + RFs iFs; + /** CLogClient handler */ + CLogClient* iClient; + + + +__DECLARE_TEST; // Declaration for the invariant + }; // class CLbsLogWriterEngine + +#endif // LBS_LOG_WRITER_ENGINE_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/LbsLogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/LbsLogger.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,75 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + +/** + @file +*/ + +#ifndef LBS_LOGGER_H +#define LBS_LOGGER_H + +#include +#include + +class CLbsLogWriterEngine; + +class RLbsLogger +/** + Class the provides the APIs for adding and updating LBS events into the LogEng. + In order to add (or update) any event, a handle must have been opened for this class + (so OpenL() must have been called, without calling Close() meanwhile on the class). + + Internally, the engine, queues the add and update requests until they can be processed. The + queue has a maximum size, so if too many items will get on the queue the AddEventL() method + can return an error. + + When the client finishes sending all the add and update requests, Close() should be + called on the class. This will ensure that the internal engine logs all the events it + queued into the LogEng. When calling Close() it will wait for LogEng to finish + logging all the events. + + @internalTechnology + @released +*/ + { +public: + IMPORT_C RLbsLogger(); + IMPORT_C ~RLbsLogger(); + + IMPORT_C TInt Open(TUint aMaxBufferSize); + IMPORT_C TInt AddEvent(CLbsLogEvent& aLogEvent); + IMPORT_C TInt UpdateEvent(CLbsLogEvent& aLogEvent); + IMPORT_C TInt Close(); + // for BC consideration + virtual void ExtensionInterfaceL(TUid aInterface, void*& aObject); + +private: + void CheckLoggingAdminSettings(); + +private: + /** Pointer to the active object which does the logging */ + CLbsLogWriterEngine* iLogWriterEngine; + + /** Flag to indicate if logging is currently On or Off, determined from the admin db setting. */ + TBool iLoggingOn; + }; // class RLbsLogger + +#endif // LBS_LOGGER_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/LbsLoggerDefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/LbsLoggerDefs.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,40 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + +/** + @file + @publishedPartner + @released +*/ + +#ifndef LBS_LOGGER_DEFS_H +#define LBS_LOGGER_DEFS_H + +_LIT(KLbsLoggerPanic, "LBS Logger:"); +_LIT(KLbsLogSelfLocateDes, "Location Requested from On Board Application"); +_LIT(KLbsLogExternalLocateDes, "Location Requested by Remote Party"); +_LIT(KLbsLogX3PLocateDes, "Location Sent to Remote Party"); +_LIT(KLbsLogNetworkLocateDes, "Location Determined by Network"); +_LIT(KLbsLogAssistanceDataDes, "Location Data Obtained from Network"); +_LIT(KLbsLogMOLR, "R_LOG_DIR_OUT_MOLR"); +_LIT(KLbsLogMTLR, "R_LOG_DIR_IN_MTLR"); + +#endif // LBS_LOGGER_DEFS_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/LbsNetworkLocateLogEvent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/LbsNetworkLocateLogEvent.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,61 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + +/** + @file + @publishedPartner + @released +*/ + +#ifndef LBS_NETWORK_LOCATE_LOG_EVENT_H +#define LBS_NETWORK_LOCATE_LOG_EVENT_H + +#include + +/** log event object for network locate request */ + +class CLbsNetworkLocateLogEvent : public CLbsLogEvent + { +public: + IMPORT_C static CLbsNetworkLocateLogEvent* NewL(TUid aUid, TPositionInfoBase* aPosInfo); + ~CLbsNetworkLocateLogEvent(); + // for self locate + IMPORT_C TUid LocalApp() const; + IMPORT_C void SetLocalApp(TUid aUid); + +protected: + void DoExternalizeL(RWriteStream& aWriteStream) const; + void DoInternalizeL(RReadStream& aReadStream); + void DoUpdateL(const CLbsLogEvent& aSourceLogEvent); + void DoCopyL(CLbsLogEvent*& aTargetLogEvent) const; + TInt DataSize() const; +private: + CLbsNetworkLocateLogEvent(); + void ConstructL(TUid aUid, TPositionInfoBase* aPosInfo); + +private: + /** The UID of local application request for the location information */ + TUid iLocalApp; + + }; // class CLbsNetworkLocateLogEvent + + +#endif // LBS_NETWORK_LOCATE_LOG_EVENT_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/LbsSelfLocateLogEvent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/LbsSelfLocateLogEvent.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,60 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + +/** + @file + @publishedPartner + @released +*/ + +#ifndef LBS_SELF_LOCATE_LOG_EVENT_H +#define LBS_SELF_LOCATE_LOG_EVENT_H + +#include + +/** log event object for self locate request */ + +class CLbsSelfLocateLogEvent : public CLbsLogEvent + { +public: + IMPORT_C static CLbsSelfLocateLogEvent* NewL(TUid aUid, TPositionInfoBase* aPosInfo); + ~CLbsSelfLocateLogEvent(); + // for self locate + IMPORT_C TUid LocalApp() const; + IMPORT_C void SetLocalApp(TUid aUid); + +protected: + void DoExternalizeL(RWriteStream& aWriteStream) const; + void DoInternalizeL(RReadStream& aReadStream); + void DoUpdateL(const CLbsLogEvent& aSourceLogEvent); + void DoCopyL(CLbsLogEvent*& aTargetLogEvent) const; + TInt DataSize() const; + +private: + CLbsSelfLocateLogEvent(); + void ConstructL(TUid aUid, TPositionInfoBase* aPosInfo); + +private: + /** The UID of local application request for the location information */ + TUid iLocalApp; + }; // class CLbsSelfLocateLogEvent + +#endif // LBS_SELF_LOCATE_LOG_EVENT_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/LbsTransmitLocationLogEvent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/LbsTransmitLocationLogEvent.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,63 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + +/** + @file + @publishedPartner + @released +*/ + +#ifndef LBS_TRANSMIT_LOCATION_LOG_EVENT_H +#define LBS_TRANSMIT_LOCATION_LOG_EVENT_H + +#include + +/** log event object for transmit to 3rd party locate request */ + +class CLbsTransmitLocationLogEvent : public CLbsLogEvent + { +public: + IMPORT_C static CLbsTransmitLocationLogEvent* NewL(TUid aUid, TPositionInfoBase* aPosInfo, TDesC& aDestination); + ~CLbsTransmitLocationLogEvent(); + // for X3P + IMPORT_C TUid X3PApp() const; + IMPORT_C void SetX3PApp(TUid aUid); + IMPORT_C void SetDestination(TDesC& aDestination); + IMPORT_C TDesC& Destination() const; + +protected: + void DoExternalizeL(RWriteStream& aWriteStream) const; + void DoInternalizeL(RReadStream& aReadStream); + void DoUpdateL(const CLbsLogEvent& aSourceLogEvent); + void DoCopyL(CLbsLogEvent*& aTargetLogEvent) const; + TInt DataSize() const; +private: + CLbsTransmitLocationLogEvent(); + void ConstructL(TUid aUid, TPositionInfoBase* aPosInfo, TDesC& aDestination); + +private: + /** The UID of 3rd party application request for the location information */ + TUid iX3PApp; + /** Descriptor of the destination application */ + TBuf<64> iDestination; + }; // class CLbsTransmitLocationLogEvent + +#endif // LBS_TRANSMIT_LOCATION_LOG_EVENT_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/argutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/argutils.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,548 @@ +/** +* 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 the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + +/** + @file argutils.h +*/ + +#ifndef __ARG_UTILS_H__ +#define __ARG_UTILS_H__ + +// LBS includes. +#include +#include +#include +#include +//------------------------------------------------------------------------------------------------- + +/** +Static utility functions to populate and instantiate arguments for function calls + +@internalComponent +@test +*/ + +const TInt KAlpha2Timeout = 12*1000*1000; +const TInt KTTimeout = 8*1000*1000; +const TInt KMOLRFixTime = 240*1000*1000; +const TInt KMinHorizontalAcc = 50.0; +const TInt KMinVerticalAcc = 1000.0; +const TInt KDefaultMaxFixTime = 130*1000*1000; + + +class ArgUtils + { +public: + inline static void PopulateLC(RLbsAssistanceDataBuilderSet& aData) + { + aData.OpenL(); + CleanupClosePushL(aData); + + // Access the Gps Reference Time which is the only data we support in this simple provider. + RUEPositioningGpsReferenceTimeBuilder* refTimeBuilder = NULL; + + aData.GetDataBuilder(refTimeBuilder); + if (refTimeBuilder) + { + const TUint KAssistanceData_RefTime_Week = 12; + const TUint KAssistanceData_RefTime_Tow1MSec = 567; + // Fill out the reference time items we support - note the builder set is already open. + refTimeBuilder->SetField(TUEPositioningGpsReferenceTime::EGpsWeek, KAssistanceData_RefTime_Week); + refTimeBuilder->SetField(TUEPositioningGpsReferenceTime::EGpsTow1Msec, KAssistanceData_RefTime_Tow1MSec); + + // Time stamp the data. + TTime timeStamp; + timeStamp.UniversalTime(); + + refTimeBuilder->SetTimeStamp(timeStamp); + } + } + + inline static TLbsNetPosRequestPrivacy Privacy() + { + TLbsNetPosRequestPrivacy privacy; + privacy.SetRequestAdvice(TLbsNetPosRequestPrivacy::ERequestAdviceNotify); + privacy.SetRequestAction(TLbsNetPosRequestPrivacy::ERequestActionAllow); + return privacy; + } + + inline static TLbsExternalRequestInfo RequestInfo() + { + TLbsExternalRequestInfo requestInfo; + requestInfo.SetRequesterId(_L8("+441234567891")); + requestInfo.SetClientName(_L8("THybridNWClient")); + requestInfo.SetClientExternalId(_L8("+441234567891")); + return requestInfo; + } + + inline static TPositionInfo PositionInfo() + { + TCoordinate coordinate(3.14159265359, 2.71828183); + TLocality locality(coordinate, 99.99, 99.99); + TTime time(101010101); + TPosition position(locality, time); + TPositionInfo positionInfo; + positionInfo.SetPosition(position); + return positionInfo; + } + + inline static TPositionInfo ReferencePositionInfo() + { + // General case: This will be less accurate than the GPS Position and the Hybrid Position. + TCoordinate coordinate(51.5,-0.096, 2.0); + TLocality locality(coordinate, 1000.0, 1000.0); + + // Setting time to current time + TTime time; + time.UniversalTime(); + TPosition position(locality, time); + + TPositionInfo positionInfo; + positionInfo.SetPosition(position); + positionInfo.SetUpdateType(EPositionUpdateGeneral); + positionInfo.SetPositionMode(TPositionModuleInfo::ETechnologyNetwork); + positionInfo.SetPositionModeReason(EPositionModeReasonNone); + return positionInfo; + } + + + inline static TPositionInfo MolrReferencePositionInfo() + { + // General case: This will be less accurate than the Reference Position and the Hybrid Position. + TCoordinate coordinate(3.14159265359, 2.71828183, 10.0); + TLocality locality(coordinate, 1000.0, 1000.0); + + // Setting time to current time + TTime time; + time.UniversalTime(); + TPosition position(locality, time); + + TPositionInfo positionInfo; + positionInfo.SetPosition(position); + positionInfo.SetUpdateType(EPositionUpdateGeneral); + positionInfo.SetPositionMode(TPositionModuleInfo::ETechnologyNetwork); + positionInfo.SetPositionModeReason(EPositionModeReasonNone); + return positionInfo; + } + + + inline static TPositionInfo HybridPositionInfo() + { + // General case: This will be more accurate than ReferencePosition + // but less accurate than the GPS position + TCoordinate coordinate(51.502,-0.1055, 1.0); + TLocality locality(coordinate, 200.0, 200.0); + + // Setting time to current time + TTime time; + time.UniversalTime(); + TPosition position(locality, time); + + TPositionInfo positionInfo; + positionInfo.SetPosition(position); + positionInfo.SetUpdateType(EPositionUpdateGeneral); + positionInfo.SetPositionMode(TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted); + positionInfo.SetPositionModeReason(EPositionModeReasonNone); + return positionInfo; + } + + + inline static TPositionInfo MolrHybridPositionInfo() + { + // General case: This will be more accurate than ReferencePosition + // but less accurate than the GPS position + TCoordinate coordinate(3.14159265359, 2.71828183); + TLocality locality(coordinate, 200.0, 200.0); + + // Setting time to current time + TTime time; + time.UniversalTime(); + TPosition position(locality, time); + + TPositionInfo positionInfo; + positionInfo.SetPosition(position); + positionInfo.SetUpdateType(EPositionUpdateGeneral); + positionInfo.SetPositionMode(TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted); + positionInfo.SetPositionModeReason(EPositionModeReasonNone); + return positionInfo; + } + + + inline static TPositionInfo NetworkPositionInfo() + { + // General case: This will be more accurate than ReferencePosition + // but less accurate than the GPS position + TCoordinate coordinate(51.502,-0.1055, 1.0); + TLocality locality(coordinate, 100.0, 100.0); + + // Setting time to current time + TTime time; + time.UniversalTime(); + TPosition position(locality, time); + + TPositionInfo positionInfo; + positionInfo.SetPosition(position); + positionInfo.SetUpdateType(EPositionUpdateGeneral); + positionInfo.SetPositionMode(TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted); + positionInfo.SetPositionModeReason(EPositionModeReasonNone); + return positionInfo; + } + + inline static TPositionInfo AccurateNetworkPositionInfo() + { + // General case: This will be more accurate than ReferencePosition + // but less accurate than the GPS position + TCoordinate coordinate(51.502,-0.1055, 1.0); + TLocality locality(coordinate, 10.0, 10.0); + + // Setting time to current time + TTime time; + time.UniversalTime(); + TPosition position(locality, time); + + TPositionInfo positionInfo; + positionInfo.SetPosition(position); + positionInfo.SetUpdateType(EPositionUpdateGeneral); + positionInfo.SetPositionMode(TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted); + positionInfo.SetPositionModeReason(EPositionModeReasonNone); + return positionInfo; + } + + inline static TPositionInfo MolrNetworkPositionInfo() + { + // General case: This will be more accurate than ReferencePosition + // but less accurate than the GPS position + TCoordinate coordinate(3.14159265359, 2.71828183); + TLocality locality(coordinate, 100.0, 100.0); + + // Setting time to current time + TTime time; + time.UniversalTime(); + TPosition position(locality, time); + + TPositionInfo positionInfo; + positionInfo.SetPosition(position); + positionInfo.SetUpdateType(EPositionUpdateGeneral); + positionInfo.SetPositionMode(TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted); + positionInfo.SetPositionModeReason(EPositionModeReasonNone); + return positionInfo; + } + + + inline static TLbsNetPosRequestQuality Quality() + { + TLbsNetPosRequestQuality quality; + quality.SetMaxFixTime(KTTimeout); + quality.SetMaxFixAge(0); + TRealX nan; + nan.SetNaN(); + quality.SetMinHorizontalAccuracy(nan); + quality.SetMinVerticalAccuracy(nan); + return quality; + } + + inline static TLbsNetPosRequestQuality QualityAlpha2() + { + TLbsNetPosRequestQuality quality; + quality.SetMaxFixTime(KAlpha2Timeout); + quality.SetMaxFixAge(0); + TRealX nan; + nan.SetNaN(); + quality.SetMinHorizontalAccuracy(nan); + quality.SetMinVerticalAccuracy(nan); + return quality; + } + + inline static TLbsNetPosRequestMethod RequestMethod() + { + TLbsNetPosRequestMethod method; + TLbsNetPosMethod method1; + TLbsNetPosMethod method2; + method1.SetPosMethod(KLbsPositioningMeansGps, TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted); + const TLbsNetPosMethod posMethods [] = + { + method1,method2 + }; + method.SetPosMethods(posMethods, 2); + return method; + } + + inline static TLbsNetPosRequestMethod RequestTerminalBasedMethod() + { + TLbsNetPosRequestMethod method; + TLbsNetPosMethod method1; + method1.SetPosMethod(KLbsPositioningMeansGps, TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted); + + const TLbsNetPosMethod posMethods [] = + { + method1 + }; + method.SetPosMethods(posMethods, 1); + return method; + } + + inline static TLbsNetPosRequestMethod RequestAutonomousMethod() + { + TLbsNetPosRequestMethod method; + TLbsNetPosMethod method1; + method1.SetPosMethod(KLbsPositioningMeansGps, TPositionModuleInfo::ETechnologyTerminal); + + const TLbsNetPosMethod posMethods [] = + { + method1 + }; + method.SetPosMethods(posMethods, 1); + return method; + } + + inline static TLbsNetPosRequestMethod RequestHybridMethod() + { + TLbsNetPosRequestMethod method; + TLbsNetPosMethod method1; + TLbsNetPosMethod method2; + method1.SetPosMethod(KLbsPositioningMeansGps, TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted); + method2.SetPosMethod(KLbsPositioningMeansGps, TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted); + + const TLbsNetPosMethod posMethods [] = + { + method1,method2 + }; + method.SetPosMethods(posMethods, 2); + return method; + } + + + inline static TLbsNetPosRequestMethod RequestTAPMethod() + { + TLbsNetPosRequestMethod method; + TLbsNetPosMethod method1; + method1.SetPosMethod(KLbsPositioningMeansGps, TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted); + + const TLbsNetPosMethod posMethods [] = + { + method1 + }; + method.SetPosMethods(posMethods, 1); + return method; + } + + inline static TLbsNetPosRequestMethod RequestTerminalAssistedAndTerminalBasedMethod() + { + TLbsNetPosRequestMethod method; + TLbsNetPosMethod method1; + TLbsNetPosMethod method2; + method1.SetPosMethod(KLbsPositioningMeansGps, TPositionModuleInfo::ETechnologyNetwork | TPositionModuleInfo::ETechnologyAssisted); + method2.SetPosMethod(KLbsPositioningMeansGps, TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted); + + const TLbsNetPosMethod posMethods [] = + { + method1,method2 + }; + method.SetPosMethods(posMethods, 2); + return method; + } + + inline static TLbsNetPosRequestMethod RequestUnspecifiedMethod() + { + TLbsNetPosRequestMethod method; + TLbsNetPosMethod method1; + method1.SetPosMethod(KLbsPositioningMeansGps, TPositionModuleInfo::ETechnologyUnknown); + + const TLbsNetPosMethod posMethods [] = + { + method1 + }; + method.SetPosMethods(posMethods, 1); + return method; + } + + inline static TInt Alpha2() + { + return KAlpha2Timeout; + } + + inline static TBool CompareQuality(TLbsNetPosRequestOptionsAssistance* aOpts, + TBool aIsclientConnected, + TInt aHorizontalAccuracy, + TInt aVerticalAccuracy, + TInt aMaxFixTime, + TInt aMaxFixAge, + TLbsAssistanceDataItem aDataMask, + TPositionModuleInfo::TTechnologyType aTechnologyType + ) + { + TLbsNetPosRequestQuality quality; + aOpts->GetRequestQuality(quality); + + if(aIsclientConnected != aOpts->NewClientConnected()) + { + return EFalse; + } + + if(quality.MinHorizontalAccuracy() != aHorizontalAccuracy) + { + return EFalse; + } + + if(quality.MinVerticalAccuracy() != aVerticalAccuracy) + { + return EFalse; + } + + if(quality.MaxFixTime() != aMaxFixTime) + { + return EFalse; + } + + if(quality.MaxFixAge() != aMaxFixAge) + { + return EFalse; + } + + if(aOpts->DataRequestMask() != aDataMask) + { + return EFalse; + } + + if(aOpts->PosMode() != aTechnologyType) + { + return EFalse; + } + + return ETrue; + } + + + inline static TBool ComparePositionInfoToReference(const TPositionInfo aPosInfoA) + { + TPositionInfo refPosInfo = ReferencePositionInfo(); + + TPosition posA; + TPosition posR; + aPosInfoA.GetPosition(posA); + refPosInfo.GetPosition(posR); + + if(posA.HorizontalAccuracy() != posR.HorizontalAccuracy()) + { + return EFalse; + } + + if(posA.VerticalAccuracy() != posR.VerticalAccuracy()) + { + return EFalse; + } + + if(posA.Latitude() != posR.Latitude()) + { + return EFalse; + } + + if(posA.Longitude() != posR.Longitude()) + { + return EFalse; + } + + if(posA.Altitude() != posR.Altitude()) + { + return EFalse; + } + + return ETrue; + } + + + + inline static TBool ComparePositionInfoToMolrRefPos(const TPositionInfo aPosInfoA) + { + TPositionInfo refPosInfo = MolrReferencePositionInfo(); + + TPosition posA; + TPosition posR; + aPosInfoA.GetPosition(posA); + refPosInfo.GetPosition(posR); + + if(posA.HorizontalAccuracy() != posR.HorizontalAccuracy()) + { + return EFalse; + } + + if(posA.VerticalAccuracy() != posR.VerticalAccuracy()) + { + return EFalse; + } + + if(posA.Latitude() != posR.Latitude()) + { + return EFalse; + } + + if(posA.Longitude() != posR.Longitude()) + { + return EFalse; + } + + if(posA.Altitude() != posR.Altitude()) + { + return EFalse; + } + + return ETrue; + } + + inline static TBool ComparePositionInfoToNan(const TPositionInfo aPosInfoA) + { + TPosition pos; + aPosInfoA.GetPosition(pos); + + if(!Math::IsNaN(pos.HorizontalAccuracy())) + { + return EFalse; + } + + if(!Math::IsNaN(pos.VerticalAccuracy())) + { + return EFalse; + } + + if(!Math::IsNaN(pos.Latitude())) + { + return EFalse; + } + + if(!Math::IsNaN(pos.Longitude())) + { + return EFalse; + } + + if(!Math::IsNaN(pos.Altitude())) + { + return EFalse; + } + + return ETrue; + + } + + }; + +//------------------------------------------------------------------------------------------------- + +#endif //__ARG_UTILS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsclientlog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsclientlog.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_LOG_H__ +#define __CT_LBS_CLIENT_LOG_H__ + +// INCLUDES +#include +#include "TestExecuteStepBase.h" + +// CONSTANTS + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Implements the CLbsLog interface, and puts log entries in TEF log. +*/ +class CT_LbsClientLog : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + IMPORT_C static CT_LbsClientLog* NewL(CTestExecuteLogger& aLogger); + + /** + * Two-phased constructor. + */ + IMPORT_C static CT_LbsClientLog* NewLC(CTestExecuteLogger& aLogger); + + /** + * Destructor. + */ + virtual ~CT_LbsClientLog(); + + public: // New functions + + void SetLogger(CTestExecuteLogger& aLogger){ iLogger = aLogger; }; + CTestExecuteLogger& Logger() {return iLogger;}; + + public: // Functions from base classes + + /** + * Add a line to the log file. + * @param aLine The line of text to append. + */ + void Put(const TDesC& aLine); + + /** + * Add an error line to the log file. + * @param aLine The error line of text to append. + */ + void PutError(const TDesC& aLine); + + private: + + /** + * C++ default constructor. + */ + CT_LbsClientLog(); + + /** + * By default EPOC constructor is private. + */ + void ConstructL(CTestExecuteLogger& aLogger); + + // By default, prohibit copy constructor + CT_LbsClientLog( const CT_LbsClientLog& ); + // Prohibit assigment operator + CT_LbsClientLog& operator= ( const CT_LbsClientLog& ); + + private: // Data + CTestExecuteLogger iLogger; + }; + +#endif // __CT_LBS_CLIENT_LOG_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsclientrequestor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsclientrequestor.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_REQUESTOR_H__ +#define __CT_LBS_CLIENT_REQUESTOR_H__ + +// INCLUDES +#include +#include +#include +#include +#include +#include + + +// CONSTANTS +const TInt KNoEvent = 42; + +// FORWARD DECLARATIONS +class MCT_LbsRequestObserver; + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +*/ +class CT_LbsClientRequestor : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @return A new instance of this class. + */ + static CT_LbsClientRequestor* NewL( + /* IN */ TUid aPsyUid, + /* IN */ MCT_LbsRequestObserver* aObserver, + /* IN */ const TDesC& aClientName, + CTestExecuteLogger& aLogger + ); + + /** + * Destructor. + */ + virtual ~CT_LbsClientRequestor(); + + protected: + + /** + * C++ default constructor. + */ + CT_LbsClientRequestor( + /* IN */ MCT_LbsRequestObserver* aObserver, + TUid aPsyUid + ); + + /** + * By default EPOC constructor is private. + */ + void ConstructL(const TDesC& aClientName, CTestExecuteLogger& aLogger); + + public: // New functions + + const TTime& CompletionTimeUTC() const; + + TInt CompletionCode() const; + + void ResetCompletionCode(); + + /** + * Performs a request to iPsy. Notifies iObserver when request is complete + */ + void StartRequestL(TBool aDefaultPsy); + + void RequestModuleStatusEvent(); + + TInt ReadModuleStatusEvent(); + + void ContinueRequesting(); + + void ClosePositioner(); + + TBool ReadModuleStatusModulesApi(CPosModules* aDb, TPositionModuleId aModuleId); + + TInt ReadModuleStatusClientApi(TPositionModuleId aModuleId); + + void CancelModuleStatusEvent(); + + public: // Functions from base classes + + void RunL(); + + void DoCancel(); + + protected: // New functions + + void RequestComplete(); + + private: + + // By default, prohibit copy constructor + CT_LbsClientRequestor( const CT_LbsClientRequestor& ); + // Prohibit assigment operator + CT_LbsClientRequestor& operator= ( const CT_LbsClientRequestor& ); + + // Logger interface used for constructing result strings to be fed for the logger instance + inline CTestExecuteLogger& Logger() {return iLogger;}; + + private: // Data + + RPositionServer iPosServer; + RPositioner iPositioner; + TBuf<100> iName; + + MCT_LbsRequestObserver* iObserver; + TTime iCompletionTimeUTC; + TInt iCompletionCode; + TRequestStatus iRequestStatus; + TPositionInfo iModuleInfo; + TUid iPsyUid; + TPositionModuleStatusEvent istatusEvent; + TBool iContinueEventRequesting; + + CTestExecuteLogger iLogger; + }; + +#endif // __CT_LBS_CLIENT_REQUESTOR_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsdoposupdate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsdoposupdate.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,83 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + +/** + @file ctlbsdoposupd.h +*/ +#ifndef __CT_LBS_DOPOS_UPDATE_H__ +#define __CT_LBS_DOPOS_UPDATE_H__ + +#include +#include + + +_LIT(KCT_LbsDoPosUpdate, "CT_LbsDoPosUpdate"); + + +// Async callbacks +class MT_LbsDoPosUpdateObserver + { +public: + virtual void MT_LbsDoPosUpdateCallback(TRequestStatus& aStatus) = 0; // do we need the aStatus... + }; + + +class CT_LbsDoPosUpdate: public CActive + { +public: + ~CT_LbsDoPosUpdate(); + static CT_LbsDoPosUpdate* NewL(MT_LbsDoPosUpdateObserver* aObserver, TPositionModuleInfo::TTechnologyType aTechnologyType = TPositionModuleInfo::ETechnologyUnknown); + static CT_LbsDoPosUpdate* NewL(MT_LbsDoPosUpdateObserver* aObserver, const TPositionCriteriaBase& aCriteria); + TInt SetOptions(const TPositionUpdateOptionsBase& aPosOption); + void StartL(TPositionInfo& aPosInfo); + void CancelRequest(); + void OpenPositioner(TPositionModuleInfo::TTechnologyType aTechnologyType = TPositionModuleInfo::ETechnologyUnknown); + void ClosePositioner(void); + void ConnectServer(void); + void CloseServer(void); + TInt CompleteRequest(TInt aRequestId); + +protected: + // Functions from CActive: + virtual void DoCancel(); + virtual void RunL(); + virtual TInt RunError(TInt aError); + +private: + enum TOpenSubSessionType + { + EOpenSubSessionByModuleId, //Open subsession with the location server by module id + EOpenSubSessionByCriteria //Open subsession with the location server by criteria + }; + + CT_LbsDoPosUpdate(MT_LbsDoPosUpdateObserver* aObserver); + + void CT_LbsDoPosUpdate::ConstructL(TOpenSubSessionType aOpenSubSessionType,TPositionModuleInfo::TTechnologyType aTechnologyType, const TPositionCriteriaBase& aCriteria); + + // caller + MT_LbsDoPosUpdateObserver* iObserver; + + // Self locate server. + RPositionServer iServer; + RPositioner iPositioner; + }; + +#endif // __CT_LBS_DOPOS_UPDATE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsdox3p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsdox3p.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,77 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + +/** + @file ctlbsdox3p.h +*/ + +#ifndef __CT_LBS_DO_X3P_H__ +#define __CT_LBS_DO_X3P_H__ + + +#include +#include +#include + + +//class CT_LbsX3PDoTransmitPos; +_LIT(KCT_LbsDoX3P, "CT_LbsDoX3P"); + +// Async callbacks +class MT_LbsDoX3PObserver + { +public: + virtual void MT_LbsDoX3PCallback(TInt aTransmitId, TRequestStatus& aStatus) = 0; + }; + + +class CT_LbsDoX3P: public CActive + { +public: + ~CT_LbsDoX3P(); + static CT_LbsDoX3P* NewL(MT_LbsDoX3PObserver* aObserver, TInt aTransmitId = 0); + + TInt SetOptions(const TLbsTransmitPositionOptions& aTransmitOptions); + + void StartL(const TDesC& aDestinationID, TUint aTransmitPriority, TPositionInfo & aTransmittedPosInfo); + +protected: + // Functions from CActive: + virtual void DoCancel(); + virtual void RunL(); + virtual TInt RunError(TInt aError); + +private: + CT_LbsDoX3P(MT_LbsDoX3PObserver* aObserver, TInt aTransmitId); + void CT_LbsDoX3P::ConstructL(); + + // Caller. + MT_LbsDoX3PObserver* iObserver; + + // Transmit server. + RLbsTransmitPositionServer iServer; + RLbsTransmitPosition iTransmitter; + + // Id to allow multiple X3P to be carried out. + TInt iTransmitId; + }; + +#endif // __CT_LBS_DO_X3P_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsnetsimstep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsnetsimstep.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,177 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsNetsimstep.h +// This contains the header file for LBS Net Sim Test Step Base +// +// + +#ifndef __CT_LBS_NET_SIM_STEP_H__ +#define __CT_LBS_NET_SIM_STEP_H__ + +// EPOC includes. +#include + +// LBS test includes. +#include +#include + +#include "ctlbstimerutils.h" + + +const TInt KLbsKeepAlivePeriod = 10000; + +const TInt KKeepAliveTimerId = 0; +const TInt KAbortTimerId = 34; + +/** Callback flags held as bits in a 32 bit word. +*/ +typedef TUint32 TLbsCallbackFlags; + +const TLbsCallbackFlags KLbsCallback_None = 0x0000; + +const TLbsCallbackFlags KLbsCallback_NetSim_Got_Connect = 0x0001; +const TLbsCallbackFlags KLbsCallback_NetSim_Got_Disconnect = 0x0002; +const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr = 0x0004; +const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr = 0x0008; +const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation = 0x0010; +const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyReleaseLcsLocationNotification = 0x0020; +const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult = 0x0040; +const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation = 0x0080; +const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData = 0x0100; +const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyMeasurementReportControlFailure = 0x0200; +const TLbsCallbackFlags KLbsCallback_NetSim_Got_NotifyError = 0x0400; +const TLbsCallbackFlags KLbsCallback_NetSim_Got_ProcessMeasurementControlLocationError = 0x0800; + +// NOTE: Derived test case will assume that they create new flags starting at 0x1000. If you add additional +// flags here, the derived test cases will have to be updated also. + +const TLbsCallbackFlags KLbsCallback_MoLr = + KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr | // --> NET + KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation | // <-- NET + KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation | // --> NET + KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult | // <-- NET + KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr; // --> NET + +//const TLbsCallbackFlags KLbsCallback_NetworkBasedLocation = +// KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr | // --> NET +// KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation | // <-- NET +// KLbsCallback_NetSim_Got_NotifyMeasurementReportControlFailure | // --> NET + +// KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr; // --> NET + +const TLbsCallbackFlags KLbsCallback_NetworkBasedLocation = + KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr | // --> NET + KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation | // <-- NET + KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation | // --> NET + KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult | // <-- NET + KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr; // --> NET + +const TLbsCallbackFlags KLbsCallback_MtLr = + // note: we get no notification of the + KLbsCallback_NetSim_Got_NotifyReleaseLcsLocationNotification | // response to privacy request + KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation | // location request + KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation; + + +class CT_LbsNetSimStep : public CTestStep, + public MT_LbsTimerUtilsObserver, + public MLbsNetSimTestObserver +{ + +public: + + virtual ~CT_LbsNetSimStep(); + + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepPostambleL(); + + + // From MLbsNetSimTestObserver. + virtual void Connected(); + virtual void Disconnected(); + virtual void NotifyRegisterLcsMoLr(const TDesC& aData); + virtual void NotifyReleaseLcsMoLr(TInt aReason); + virtual void NotifyMeasurementControlLocation(const TPositionInfo& aPosition, const RLbsAssistanceDataBuilderSet& aData, const TLbsNetPosRequestQuality& aQuality); + virtual void NotifyReleaseLcsLocationNotification(const CLbsNetworkProtocolBase::TLbsPrivacyResponse& aResult); + virtual void NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition); + virtual void NotifyMeasurementReportLocation(const TPositionInfo& aPosition); + virtual void NotifyMeasurementReportRequestMoreAssistanceData(const TLbsAssistanceDataGroup& aFilter); + virtual void NotifyMeasurementReportControlFailure(TInt aReason); + virtual void NotifyError(MLbsNetSimTestObserver::EFunction aFunction, int aError); + virtual void ProcessMeasurementControlLocationError(TInt aError); + +protected: + + CT_LbsNetSimStep(); + + /** If aHaltTimerInterval is set, the test will continue for this period of time after all halt flags have been set + */ + void ConstructL(TTimeIntervalMicroSeconds32 aHaltTimerInterval = 0); + + /** Can be used to set the extended timer interval if not known at construct time + */ + void SetExtendedTimerInterval(TTimeIntervalMicroSeconds32 aHaltTimerInterval); + + void SetCallbackFlag(TLbsCallbackFlags aCallbackFlag); + TBool TestCallbackFlags(TLbsCallbackFlags aExpectedFlags); + + + // From MT_LbsTimerUtilsObserver - keep alive timer to ensure we recvice all callbacks. + virtual void HandleTimerL(TInt aTimerId, const TTime& aTargetTime); + + + enum { EConnecting = 0, /** Waiting for the Net Sim to connect to the protocol module. */ + EWaiting, /** Waiting for all the callbacks to be fired. */ + EExtendedWaiting, /** Waiting for extended timer to fire */ + EAborted, /** Abort timer has fired before all callbacks fired */ + EDone, /** All the correct callbacks have been fired (and extended timer, if any, has fired), the test can end. */ + ELast}; /** Used to allow extension of enums in derived classes - do not use! */ + + /** State machine variable for the test step. + */ + TInt iState; + + + /** Used to keep a record off all the callback events. + */ + TLbsCallbackFlags iCallbackFlags; + + + /** Expected callback flags at test end. + */ + TLbsCallbackFlags iFlagsToHaltOn; + + /** If this is non-zero, the test will continue for this period of time after all halt flags have been set + */ + TTimeIntervalMicroSeconds32 iExtendedTimerInterval; + + /** Network Simulator, to allow MT-LRs and to monitor network messages. + */ + RLbsNetSimTest iNetSim; + + + /** Timer used to ensure the test step keeps processing until all the required callbacks + have been called. Otherwise we would execute the test step calls and return from the + doTestStepL function and miss the callbacks being fired. + */ + CT_LbsTimerUtils* iKeepAliveTimer; + + /** Timer used to abort the test step if all callbacks have not fired. Individual test cases can start this time with appropriate time. + + */ + CT_LbsTimerUtils* iAbortTimer; + +}; + +#endif // __CT_LBS_STEP_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsportedstepbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsportedstepbase.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,340 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsportedstepbase.h +// +// + +#ifndef __CT_LBS_PORTED_STEP_BASE_H__ +#define __CT_LBS_PORTED_STEP_BASE_H__ + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +// CONSTANTS +enum TPosSetupPsyDirective + { + EPosDisableTheRest = 0 + }; + +// UID:s for PSY:s +const TInt32 KUidExternalGps = 0x101f7a7d; +const TInt32 KUidManualInput = 0x101f7a7e; +const TInt32 KUidDefault = 0x101f7a7f; +const TInt32 KUidStrategy = 0x101f7a80; +const TInt32 KUidSimulationPsy = 0x101f7a81; +const TInt32 KUidStubPositioner = 0x01000019; +const TInt32 KUidDynDbTestPsy = 0x01000016; +const TInt32 KUidInstallTestPsy = 0x01000015; +const TInt32 KUidTestPsySimulateIsa = 0x01000018; +const TInt32 KUidTestPsy1 = 0x01000001; +const TInt32 KUidTestPsy2 = 0x01000002; +const TInt32 KUidTestPsy3 = 0x01000003; +const TInt32 KUidTestPsy4 = 0x01000004; +const TInt32 KUidTestPsy5 = 0x01000005; +const TInt32 KUidTestPsy6 = 0x01000006; +const TInt32 KUidTestPsy7 = 0x01000007; +const TInt32 KUidTestPsy8 = 0x01000008; +const TInt32 KUidTestPsy9 = 0x01000009; +const TInt32 KUidTestPsy10 = 0x01000010; +const TInt32 KUidTestPsy11 = 0x01000011; +const TInt32 KUidTestPsy12 = 0x01000012; +const TInt32 KUidTestPsy13 = 0x01000013; +const TInt32 KUidTestPsy256 = 0x01000017; +const TInt32 KUidTestPsyTp176 = 0x01000176; +const TInt32 KUidMultiPsy = 0x01010176; +const TInt32 KUidTestStatusPsy = 0x01000191; +const TInt32 KUidTestTimerPsy = 0x01000192; +const TInt32 KUidExamplePsy = 0x10001234; // TBD not impl UID +const TInt32 KUidPanicPsy = 0x01010210; +const TInt32 KUidTestPsyPartialUpdate = 0x01000021; +const TInt32 KUidPsySwitching = 0x00000000; // TBD fill in when there ever is a switching psy +const TInt32 KUidTestPsyMaxAge = 0x01000020; +const TInt32 KUidTestRangePsy = 0x01000022; +const TInt32 KUidTestSingPsy = 0x01f0ff23; +const TInt32 KUidTestTrackingPsy = 0x01f0ff24; + +const TInt32 KTestProxyPsy1 = 0x01f0e001; +const TInt32 KTestProxyPsy2 = 0x01f0e002; +const TInt32 KTestProxyPsy3 = 0x01f0e003; +const TInt32 KTestProxyPsy4 = 0x01f0e004; + +const TInt32 KInstallPsyTp273 = 0x01f0e005; + +const TInt32 KUidTestPsyPartialUpdate2 = 0x01000023; +const TInt32 KUidSatInfoPsy = 0x01010177; + +const TInt32 KUidBtgPsy = 0x101FE999; +const TInt32 KUidIgPsy = 0x101FE999; + +const TInt KEspectedErrorCodePSY1 = KErrNone; +const TInt KEspectedErrorCodePSY2 = KPositionPartialUpdate; +const TInt KEspectedErrorCodePSY3 = KErrPositionBufferOverflow; +const TInt KEspectedErrorCodePSY4 = KErrNone; + +// Central repository constants for Default Proxy. +const TUid KCRUidDefaultProxyConfiguration = { 0x101f7a7f }; +const TUint32 KDefaultProxyLastWorkingGpsPsy = 0x10000001; + + +// CLASS DECLARATION +class CT_LbsClientLog; + +/**************************************************************************** +* The reason to have a new step base is that it is very much possible +* that the all individual test steps have project related common variables +* and members +* and this is the place to define these common variable and members. +* +****************************************************************************/ +class CT_LbsPortedStepBase : public CT_LbsStep + { +public: + virtual ~CT_LbsPortedStepBase(); + CT_LbsPortedStepBase(CT_LbsServer& aParent); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + virtual TVerdict doTestStepPostambleL(); + +//Please add your class members which will be common to all individual test steps: +protected: + HBufC8* iReadData; + HBufC8* iWriteData; + +public: // New functions + + /** + * Starts the test + */ + virtual void StartL() = 0; + +public: // Functions from base classes + + /** + * Runs the test in the module + * @param aIndex Indicates which internal test to run. + */ + void StartL(TInt aIndex); + +protected: // New functions + + /** + * Setup privacy and notification override settings + * @param aPsyName the name of the psy + * @param aDirective how to setup the PSY:s + * Enum def in this file. + */ + void SetupPsyL(const TUid aPsyUid, + TPosSetupPsyDirective aDirective = EPosDisableTheRest); + + /** + * Initialises the test. + * By default does nothing. + */ + virtual void InitTestL(); + + /** + * Cleans up after a test. + * Always called, even if the test leaves. + * By default does nothing. + */ + virtual void CloseTest(); + + /** + * Connect to epos server. + */ + void ConnectL(); + + /** + * Open a PSY by name. + */ + TInt OpenPositionerByName(const TUid aPsyUid); + + /** + * Open default PSY. + */ + TInt OpenPositioner(); + + /** + * Close PSY by calling "iPositioner.Close()" + */ + void ClosePositioner(); + + /** + * Close connection with epos server. + */ + void Disconnect(); + + /** + * Perform a request to epos. + * Use this methods when requesting from + * both a service and another requestor source, ie a Contact + */ + void PerformRequestL(const TDesC& aService, + const TDesC& aContact, + CRequestor::_TRequestorType aServiceIdType, + CRequestor::_TRequestorType aContactIdType, + // Set default values + CRequestor::_TRequestorFormat aServiceFormat = CRequestor::EFormatApplication, + CRequestor::_TRequestorFormat aContactFormat = CRequestor::EFormatTelephone + ); + + /** + * Perform a request to epos. + */ + void PerformRequestL(const TDesC& aRequestor, + CRequestor::_TRequestorType aRequestorType, + CRequestor::_TRequestorFormat aRequestorFormat); + + /** + * Perform a synchronous request to epos and return errorcode. + * Position info is returned in OUT parameter + */ + TInt PerformSyncRequest(const TDesC& aServiceName, + /* OUT */TPositionInfoBase* aModuleInfo); + + /** + * Check the result of a request to epos. + * Leaves if the error code is not the expected one. + * The log file is used to print the result from the request + */ + void CheckRequestResultL(TInt aExpectedErrorCode, TBool aLogFlag = ETrue); + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode); + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueL(TBool aCondition, const TDesC& aErrorMsg); + + /** + * Get the last updated position info from positioner + * Uses GetLastKnownPosition() method. + * @return position info. + */ + TPositionInfo AllocPositionInfoL(); + + /** + * Verifies that a PSY has been loaded by getting its last reported status. + * Requires that the PSY report active in its constructor. + * @param aUid the PSYs Uid + */ + void VerifyPsyLoadedL(TPositionModuleId aUid); + + /** + * Verifies that a PSY has been unloaded by getting its last reported status. + * Requires that the PSY report inactive in its destructor. + * @param aUid the PSYs Uid + */ + void VerifyPsyUnloadedL(TPositionModuleId aUid); + + /** + * Request a position from the default psy + */ + void RequestL(TPositionInfo& aPosInfo, const TInt& aRequestIndex, + const TInt& aExpectedErrorCode = 999); + + void LogErrorAndLeaveL(const TDesC& aErrorInfo, + const TInt aReason = KErrGeneral); + + void SetSimDataFileL(const TDesC& aFileName); + + void ResetDefaultPSYLastWorkingExtGPSPSYL(); + + void VerifyPositionFromL(TPositionInfo& aPosInfo, TPositionModuleId& aModuleId); + + void VerifyPositionL(TPositionInfo& aPosInfo, TReal64 aLat, + TReal64 aLong, TReal64 aAlt); + + void VerifyRequestTimeLessThanL(TInt aExpectedReqTime); + + void ConstructL(); + +protected: // Data + + TInt iNrOfRequests; + TInt iRequestTime; + + TInt iModuleId; + TUid iUidExternalGps; + TUid iUidManualInput; + TUid iUidDefault; + TUid iUidStrategy; + TUid iUidSimulationPsy; + TUid iUidStubPositioner; + TUid iUidDynDbTestPsy; + TUid iUidInstallTestPsy; + TUid iUidTestPsySimulateIsa; + TUid iUidTestPsy1; + TUid iUidTestPsy2; + TUid iUidTestPsy3; + TUid iUidTestPsy4; + TUid iUidTestPsy5; + TUid iUidTestPsy6; + TUid iUidTestPsy7; + TUid iUidTestPsy8; + TUid iUidTestPsy9; + TUid iUidTestPsy10; + TUid iUidTestPsy11; + TUid iUidTestPsy12; + TUid iUidTestPsy13; + TUid iUidTestPsy256; + TUid iUidTestPsyTp176; + TUid iUidMultiPsy; + TUid iUidExamplePsy; + TUid iUidTestStatusPsy; + TUid iUidTestTimerPsy; + TUid iUidPsySwitching; + TUid iUidPanicPsy; + TUid iUidTestPsyPartialUpdate; + TUid iUidTestPsyMaxAge; + TUid iUidTestRangePsy; + TUid iUidTestSingPsy; + TUid iUidTestTrackingPsy; + TUid iUidTestProxyPsy1; + TUid iUidTestProxyPsy2; + TUid iUidTestProxyPsy3; + TUid iUidTestProxyPsy4; + TUid iUidInstallPsyTp273; + TUid iUidPartialUpdate2; + TUid iUidSatInfoPsy; + TUid iUidBtgPsy; + TUid iUidIgPsy; + RPositionServer iPosServer; + RPositioner iPositioner; + + CActiveScheduler* iScheduler; + TBool iErrors; + RFs iFileServer; + + CT_LbsClientLog* iLog; + +private: // Data + + TRequestStatus iStatus; + TPositionInfo iModuleInfo; + }; + +#endif // __CT_LBS_PORTED_STEP_BASE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsportedsuitedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsportedsuitedefs.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_PORTED_SUITEDEFS_H__ +#define __CT_LBS_CLIENT_PORTED_SUITEDEFS_H__ + +// Please modify below value with your project and must match with your configuration ini file which is required to be modified as well +_LIT(KTe_LbsPortedSuiteString,"TheString"); +_LIT(KTe_LbsPortedSuiteInt,"TheInt"); +_LIT(KTe_LbsPortedSuiteBool,"TheBool"); + +// For test step panics +_LIT(KTe_LbsPortedSuitePanic,"Te_LbsPortedSuite"); + +#endif //__CT_LBS_CLIENT_PORTED_SUITEDEFS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsposclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsposclient.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_POS_CLIENT_H__ +#define __CT_LBS_POS_CLIENT_H__ + +// INCLUDES +#include +#include +#include + +// CONSTANTS + +// FUNCTION TYPES + +// FORWARD DECLARATIONS +class CPositioner; +class CT_LbsPosClientHolder; + +// CLASS DECLARATION + +/** +* Active object used to make position requests +* +*/ +class CT_LbsPosClient : public CActive + { + public: // Constructors and destructor + + static CT_LbsPosClient* NewL(CT_LbsPosClientHolder* aParent, TUid aPsy); + + static CT_LbsPosClient* NewL(CT_LbsPosClientHolder* aParent, TUid aPsy, RPositionServer& aPositionServer); + + /** + * Destructor. + */ + ~CT_LbsPosClient(); + + private: + + /** + * C++ default constructor. + */ + CT_LbsPosClient(CT_LbsPosClientHolder* aParent); + + void ConstructL(TUid aPsy); + + void ConstructL(TUid aPsy, RPositionServer& aPositionServer); + + public: // Functions from base classes + + /** + * Starts a position request + */ + void MakeRequest(); + + /** + * Get result + */ + void GetResult( + TInt& aStatus, + TPositionInfo& aModuleInfo, + TTimeIntervalMicroSeconds& aRequestTime + ); + + private: + + void RunL(); + + void DoCancel(); + + private: + RPositioner iPositioner; + RPositionServer iPosServer; + TBool iSameClient; + TPositionInfo iModuleInfo; + TTime iStartTime; + TTimeIntervalMicroSeconds iRequestTime; + CT_LbsPosClientHolder* iParent; + }; + +#endif // __CT_LBS_POS_CLIENT_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsposclientholder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsposclientholder.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,112 @@ +/* +* Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_HOLDER_H__ +#define __CT_LBS_CLIENT_POS_HOLDER_H__ + +// INCLUDES +#include +#include "ctlbsportedstepbase.h" + +// CONSTANTS + +// FUNCTION TYPES + +// FORWARD DECLARATIONS +class CPositionInfo; +class CPositioner; +class CT_LbsPosClient; + +// CLASS DECLARATION + +/** +* Active object used to make position requests +* +*/ +class CT_LbsPosClientHolder : public CActive + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + static CT_LbsPosClientHolder* NewLC( + TInt aRequestCount = 1, TUid aPsy = TUid::Uid(KUidDynDbTestPsy), TBool aSameServer = EFalse); + + /** + * Destructor. + */ + ~CT_LbsPosClientHolder(); + + private: + + void ConstructL(TInt aRequestCount, TUid aPsy, TBool aSameServer); + + /** + * C++ default constructor. + */ + CT_LbsPosClientHolder(); + + public: // Functions from base classes + + /** + * Starts a position request + */ + void MakeRequests(); + + void StopRequests(); + + void SetCancelTime(TTimeIntervalMicroSeconds32 aTimeInterval); + + /** + * Get result + */ + void GetResult( + TInt& aStatus, + TPositionInfo& aModuleInfo, + TTimeIntervalMicroSeconds& aRequestTime, + TInt aRequesterIndex = 0 + ); + + void HandleRequestDone(); + + void SetRequesterWillCancelL( + TInt aIndex = 0 + ); + + protected: + + void RunL(); + + void DoCancel(); + + private: + + RPointerArray iRequesters; + RPositionServer iPosServer; + TInt iNofRequestsDone; + RTimer iTimer; + RArray iRequestersWhoWillCancel; + TBool iRequestsActive; + TTimeIntervalMicroSeconds32 iCancelTime; + }; + +#endif // __CT_LBS_CLIENT_POS_HOLDER_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsrequester.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsrequester.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_REQUESTER_H__ +#define __CT_LBS_REQUESTER_H__ + +// INCLUDES +#include +#include +#include + +// CONSTANTS + +// FORWARD DECLARATIONS +class MCT_LbsRequestObserver; + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +*/ +class CT_LbsRequester : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @return A new instance of this class. + */ + static CT_LbsRequester* NewL( + /* IN */ TUid aPsyUid, + /* IN */ MCT_LbsRequestObserver* aObserver, + CTestExecuteLogger& aLogger + ); + + /** + * Two-phased constructor. + * @return A new instance of this class. + */ + static CT_LbsRequester* NewL( + /* IN */ MCT_LbsRequestObserver* aObserver, + /* IN */ TTimeIntervalMicroSeconds aInterval, + CTestExecuteLogger& aLogger + ); + + /** + * Destructor. + */ + virtual ~CT_LbsRequester(); + + protected: + + /** + * C++ default constructor. + */ + CT_LbsRequester( + /* IN */ MCT_LbsRequestObserver* aObserver + ); + + /** + * By default EPOC constructor is private. + */ + void ConstructL(TUid aPsyUid, CTestExecuteLogger& aLogger); + + /** + * By default EPOC constructor is private. + */ + void ConstructL(TTimeIntervalMicroSeconds aInterval, CTestExecuteLogger& aLogger); + + public: // New functions + + const TTime& CompletionTimeUTC() const; + TInt CompletionCode() const; + void GetPositionInfo( + TPositionInfo& aModuleInfo + ); + + /** + * Set Requestorstack + */ + TInt SetRequestorStackL(const TDesC& aService, const TDesC& aContact); + + /** + * Performs a request to iPsy. Notifies iObserver when request is complete + */ + void StartRequest(); + + + /** + * Performs a request to iPsy. Notifies iObserver when request is complete + */ + void SetUpdateIntervalL(TTimeIntervalMicroSeconds aInterval); + + void SetUpdateType(const TInt& aUpdateType); + + public: // Functions from base classes + + void RunL(); + + void DoCancel(); + + protected: // New functions + + void RequestComplete(); + + private: + + // By default, prohibit copy constructor + CT_LbsRequester( const CT_LbsRequester& ); + // Prohibit assigment operator + CT_LbsRequester& operator= ( const CT_LbsRequester& ); + + // Logger interface used for constructing result strings to be fed for the logger instance + inline CTestExecuteLogger& Logger() {return iLogger;}; + + private: // Data + + RPositionServer iPosServer; + RPositioner iPositioner; + + MCT_LbsRequestObserver* iObserver; + TTime iCompletionTimeUTC; + TInt iCompletionCode; + TRequestStatus iRequestStatus; + TPositionInfo iModuleInfo; + + CTestExecuteLogger iLogger; + }; + +#endif // __CT_LBS_REQUESTER_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsserver.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,66 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsServer.h +// This contains the header file for LBS Test server +// +// + +#ifndef __CT_LBS_SERVER_H__ +#define __CT_LBS_SERVER_H__ + +// System includes +#include + +// User includes +#include "ctlbsshareddata.h" + +//Literals Used +_LIT(KTestCaseId, "tc_id"); + +/** Configuration variable to state which module is in use for the test. + +This does not select the module to use, it's used to switch on test notifcation +messages from the test step to the test module. + +Values: "real" for use with the real A-GPS module. + "test" for use with the test module. +*/ +_LIT(KLbsModuleType, "module_type"); +_LIT(KLbsModuleType_Real, "real"); +_LIT(KLbsModuleType_Test, "test"); + + +// Implements the LBS Test server +class CT_LbsServer : public CTestServer + { +public : + static CT_LbsServer* NewL(); + // Creates the test steps based on the test step name + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + virtual ~CT_LbsServer(); + CT_LbsServer(); +public: + CT_LbsSharedData* iSharedData; + + /** + iScheduler is a pointer to the active scheduler for use in the tests + @see CActiveScheduler + */ + CActiveScheduler* iScheduler; + +protected: + virtual void ConstructL(const TDesC& aName); + }; + +#endif //__CT_LBS_SERVER_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsshareddata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsshareddata.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,75 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsSharedData.h +// This contains CT_LbsSharedData +// +// + + +#ifndef __T_LBS_SHARED_DATA_H__ +#define __T_LBS_SHARED_DATA_H__ + +// system includes +#include + +// Lbs includes +#include +#include + +#include +#include +#include +#include +#include +#include + +class CT_LbsSharedData : public CBase +{ +public: + static CT_LbsSharedData* NewL(); + CT_LbsSharedData(); + virtual ~CT_LbsSharedData(); + +protected: + virtual void ConstructL(); + +public: + RPointerArray iVerifyPosInfoArr; + RPointerArray iCurrentPosInfoArr; + + // For logging, different type arrays to store multiple events + RPointerArray iSelfLocateLogInfoArr; + RPointerArray iNetworkLocateLogInfoArr; + RPointerArray iExternalLocateLogInfoArr; + RPointerArray iX3PLocateLogInfoArr; + RPointerArray iAssistanceDataLogInfoArr; + + TPositionModuleInfo iVerifyModuleInfo; + TPositionModuleInfo iCurrentModuleInfo; + + TPositionModuleStatus iVerifyModuleStatus; + TPositionModuleStatus iCurrentModuleStatus; + + TPositionModuleStatusEvent iVerifyModuleStatusEvent; + TPositionModuleStatusEvent iCurrentModuleStatusEvent; + + TPositionUpdateOptions iVerifyUpdateOpts; + TPositionUpdateOptions iCurrentUpdateOpts; + + /** Flag used to indicate if the A-GPS integration test module is being used during testing. + */ + TBool iTestModuleInUse; +}; + +#endif // __T_LBS_SHARED_DATA_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstep.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,47 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsServer.h +// This contains the header file for LBS Test Step Base +// +// + +#ifndef __CT_LBS_STEP_H__ +#define __CT_LBS_STEP_H__ + + +#include + +#include "ctlbsserver.h" + + +class CT_LbsStep : public CTestStep +{ + +public: + virtual ~CT_LbsStep(); + + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepPostambleL(); + +protected: + CT_LbsStep(CT_LbsServer& aParent); + + // Class members which will be common to all individual test steps: + const CT_LbsServer& iParent; + + +private: +}; + +#endif // __CT_LBS_STEP_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepclearlog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepclearlog.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,54 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CTLbsStepClearLog.h +// This contains the header file to clear the log +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_CLEARLOG_H__ +#define __CT_LBS_STEP_CLEARLOG_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +// For logging +#include "lbslogger.h" +#include +#include +#include + +#include "ctlbsasyncwaiter.h" + +_LIT(KLbsStep_ClearLog, "LbsStep_ClearLog"); + +class CT_LbsStep_ClearLog : public CT_LbsStep + { +public: + static CT_LbsStep_ClearLog* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_ClearLog(CT_LbsServer& aParent); + + }; + +#endif // __CT_LBS_STEP_CLEARLOG_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepconfighybridmodule.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepconfighybridmodule.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,52 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This is the header file for the hybrid module configuration test step +// +// + +#ifndef CTLBSSTEPCONFIGHYBRIDMODULE_H +#define CTLBSSTEPCONFIGHYBRIDMODULE_H + +#include "ctlbsstep.h" +#include "ctlbsserver.h" +#include + +// Literals used +_LIT(KLbsStep_ConfigHybridModule, "LbsStep_ConfigHybridModule"); + +class CT_LbsStep_ConfigHybridModule : public CT_LbsStep, MT_ResponseObserver + { +public: + static CT_LbsStep_ConfigHybridModule* New(CT_LbsServer& aParent); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + virtual TVerdict doTestStepPostambleL(); + + // from MT_ResponseObserver + virtual void ProcessAGpsResponseMessage(const TT_LbsAGpsResponseMsg::TModuleResponseType aResponse); + +private: + CT_LbsStep_ConfigHybridModule(CT_LbsServer& aParent); + + // Communication channel between A-Gps module and Test Harness + CT_LbsAGpsHandler* iAGpsHandler; + + // Configuration counter + TInt iConfigCtr; + + // Partial verdict + TVerdict iVerdict; + }; + +#endif // CTLBSSTEPCONFIGHYBRIDMODULE_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepcreateupdateinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepcreateupdateinfo.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,38 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_UpdateInfo.h +// This contains the header file for Server Open Close Test +// +// + +#ifndef __CT_LBS_CREATE_UPDATE_INFO_H__ +#define __CT_LBS_CREATE_UPDATE_INFO_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +// Literals used +_LIT(KLbsStep_CreateUpdateInfo, "LbsStep_CreateUpdateInfo"); + +class CT_LbsStep_CreateUpdateInfo : public CT_LbsStep + { +public: + static CT_LbsStep_CreateUpdateInfo* New(CT_LbsServer& aParent); + virtual TVerdict doTestStepL(); + +private: + CT_LbsStep_CreateUpdateInfo(CT_LbsServer& aParent); + }; + +#endif //__CT_LBS_CREATE_UPDATE_INFO_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepcreateverifymodinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepcreateverifymodinfo.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,38 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_Create_Verify_ModInfo.h +// This contains the header file for create verify module info step +// +// + +#ifndef __CT_LBS_CREATE_VERIFY_MOD_INFO_H__ +#define __CT_LBS_CREATE_VERIFY_MOD_INFO_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +// Literals used +_LIT(KLbsStep_CreateVerifyModInfo, "LbsStep_CreateVerifyModInfo"); + +class CT_LbsStep_CreateVerifyModInfo : public CT_LbsStep + { +public: + static CT_LbsStep_CreateVerifyModInfo* New(CT_LbsServer& aParent); + virtual TVerdict doTestStepL(); + +private: + CT_LbsStep_CreateVerifyModInfo(CT_LbsServer& aParent); + }; + +#endif //__CT_LBS_CREATE_VERIFY_MOD_INFO_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepcreateverifymoduledata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepcreateverifymoduledata.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,38 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepcreateverifymoduledata.h +// This contains the header file for Server Open Close Test +// +// + +#ifndef __CT_LBS_CREATE_VERIFY_MODULE_DATA_H__ +#define __CT_LBS_CREATE_VERIFY_MODULE_DATA_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +// Literals used +_LIT(KLbsStep_CreateVerifyModuleData, "LbsStep_CreateVerifyModuleData"); + +class CT_LbsStep_CreateVerifyModuleData : public CT_LbsStep + { +public: + static CT_LbsStep_CreateVerifyModuleData* New(CT_LbsServer& aParent); + virtual TVerdict doTestStepL(); + +private: + CT_LbsStep_CreateVerifyModuleData(CT_LbsServer& aParent); + }; + +#endif //__CT_LBS_CREATE_VERIFY_MODULE_DATA_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepcreateverifyposinfos.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepcreateverifyposinfos.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,38 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_VerifyPosInfos.h +// This contains the header file for Server Open Close Test +// +// + +#ifndef __CT_LBS_CREATE_VERIFY_POS_INFOS_H__ +#define __CT_LBS_CREATE_VERIFY_POS_INFOS_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +// Literals used +_LIT(KLbsStep_CreateVerifyPosInfos, "LbsStep_CreateVerifyPosInfos"); + +class CT_LbsStep_CreateVerifyPosInfos : public CT_LbsStep + { +public: + static CT_LbsStep_CreateVerifyPosInfos* New(CT_LbsServer& aParent); + virtual TVerdict doTestStepL(); + +private: + CT_LbsStep_CreateVerifyPosInfos(CT_LbsServer& aParent); + }; + +#endif //__CT_LBS_CREATE_VERIFY_POS_INFOS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepinstallscheduler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepinstallscheduler.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,45 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_InstallScheduler.h +// This contains the header file for Install Active Scheduler Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_INSTALL_SCHEDULER_H__ +#define __CT_LBS_STEP_INSTALL_SCHEDULER_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +_LIT(KLbsStep_InstallScheduler, "LbsStep_InstallScheduler"); + +class CT_LbsStep_InstallScheduler : public CT_LbsStep + { +public: + static CT_LbsStep_InstallScheduler* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_InstallScheduler(CT_LbsServer& aParent); + }; + +#endif // __CT_LBS_STEP_INSTALL_SCHEDULER_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepresetdefaultadmin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepresetdefaultadmin.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,47 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_ResetDefaultAdmin.h +// This contains the header file for Reset Default Admin Settings Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_RESET_DEFAULT_ADMIN_H__ +#define __CT_LBS_STEP_RESET_DEFAULT_ADMIN_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +_LIT(KLbsStep_ResetDefaultAdmin, "LbsStep_ResetDefaultAdmin"); + +class CT_LbsStep_ResetDefaultAdmin : public CT_LbsStep + { +public: + static CT_LbsStep_ResetDefaultAdmin* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_ResetDefaultAdmin(CT_LbsServer& aParent); + + + }; + +#endif // __CT_LBS_STEP_RESET_DEFAULT_ADMIN_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetatamode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetatamode.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,48 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_SetATAMode.h +// This contains the header file for Set Autonomous Mode Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_SET_ATA_MODE_H__ +#define __CT_LBS_STEP_SET_ATA_MODE_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +_LIT(KLbsStep_SetATAMode, "LbsStep_SetATAMode"); + +class CT_LbsStep_SetATAMode: public CT_LbsStep + { +public: + static CT_LbsStep_SetATAMode* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_SetATAMode(CT_LbsServer& aParent); + + TBool SetAndVerifyATAModeL(); + + }; + +#endif // __CT_LBS_STEP_SET_ATA_MODE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetautonomousmode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetautonomousmode.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,48 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_SetAutonomousMode.h +// This contains the header file for Set Autonomous Mode Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_SET_AUTONOMOUS_MODE_H__ +#define __CT_LBS_STEP_SET_AUTONOMOUS_MODE_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +_LIT(KLbsStep_SetAutonomousMode, "LbsStep_SetAutonomousMode"); + +class CT_LbsStep_SetAutonomousMode : public CT_LbsStep + { +public: + static CT_LbsStep_SetAutonomousMode* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_SetAutonomousMode(CT_LbsServer& aParent); + + TBool SetAndVerifyAutonomousGpsModeL(); + + }; + +#endif // __CT_LBS_STEP_SET_AUTONOMOUS_MODE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetbehaviourmodeoriginal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetbehaviourmodeoriginal.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,48 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_SetBehaviourModeOriginal.h +// This contains the header file for Set Autonomous Mode Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_SET_BEHAVIOUR_ORIGINAL_MODE_H__ +#define __CT_LBS_STEP_SET_BEHAVIOUR_ORIGINAL_MODE_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +_LIT(KLbsStep_SetBehaviourModeOriginal, "LbsStep_SetBehaviourModeOriginal"); + +class CT_LbsStep_SetBehaviourModeOriginal: public CT_LbsStep + { +public: + static CT_LbsStep_SetBehaviourModeOriginal* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_SetBehaviourModeOriginal(CT_LbsServer& aParent); + + TBool SetAndVerifyBehaviourModeOriginalL(); + + }; + +#endif // __CT_LBS_STEP_SET_BEHAVIOUR_ORIGINAL_MODE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetprivhandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetprivhandler.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,49 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CTLbsStepSetPrivHandler.h +// This contains the header file for Set Privacy Controller Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_SET_PRIVACY_HANDLER_H__ +#define __CT_LBS_STEP_SET_PRIVACY_HANDLER_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" +#include + +_LIT(KLbsStep_SetPrivacyHandler, "LbsStep_SetPrivacyHandler"); + +class CT_LbsStep_SetPrivacyHandler : public CT_LbsStep + { +public: + static CT_LbsStep_SetPrivacyHandler* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_SetPrivacyHandler(CT_LbsServer& aParent); + + TBool SetAndVerifyPrivacyHandlerL(CLbsAdmin::TPrivacyHandler aPrivacyHandlerType); + + }; + +#endif // __CT_LBS_STEP_SET_PRIVACY_HANDLER_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetptamode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetptamode.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,48 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_SetPTAMode.h +// This contains the header file for Set Autonomous Mode Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_SET_PTA_MODE_H__ +#define __CT_LBS_STEP_SET_PTA_MODE_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +_LIT(KLbsStep_SetPTAMode, "LbsStep_SetPTAMode"); + +class CT_LbsStep_SetPTAMode: public CT_LbsStep + { +public: + static CT_LbsStep_SetPTAMode* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_SetPTAMode(CT_LbsServer& aParent); + + TBool SetAndVerifyPTAModeL(); + + }; + +#endif // __CT_LBS_STEP_SET_PTA_MODE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetptbmode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetptbmode.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,48 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_SetPTBMode.h +// This contains the header file for Set Autonomous Mode Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_SET_PTB_MODE_H__ +#define __CT_LBS_STEP_SET_PTB_MODE_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +_LIT(KLbsStep_SetPTBMode, "LbsStep_SetPTBMode"); + +class CT_LbsStep_SetPTBMode: public CT_LbsStep + { +public: + static CT_LbsStep_SetPTBMode* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_SetPTBMode(CT_LbsServer& aParent); + + TBool SetAndVerifyPTBModeL(); + + }; + +#endif // __CT_LBS_STEP_SET_PTB_MODE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetupprotocolstub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetupprotocolstub.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,45 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_SetupProtocolStub.h +// This contains the header file for Set Autonomous Mode Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_SETUP_PROTOCOL_STUB_H__ +#define __CT_LBS_STEP_SETUP_PROTOCOL_STUB_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +_LIT(KLbsStep_SetupProtocolStub, "LbsStep_SetupProtocolStub"); + +class CT_LbsStep_SetupProtocolStub : public CT_LbsStep + { +public: + static CT_LbsStep_SetupProtocolStub* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_SetupProtocolStub(CT_LbsServer& aParent); + }; + +#endif // __CT_LBS_STEP_SETUP_PROTOCOL_STUB_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetuproamselflocate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetuproamselflocate.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,45 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_SetupRoamSelfLocate.h +// This contains the header file for Set Autonomous Mode Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_SETUP_ROAM_SELF_LOCATE_H__ +#define __CT_LBS_STEP_SETUP_ROAM_SELF_LOCATE_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +_LIT(KLbsStep_SetupRoamSelfLocate, "LbsStep_SetupRoamSelfLocate"); + +class CT_LbsStep_SetupRoamSelfLocate : public CT_LbsStep + { +public: + static CT_LbsStep_SetupRoamSelfLocate* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_SetupRoamSelfLocate(CT_LbsServer& aParent); + }; + +#endif // __CT_LBS_STEP_SETUP_ROAM_SELF_LOCATE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetupstandaloneprivacyandsimplectlr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetupstandaloneprivacyandsimplectlr.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,47 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepsetupstandaloneprivacyandsimplectlr.h +// This contains the header file for Set Autonomous Mode Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_SETUP_STANDALONE_PRIVACY_AND_SIMPLE_CTRL_H__ +#define __CT_LBS_STEP_SETUP_STANDALONE_PRIVACY_AND_SIMPLE_CTRL_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +_LIT(KLbsStep_SetupStandalonePrivacyAndSimpleCtlr, "LbsStep_SetupStandalonePrivacyAndSimpleCtlr"); + + + +class CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr : public CT_LbsStep + { +public: + static CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr(CT_LbsServer& aParent); + }; + +#endif // __CT_LBS_STEP_SETUP_STANDALONE_PRIVACY_AND_SIMPLE_CTRL_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetupstandaloneprivacymode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetupstandaloneprivacymode.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,59 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_SetupStandalonePrivacyMode.h +// This contains the header file for Set Autonomous Mode Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_SETUP_STANDALONE_PRIVACY_MODE_H__ +#define __CT_LBS_STEP_SETUP_STANDALONE_PRIVACY_MODE_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +_LIT(KLbsStep_SetupStandalonePrivacyMode, "LbsStep_SetupStandalonePrivacyMode"); + +// lbsroot stuff (not ideal, currently defined in internal header file lbsrootcenrepdefs.h +const TUint KLbsCenRepUidValue = 0x10282266; +const TUid KLbsCenRepUid = {KLbsCenRepUidValue}; + +const TUint32 KLbsRootProcessNameFirstKey = 0x00001000; +const TUint32 KLbsRootProcessUidFirstKey = 0x00002000; +const TUint32 KLbsRootProcessIsServerFirstKey = 0x00003000; + +const TUint32 KLbsSystemTransientKey = 0x00000001; +const TUint32 KLbsRootProcessTransientKey = 0x00000002; + +const TUint32 KRootKeyMask = 0xFFFFF000; // don't care what the last 3 digits are + + +class CT_LbsStep_SetupStandalonePrivacyMode : public CT_LbsStep + { +public: + static CT_LbsStep_SetupStandalonePrivacyMode* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_SetupStandalonePrivacyMode(CT_LbsServer& aParent); + }; + +#endif // __CT_LBS_STEP_SETUP_STANDALONE_PRIVACY_MODE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetupstandaloneprivacywithnoctlr.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepsetupstandaloneprivacywithnoctlr.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,47 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepsetupstandaloneprivacywithnoctlr.h +// This contains the header file for Set Autonomous Mode Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_STEP_SETUP_STANDALONE_PRIVACY_WITH_NO_CTRL_H__ +#define __CT_LBS_STEP_SETUP_STANDALONE_PRIVACY_WITH_NO_CTRL_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +_LIT(KLbsStep_SetupStandalonePrivacyWithNoCtlr, "LbsStep_SetupStandalonePrivacyWithNoCtlr"); + + + +class CT_LbsStep_SetupStandalonePrivacyWithNoCtlr : public CT_LbsStep + { +public: + static CT_LbsStep_SetupStandalonePrivacyWithNoCtlr* New(CT_LbsServer& aParent); + TVerdict doTestStepL(); + +private: + CT_LbsStep_SetupStandalonePrivacyWithNoCtlr(CT_LbsServer& aParent); + }; + +#endif // __CT_LBS_STEP_SETUP_STANDALONE_PRIVACY_WITH_NO_CTRL_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepstartlbs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepstartlbs.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,45 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstartlbs.h +// This contains the header file for step to start lbs system +// +// + +#ifndef __CT_LBS_STEP_START_LBS_H__ +#define __CT_LBS_STEP_START_LBS_H__ + +// LBS includes. + +// LBS test includes. +#include "ctlbsstep.h" + +const TUint KLbsTestDataSrcServerUidValue = 0x10282259; + +// Literals used +_LIT(KLbsStep_StartLbs, "LbsStep_StartLbs"); + + +class CT_LbsStep_StartLbs : public CT_LbsStep + { +public: + ~CT_LbsStep_StartLbs(); + + static CT_LbsStep_StartLbs* New(CT_LbsServer& aParent); + virtual TVerdict doTestStepL(); + +private: + CT_LbsStep_StartLbs(CT_LbsServer& aParent); + }; + +#endif //__CT_LBS_STEP_START_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepstoplbs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepstoplbs.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,44 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstartlbs.h +// This contains the header file for step to start lbs system +// +// + +#ifndef __CT_LBS_STEP_STOP_LBS_H__ +#define __CT_LBS_STEP_STOP_LBS_H__ + +// LBS includes. + +// LBS test includes. +#include "ctlbsstep.h" + + +// Literals used +_LIT(KLbsStep_StopLbs, "LbsStep_StopLbs"); + + +class CT_LbsStep_StopLbs : public CT_LbsStep + { +public: + ~CT_LbsStep_StopLbs(); + + static CT_LbsStep_StopLbs* New(CT_LbsServer& aParent); + virtual TVerdict doTestStepL(); + +private: + CT_LbsStep_StopLbs(CT_LbsServer& aParent); + }; + +#endif //__CT_LBS_STEP_STOP_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepverifyloginfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepverifyloginfo.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,163 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepverifyloginfo.h +// This contains the header file for verify position info array test step. +// +// + +#ifndef __CT_LBS_VERIFY_LOG_INFO_H__ +#define __CT_LBS_VERIFY_LOG_INFO_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +// From test implementation +#include "lbstransmitlocationlogevent.h" +//#include "Te_LbsLoggingSuiteStepBase.h" + +#include "lbslogger.h" +#include +#include +#include + +#include "tlbsutils.h" +#include "ctlbsasyncwaiter.h" + +// Includes for Log Comparison +#include +#include +#include +#include +#include +#include + +// Literals used +_LIT(KLbsStep_VerifyLogInfo, "LbsStep_VerifyLogInfo"); +_LIT(KDest, "07712345678"); + +#define REFPOS_LAT 52.2 +#define REFPOS_LONG 0.2 +#define REFPOS_ALT 10 +#define REFPOS_HORZ_ACCURACY 100 +#define REFPOS_VERT_ACCURACY 100 + +#define REFPOS_LAT_OTHER 49.2 +#define REFPOS_LONG_OTHER 3.5 +#define REFPOS_ALT_OTHER 50.0 +#define REFPOS_HORZ_ACCURACY_OTHER 2.0 +#define REFPOS_VERT_ACCURACY_OTHER 3.0 + +class CT_LbsStep_VerifyLogInfo : public CT_LbsStep + { +public: + static CT_LbsStep_VerifyLogInfo* New(CT_LbsServer& aParent); + static CT_LbsStep_VerifyLogInfo* NewL(CT_LbsServer& aParent); + ~CT_LbsStep_VerifyLogInfo(); + CT_LbsStep_VerifyLogInfo(); + + TVerdict doTestStepPreambleL(); + TVerdict doTestStepPostambleL(); + + + virtual TVerdict doTestStepL(); + static TInt SelfLocateLogEventTimestampCompare(const CLbsSelfLocateLogEvent& aLog1, + const CLbsSelfLocateLogEvent& aLog2); + + + enum TLogType + { + /** Logging an Autonomous self Locate location request 3.3.1 */ + EAutonomousSelfLocateRequest = 0, + + /** Logging an MO-LR Self Locate location request 3.3.2 */ + EMOLRSelfLocateRequest, + + /** Logging an MO-LR Cell Based location request 3.3.3 */ + EMOLRCellBasedLocationRequest, + + /** Logging an MO-LR Transmit to 3rd Party Location 3.3.4 */ + EMOLRTransmitTo3rdPartyLocationRequest, + + /** Logging a Mobile Terminated Location Request 3.3.5 */ + EMTLR, + + /** Logging MO-LR Tracking Location Requests 3.3.6 */ + EMOLRTrackingLocationRequest, + + /** Logging Autonomous Tracking Location Requests 3.3.7 */ + EAutonomousTrackingLocationRequest, + + /** Update an existing Event log entry 3.3.8 */ + EUpdateExistingEventLogEntry, + + }; + + +private: + CT_LbsStep_VerifyLogInfo(CT_LbsServer& aParent); + + TVerdict ReadFromLogL(TInt aUidForTheLogType); + void ClearLog(); + void InitialiseRHS(); + void InitialiseRHSforMTLR(); + TPositionInfo* CommonPositionInfo(); + + //5 log type test mechanisms + void SelfLocateLogTest(); + void NetworkLocateLogTest(); + void ExternalLocateLogTest(); + void X3PLocateLogTest(); + void AssistanceDataLogTest(); + + //Top level functionality + void AutonomousSelfLocateLogTest(); + void MOLRSelfLocateRequest(); + void MOLRCellBasedLocationRequest(); + void MOLRTransmitTo3rdPartyLocationRequest(); + void MTLR(); + void MOLRTrackingLocationRequest(); + void AutonomousTrackingLocationRequest(); + void SecondPositionFromArray(TPositionInfo* aPosInfoSecond); + + + TInt iLogType; // Can be defined in ENums + T_LbsUtils iUtils; + + // Member variables for Log reading + RFs itheFs; + CLogClient* iclient; + CLogViewEvent* iview; + CT_LbsAsyncWaiter* iActiveWaiter; + TPositionInfo* iRefPosTwo; + + // Right hand sides of comparisons + CLbsSelfLocateLogEvent* iSelfLocateLogIntiailisedFromValues; + CLbsExternalLocateLogEvent* iExternalLocateLogIntiailisedFromValues; + CLbsTransmitLocationLogEvent* iX3PLogIntiailisedFromValues; + CLbsNetworkLocateLogEvent* iNetworkLocateLogIntiailisedFromValues; + CLbsAssistanceDataLogEvent* iAssistanceDataLogIntiailisedFromValuesFirst; + + + // Comparison accuracy + T_LbsUtils::TComparisonAccuracyType iWhatAccuracyToUse; + + + + +protected: + void ConstructL(); + + }; + +#endif //__CT_LBS_VERIFY_LOG_INFO_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepverifymodinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepverifymodinfo.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,38 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepmodinfo.h +// This contains the header file for verify module information test step. +// +// + +#ifndef __CT_LBS_VERIFY_MOD_INFO_H__ +#define __CT_LBS_VERIFY_MOD_INFO_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +// Literals used +_LIT(KLbsStep_VerifyModInfo, "LbsStep_VerifyModInfo"); + +class CT_LbsStep_VerifyModInfo : public CT_LbsStep + { +public: + static CT_LbsStep_VerifyModInfo* New(CT_LbsServer& aParent); + virtual TVerdict doTestStepL(); + +private: + CT_LbsStep_VerifyModInfo(CT_LbsServer& aParent); + }; + +#endif //__CT_LBS_VERIFY_MOD_INFO_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepverifymodstatus.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepverifymodstatus.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,38 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepmodinfo.h +// This contains the header file for verify module information test step. +// +// + +#ifndef __CT_LBS_VERIFY_MOD_STATUS_H__ +#define __CT_LBS_VERIFY_MOD_STATUS_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +// Literals used +_LIT(KLbsStep_VerifyModuleStatus, "LbsStep_VerifyModuleStatus"); + +class CT_LbsStep_VerifyModStatus : public CT_LbsStep + { +public: + static CT_LbsStep_VerifyModStatus* New(CT_LbsServer& aParent); + virtual TVerdict doTestStepL(); + +private: + CT_LbsStep_VerifyModStatus(CT_LbsServer& aParent); + }; + +#endif //__CT_LBS_VERIFY_MOD_STATUS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepverifyposinfos.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepverifyposinfos.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,38 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_VerifyPosInfos.h +// This contains the header file for verify position info array test step. +// +// + +#ifndef __CT_LBS_VERIFY_POS_INFOS_H__ +#define __CT_LBS_VERIFY_POS_INFOS_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +// Literals used +_LIT(KLbsStep_VerifyPosInfos, "LbsStep_VerifyPosInfos"); + +class CT_LbsStep_VerifyPosInfos : public CT_LbsStep + { +public: + static CT_LbsStep_VerifyPosInfos* New(CT_LbsServer& aParent); + virtual TVerdict doTestStepL(); + +private: + CT_LbsStep_VerifyPosInfos(CT_LbsServer& aParent); + }; + +#endif //__CT_LBS_VERIFY_POS_INFOS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/ctlbsstepverifyroughposinfos.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/ctlbsstepverifyroughposinfos.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,38 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep_VerifyPosInfos.h +// This contains the header file for verify position info array test step. +// +// + +#ifndef __CT_LBS_VERIFY_ROUGH_POS_INFOS_H__ +#define __CT_LBS_VERIFY_ROUGH_POS_INFOS_H__ + +#include "ctlbsstep.h" +#include "ctlbsserver.h" + +// Literals used +_LIT(KLbsStep_VerifyRoughPosInfos, "LbsStep_VerifyRoughPosInfos"); + +class CT_LbsStep_VerifyRoughPosInfos : public CT_LbsStep + { +public: + static CT_LbsStep_VerifyRoughPosInfos* New(CT_LbsServer& aParent); + virtual TVerdict doTestStepL(); + +private: + CT_LbsStep_VerifyRoughPosInfos(CT_LbsServer& aParent); + }; + +#endif //__CT_LBS_VERIFY_ROUGH_POS_INFOS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/inc/mctlbsrequestobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/inc/mctlbsrequestobserver.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + +#ifndef __MCT_LBS_REQUEST_OBSERVER_H__ +#define __MCT_LBS_REQUEST_OBSERVER_H__ + +// CLASS DECLARATION + +/** +* Interface for notification when a CRequester request is complete. +* +*/ +class MCT_LbsRequestObserver + { + public: + + /** + * Called when a CRequester request has completed. + */ + virtual void RequestCompleteL() = 0; + + }; + +#endif // __MCT_LBS_REQUEST_OBSERVER_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsactiveyield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsactiveyield.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,80 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Common utils used by hybrid plugin tests +// +// + + + +/** + @file ctlbsactiveyield.cpp +*/ + +#include +#include + +#include + + +void CheckForObserverEventTestsL(TTimeIntervalMicroSeconds32 aTimeout, CTestStep& aStep) + { + class CTimeout : public CTimer + { + CTestStep& iStep; + + void RunL() + { + iStep.SetTestStepError(KErrTimedOut); + CActiveScheduler::Stop(); + } + + CTimeout(CTestStep& aTestStep) : CTimer(EPriorityLow), iStep(aTestStep) { ; } + + public: + static CTimeout* NewL(CTestStep& aTestStep) + { + CTimeout* p = new (ELeave) CTimeout(aTestStep); + CleanupStack::PushL(p); + p->ConstructL(); + CActiveScheduler::Add(p); + CleanupStack::Pop(p); + return p; + } + }; + + CTimeout *pTimeout = CTimeout::NewL(aStep); + pTimeout->After(aTimeout); + + CActiveScheduler::Start(); + + if(pTimeout->iStatus == KRequestPending) + { + pTimeout->Cancel(); +// User::WaitForRequest(pTimeout->iStatus); + } + + pTimeout->Deque(); + delete pTimeout; + + if(EPass != aStep.TestStepResult()) + { + User::Leave(aStep.TestStepResult()); + } + } + + +void ReturnToTestStep() + { + CActiveScheduler::Stop(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsclientlog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsclientlog.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,69 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDE FILES +#include "ctlbsclientlog.h" +#include + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CT_LbsClientLog::CT_LbsClientLog() + { + } + +// EPOC default constructor can leave. +void CT_LbsClientLog::ConstructL(CTestExecuteLogger& aLogger) + { + iLogger = aLogger; + } + +// Two-phased constructor. +EXPORT_C CT_LbsClientLog* CT_LbsClientLog::NewL(CTestExecuteLogger& aLogger) + { + CT_LbsClientLog* self = NewLC(aLogger); + CleanupStack::Pop(); + return self; + } + +// Two-phased constructor. +EXPORT_C CT_LbsClientLog* CT_LbsClientLog::NewLC(CTestExecuteLogger& aLogger) + { + CT_LbsClientLog* self = new (ELeave) CT_LbsClientLog; + CleanupStack::PushL(self); + self->ConstructL(aLogger); + return self; + } + +// Destructor +CT_LbsClientLog::~CT_LbsClientLog() + { + } + +void CT_LbsClientLog::Put(const TDesC& aLine) + { + INFO_PRINTF1(aLine); + } + +void CT_LbsClientLog::PutError(const TDesC& aLine) + { + ERR_PRINTF1(aLine); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsclientrequestor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsclientrequestor.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,274 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDE FILES +#include "ctlbsportedstepbase.h" +#include "ctlbsclientrequestor.h" +#include "mctlbsrequestobserver.h" + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// Two-phased constructor. +CT_LbsClientRequestor* CT_LbsClientRequestor::NewL( + TUid aPsyUid, + MCT_LbsRequestObserver* aObserver, + const TDesC& aClientName, + CTestExecuteLogger& aLogger + ) + { + CT_LbsClientRequestor* self = new (ELeave) CT_LbsClientRequestor(aObserver, aPsyUid); + CleanupStack::PushL(self); + self->ConstructL(aClientName, aLogger); + CleanupStack::Pop(); + return self; + } + +// Destructor +CT_LbsClientRequestor::~CT_LbsClientRequestor() + { + iObserver = NULL; + Cancel(); + iPosServer.Close(); + } + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CT_LbsClientRequestor::CT_LbsClientRequestor( + MCT_LbsRequestObserver* aObserver, + TUid aPsyUid) + : CActive(EPriorityStandard), iObserver(aObserver), iCompletionCode(KNoEvent), + iPsyUid(aPsyUid), iContinueEventRequesting(FALSE) + { + } + +// EPOC default constructor can leave. +void CT_LbsClientRequestor::ConstructL( + const TDesC& aClientName, + CTestExecuteLogger& aLogger + ) + { + iName = aClientName; + iLogger = aLogger; + User::LeaveIfError(iPosServer.Connect()); + iModuleInfo = TPositionInfo(); + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------- +// CRequester::CompletionTimeUTC +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +const TTime& CT_LbsClientRequestor::CompletionTimeUTC() const + { + return iCompletionTimeUTC; + } + +// --------------------------------------------------------- +// CRequester::CompletionCode +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CT_LbsClientRequestor::CompletionCode() const + { + return iCompletionCode; + } + +// --------------------------------------------------------- +// CT_LbsClientRequestor::ResetCompletionCode +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientRequestor::ResetCompletionCode() + { + iCompletionCode = KNoEvent; + } + +// --------------------------------------------------------- +// CRequester::StartRequest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientRequestor::StartRequestL(TBool aDefaultPsy) + { + _LIT(KService, "SAAA"); + if (aDefaultPsy == FALSE) + { + User::LeaveIfError(iPositioner.Open(iPosServer, iPsyUid)); + } + else + { + User::LeaveIfError(iPositioner.Open(iPosServer)); + } + + + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, + KService); + + iPositioner.NotifyPositionUpdate(iModuleInfo, iStatus); + SetActive(); + } + +// --------------------------------------------------------- +// CRequester::RunL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientRequestor::RunL() + { + iCompletionCode = iStatus.Int(); + RequestComplete(); + if (iContinueEventRequesting) + { + iContinueEventRequesting = FALSE; + RequestModuleStatusEvent(); + } + } + +// --------------------------------------------------------- +// CT_LbsClientRequestor::DoCancel +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientRequestor::DoCancel() + { + iPosServer.CancelRequest(EPositionServerNotifyModuleStatusEvent/*EPositionServerGetModuleStatus*/); + } + +// --------------------------------------------------------- +// CT_LbsClientRequestor::RequestComplete +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientRequestor::RequestComplete() + { + if (iObserver) + { + TRAPD(err, iObserver->RequestCompleteL()); + if(KErrNone != err) + { + _LIT(KClientRequestor, "Error in LbsClientRequestor: %d"); + ERR_PRINTF2(KClientRequestor, err); + } + } + } + +// --------------------------------------------------------- +// CT_LbsClientRequestor::RequestModuleStatusEvent +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientRequestor::RequestModuleStatusEvent() + { + istatusEvent.SetRequestedEvents(TPositionModuleStatusEvent::EEventAll); + iPosServer.NotifyModuleStatusEvent(istatusEvent, iStatus, iPsyUid); + if (!IsActive()) + { + SetActive(); + } + } + +// --------------------------------------------------------- +// CT_LbsClientRequestor::CancelModuleStatusEvent +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientRequestor::CancelModuleStatusEvent() + { + iPosServer.CancelRequest(EPositionServerGetModuleStatus); + } + +// --------------------------------------------------------- +// CT_LbsClientRequestor::ReadModuleStatusEvent +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CT_LbsClientRequestor::ReadModuleStatusEvent() + { + TPositionModuleStatus modstatus = TPositionModuleStatus(); + istatusEvent.GetModuleStatus(modstatus); + return modstatus.DeviceStatus(); + } + +// --------------------------------------------------------- +// CT_LbsClientRequestor::ReadModuleStatusClientApi +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CT_LbsClientRequestor::ReadModuleStatusClientApi(TPositionModuleId aModuleId) + { + //Module status from Client API + TPositionModuleStatus moduleStatus = TPositionModuleStatus(); + iPosServer.GetModuleStatus(moduleStatus, aModuleId); + return moduleStatus.DeviceStatus(); + } + +// --------------------------------------------------------- +// CT_LbsClientRequestor::ReadModuleStatusModulesApi +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CT_LbsClientRequestor::ReadModuleStatusModulesApi(CPosModules* aDb, TPositionModuleId aModuleId) + { + //Module info from Modules API + TPositionModuleInfo moduleInfo; + CPosModuleIdList* prioList = aDb->ModuleIdListLC(); + TInt modnr = prioList->Find(aModuleId); + aDb->GetModuleInfoL(prioList->At(modnr), moduleInfo); + CleanupStack::PopAndDestroy(prioList); + return moduleInfo.IsAvailable(); + } + +// --------------------------------------------------------- +// CT_LbsClientRequestor::ContinueRequesting +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientRequestor::ContinueRequesting() + { + iContinueEventRequesting = TRUE;; + } + +// --------------------------------------------------------- +// CT_LbsClientRequestor::ClosePositioner +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientRequestor::ClosePositioner() + { + iPositioner.Close(); + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsdoposupdate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsdoposupdate.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,197 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ao wrapper around the a-gps mgr function NotifyPositionUpdate +// +// + + + +/** + @file ctlbsdoposupd.cpp +*/ + +#include "ctlbsdoposupdate.h" +#include "tlbsutils.h" + + +CT_LbsDoPosUpdate* CT_LbsDoPosUpdate::NewL(MT_LbsDoPosUpdateObserver* aObserver, TPositionModuleInfo::TTechnologyType aTechnologyType) +/** + * 'public constructor' may leave + */ + { + TPositionCriteria dummyCritera; + CT_LbsDoPosUpdate* doPosUpdate = new(ELeave)CT_LbsDoPosUpdate(aObserver); + CleanupStack::PushL(doPosUpdate); + doPosUpdate->ConstructL(EOpenSubSessionByModuleId,aTechnologyType,dummyCritera); + CleanupStack::Pop(doPosUpdate); + + return doPosUpdate; + } + + +CT_LbsDoPosUpdate* CT_LbsDoPosUpdate::NewL(MT_LbsDoPosUpdateObserver* aObserver, const TPositionCriteriaBase& aCriteria) +/** + * 'public constructor' may leave + */ + { + TUint dummyTechnologyType = TPositionModuleInfo::ETechnologyUnknown; + CT_LbsDoPosUpdate* doPosUpdate = new(ELeave)CT_LbsDoPosUpdate(aObserver); + CleanupStack::PushL(doPosUpdate); + doPosUpdate->ConstructL(EOpenSubSessionByCriteria,dummyTechnologyType,aCriteria); + CleanupStack::Pop(doPosUpdate); + + return doPosUpdate; + } + + +CT_LbsDoPosUpdate::CT_LbsDoPosUpdate(MT_LbsDoPosUpdateObserver* aObserver) : CActive(EPriorityStandard), iObserver(aObserver) +/** + * Constructor - will not leave + */ + { + CActiveScheduler::Add(this); + } + + +void CT_LbsDoPosUpdate::OpenPositioner(TPositionModuleInfo::TTechnologyType aTechnologyType) + { + // Open the positioner. + if(TPositionModuleInfo::ETechnologyUnknown == aTechnologyType) // use default + { + User::LeaveIfError(iPositioner.Open(iServer)); + } + else if(TPositionModuleInfo::ETechnologyTerminal == aTechnologyType) + { + T_LbsUtils utils; + // Get position using Agps module + TPositionModuleId moduleId; + moduleId = utils.GetAGpsModuleIdL(iServer); + User::LeaveIfError(iPositioner.Open(iServer, moduleId)); + } + else if(TPositionModuleInfo::ETechnologyNetwork == aTechnologyType) + { + T_LbsUtils utils; + // Get position using network module + TPositionModuleId moduleId; + moduleId = utils.GetNetworkModuleIdL(iServer); + User::LeaveIfError(iPositioner.Open(iServer, moduleId)); + } + else + { + __ASSERT_ALWAYS(EFalse, User::Panic(KCT_LbsDoPosUpdate, KErrNotSupported)); // not supported yet + } + } + +void CT_LbsDoPosUpdate::ClosePositioner(void) + { + iPositioner.Close(); + } + +void CT_LbsDoPosUpdate::ConnectServer() + { + User::LeaveIfError(iServer.Connect()); + } + +void CT_LbsDoPosUpdate::CloseServer() + { + iServer.Close(); + } + +void CT_LbsDoPosUpdate::ConstructL(TOpenSubSessionType aOpenSubSessionType,TPositionModuleInfo::TTechnologyType aTechnologyType, const TPositionCriteriaBase& aCriteria) + { + // Connect to the LBS self locate server. + User::LeaveIfError(iServer.Connect()); + + if(aOpenSubSessionType == EOpenSubSessionByModuleId) + { + OpenPositioner(aTechnologyType); + } + + else if(aOpenSubSessionType == EOpenSubSessionByCriteria) + { + User::LeaveIfError(iPositioner.Open(iServer, aCriteria)); + } + + // set requester will be removed, don't forget the pushl above + User::LeaveIfError(iPositioner.SetRequestor( CRequestor::ERequestorService, + CRequestor::EFormatApplication, + _L("Tom Tom"))); + + } + + +CT_LbsDoPosUpdate::~CT_LbsDoPosUpdate() +/** + * Destructor + */ + { + Cancel(); + + iPositioner.Close(); + iServer.Close(); + } + + +TInt CT_LbsDoPosUpdate::SetOptions(const TPositionUpdateOptionsBase& aPosOption) + { + return iPositioner.SetUpdateOptions(aPosOption); + } + + +void CT_LbsDoPosUpdate::StartL(TPositionInfo& aPosInfo) +/** + * wrapper for async function RLbsPositionUpdates::NotifyPositionUpdate(). + * Will panic if there's another outstanding request. + */ + { + __ASSERT_ALWAYS(!IsActive(), User::Panic(KCT_LbsDoPosUpdate, KErrInUse)); + + // Invoke the position update. + iPositioner.NotifyPositionUpdate(aPosInfo, iStatus); + SetActive(); + } + +void CT_LbsDoPosUpdate::CancelRequest() + { + // To allow us to cancel the request but not the active object, normally Cancel() would be used. + DoCancel(); + } + +void CT_LbsDoPosUpdate::DoCancel() + { + iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); + } + + +void CT_LbsDoPosUpdate::RunL() + { + TInt err = iStatus.Int(); + + // iStatus will contain error code + // async request completed. Notify caller via callback: + if (iObserver) + { + iObserver->MT_LbsDoPosUpdateCallback(iStatus); + } + } + +TInt CT_LbsDoPosUpdate::RunError(TInt aError) + { + return aError; + } + +TInt CT_LbsDoPosUpdate::CompleteRequest(TInt aRequestId) + { + return iPositioner.CompleteRequest(aRequestId); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsdox3p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsdox3p.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,96 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Async wrapper around a LBS X3P transmitter. +// +// + + + +/** + @file ctlbsdox3p.cpp +*/ + +//#include + +#include "ctlbsdox3p.h" + + +CT_LbsDoX3P* CT_LbsDoX3P::NewL(MT_LbsDoX3PObserver* aObserver, TInt aTransmitId) + { + CT_LbsDoX3P* self = new(ELeave)CT_LbsDoX3P(aObserver, aTransmitId); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + + +CT_LbsDoX3P::CT_LbsDoX3P(MT_LbsDoX3PObserver* aObserver, TInt aTransmitId) : CActive(EPriorityStandard), iObserver(aObserver), iTransmitId(aTransmitId) + { + CActiveScheduler::Add(this); + } + + +void CT_LbsDoX3P::ConstructL() + { + User::LeaveIfError(iServer.Connect()); + User::LeaveIfError(iTransmitter.Open(iServer)); + } + + +CT_LbsDoX3P::~CT_LbsDoX3P() + { + Cancel(); + + iTransmitter.Close(); + iServer.Close(); + } + + +TInt CT_LbsDoX3P::SetOptions(const TLbsTransmitPositionOptions& aTransmitOptions) + { + return iTransmitter.SetTransmitOptions(aTransmitOptions); + } + + +void CT_LbsDoX3P::StartL(const TDesC& aDestinationID, TUint aTransmitPriority, TPositionInfo & aTransmittedPosInfo) + { + __ASSERT_ALWAYS(!IsActive(), User::Panic(KCT_LbsDoX3P, KErrInUse)); + + // Invoke the X3P transmit update. + iTransmitter.TransmitPosition(aDestinationID, aTransmitPriority, iStatus, aTransmittedPosInfo); + SetActive(); + } + + +void CT_LbsDoX3P::DoCancel() + { + iTransmitter.CancelTransmitPosition(); + } + + +void CT_LbsDoX3P::RunL() + { + // Notify caller via callback, process the err in the callback. + if (iObserver) + { + iObserver->MT_LbsDoX3PCallback(iTransmitId, iStatus); + } + } + +TInt CT_LbsDoX3P::RunError(TInt aError) + { + return aError; + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsnetsimstep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsnetsimstep.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,280 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsnetsimstep.cpp +// This is the class implementation for the LBS Test Step Base +// +// + +#include "ctlbsnetsimstep.h" + + +/** + * Constructor + */ +CT_LbsNetSimStep::CT_LbsNetSimStep() : iState(EConnecting) + { + } + + +/** + * If parameter is supplied, it will cause the test to continue running for this period after all expected flags have been set + */ +void CT_LbsNetSimStep::ConstructL(TTimeIntervalMicroSeconds32 aHaltTimerInterval) + { + // Create the keep alive timer. + iKeepAliveTimer = CT_LbsTimerUtils::NewL(this, KKeepAliveTimerId); + // Create the abort timer. + iAbortTimer = CT_LbsTimerUtils::NewL(this, KAbortTimerId); + + iExtendedTimerInterval = aHaltTimerInterval; + } + +/** + * Can be used to set the extended time interval if not known at construct time. + * // This will cause the test to continue running for this period after all expected flags have been set + */ +void CT_LbsNetSimStep::SetExtendedTimerInterval(TTimeIntervalMicroSeconds32 aHaltTimerInterval) + { + iExtendedTimerInterval = aHaltTimerInterval; + } + + +CT_LbsNetSimStep::~CT_LbsNetSimStep() + { + iKeepAliveTimer->Cancel(); + delete iKeepAliveTimer; + iAbortTimer->Cancel(); + delete iAbortTimer; + + } + +/** + * @return - TVerdict + * Implementation of CTestStep base class virtual + * It is used for doing all initialisation common to derived classes in here. + * Make it being able to leave if there are any errors here as there's no point in + * trying to run a test step if anything fails. + * The leave will be picked up by the framework. + */ +TVerdict CT_LbsNetSimStep::doTestStepPreambleL() + { + // Process some common pre setting to test steps then set SetTestStepResult to EFail or Epass. + INFO_PRINTF1(_L(">>CT_LbsNetSimStep::doTestStepPreambleL()")); + SetTestStepResult(EPass); + + return TestStepResult(); + } + + +/** + * @return - TVerdict + * Implementation of CTestStep base class virtual + * It is used for doing all after test treatment common to derived classes in here. + * Make it being able to leave + * The leave will be picked up by the framework. + */ +TVerdict CT_LbsNetSimStep::doTestStepPostambleL() + { + // Process some common post setting to test steps then set SetTestStepResult to EFail or Epass. + INFO_PRINTF1(_L(">>CT_LbsNetSimStep::doTestStepPostabmleL()")); + + //SetTestStepResult(EPass); // or EFail + return TestStepResult(); + } + + +/** Used to mark each callback that has fired. +*/ +void CT_LbsNetSimStep::SetCallbackFlag(TLbsCallbackFlags aCallbackFlag) + { +// INFO_PRINTF2(_L("CT_LbsNetSimStep::SetCallbackFlag: setting callback flag 0x%x"), aCallbackFlag); + iCallbackFlags |= aCallbackFlag; + } + + +/** Used to determine which callback or callbacks have been fired. +*/ +TBool CT_LbsNetSimStep::TestCallbackFlags(TLbsCallbackFlags aExpectedFlags) + { + if (iCallbackFlags == aExpectedFlags) + { + return ETrue; + } + return EFalse; + } + + +/** Keep alive timer callback. + + Check the state machine to determine when to halt the test. Once all the callbacks + have been received the test can end. + + We have to call async functions from here also, as the callbacks are executed in another thread. +*/ +void CT_LbsNetSimStep::HandleTimerL(TInt aTimerId, const TTime& aTargetTime) + { + // Not used. + (void)aTimerId; + (void)aTargetTime; + + if(KAbortTimerId == aTimerId) + { + INFO_PRINTF1(_L("Abort timer fired")); + iState = EAborted; + iKeepAliveTimer->Cancel(); + CActiveScheduler::Stop(); + } + else + { + // Check for test finish. + + ASSERT(aTimerId == KKeepAliveTimerId); + // We stop test from here when in the correct state and, there should not be anything outstanding. + if (iState == EWaiting && TestCallbackFlags(iFlagsToHaltOn)) + { + if(iExtendedTimerInterval.Int()) // we need an extended timer + { + INFO_PRINTF1(_L("Starting extended timer")); + iState = EExtendedWaiting; + iKeepAliveTimer->SetTimer(iExtendedTimerInterval); + } + else + { + iState = EDone; + iAbortTimer->Cancel(); // note: this is ok since it will do nothing if timer never started + CActiveScheduler::Stop(); + } + } + // expected callbacks have all fired, but waiting for an extended period of time before stopping + else if(iState == EExtendedWaiting) + { + INFO_PRINTF1(_L("Extended timer fired")); + iState = EDone; + iAbortTimer->Cancel(); + CActiveScheduler::Stop(); + } + // Keep going, still waiting for callbacks. + else + { + TTimeIntervalMicroSeconds32 interval(KLbsKeepAlivePeriod); + + iKeepAliveTimer->SetTimer(interval); + } + } + } + + +/** NetSim callbacks. +*/ +void CT_LbsNetSimStep::Connected() + { + INFO_PRINTF1(_L("Got - NetSim Connect - Callback Event.")); + + SetCallbackFlag(KLbsCallback_NetSim_Got_Connect); + + iState = EWaiting; + } + + +void CT_LbsNetSimStep::Disconnected() + { + INFO_PRINTF1(_L("Got - NetSim Notify Disconnected - Callback Event.")); + } + + +void CT_LbsNetSimStep::NotifyRegisterLcsMoLr(const TDesC& aData) + { + (void)aData; + + INFO_PRINTF1(_L("Got - NetSim Notify Register Lcs MoLr - Callback Event.")); + SetCallbackFlag(KLbsCallback_NetSim_Got_NotifyRegisterLcsMoLr); + } + + +void CT_LbsNetSimStep::NotifyReleaseLcsMoLr(TInt aReason) + { + (void)aReason; + + INFO_PRINTF1(_L("Got - NetSim Notify Release Lcs MoLr - Callback Event.")); + SetCallbackFlag(KLbsCallback_NetSim_Got_NotifyReleaseLcsMoLr); + } + + +void CT_LbsNetSimStep::NotifyMeasurementControlLocation(const TPositionInfo& aPosition, + const RLbsAssistanceDataBuilderSet& aData, + const TLbsNetPosRequestQuality& aQuality) + { + (void)aPosition; + (void)aData; + (void)aQuality; + + INFO_PRINTF1(_L("Got - NetSim Notify Measurement Control Location - Callback Event.")); + SetCallbackFlag(KLbsCallback_NetSim_Got_NotifyMeasurementControlLocation); + } + + +void CT_LbsNetSimStep::NotifyReleaseLcsLocationNotification(const CLbsNetworkProtocolBase::TLbsPrivacyResponse& aResult) + { + (void)aResult; + + INFO_PRINTF1(_L("Got - NetSim Notify Release Lcs Location Notification - Callback Event.")); + SetCallbackFlag(KLbsCallback_NetSim_Got_NotifyReleaseLcsLocationNotification); + } + + +void CT_LbsNetSimStep::NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition) + { + (void)aReason; + (void)aPosition; + + INFO_PRINTF1(_L("Got - NetSim Notify Facility Lcs MoLr Result - Callback Event.")); + SetCallbackFlag(KLbsCallback_NetSim_Got_NotifyFacilityLcsMoLrResult); + } + + +void CT_LbsNetSimStep::NotifyMeasurementReportLocation(const TPositionInfo& aPosition) + { + (void)aPosition; + + INFO_PRINTF1(_L("Got - Net Sim Notify Measurement Report - Callback Event.")); + SetCallbackFlag(KLbsCallback_NetSim_Got_NotifyMeasurementReportLocation); + } + + +void CT_LbsNetSimStep::NotifyMeasurementReportRequestMoreAssistanceData(const TLbsAssistanceDataGroup& aFilter) + { + (void)aFilter; + + INFO_PRINTF1(_L("Got - Net Sim Notify Measurement Report Request More Assistance Data - Callback Event.")); + SetCallbackFlag(KLbsCallback_NetSim_Got_NotifyMeasurementReportRequestMoreAssistanceData); + } + + +void CT_LbsNetSimStep::NotifyMeasurementReportControlFailure(TInt aReason) + { + INFO_PRINTF2(_L("Got - Net Sim Notify Measurement Report Control Failure - Callback Event. Reason = %d"), aReason); + SetCallbackFlag(KLbsCallback_NetSim_Got_NotifyMeasurementReportControlFailure); + } + +void CT_LbsNetSimStep::NotifyError(MLbsNetSimTestObserver::EFunction aFunction, int aError) + { + INFO_PRINTF3(_L("Got - Net Sim Notify Error - Callback Event. Function = %d, Error = %d"), aFunction, aError); + SetCallbackFlag(KLbsCallback_NetSim_Got_NotifyError); + } + +void CT_LbsNetSimStep::ProcessMeasurementControlLocationError(TInt aError) + { + INFO_PRINTF2(_L("Got - Net Sim Process Measurement Control Location Error - Callback Event. Reason = %d"), aError); + SetCallbackFlag(KLbsCallback_NetSim_Got_ProcessMeasurementControlLocationError); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsportedstepbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsportedstepbase.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,659 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +#include "ctlbsportedstepbase.h" +#include "ctlbsportedsuitedefs.h" + +/* +* ============================================================================ +* ============================================================================ +*/ + +// INCLUDES +#include +#include +#include +#include +#include +#include "ctlbsclientlog.h" + +// Device driver constants + +TVerdict CT_LbsPortedStepBase::doTestStepPreambleL() +/** + * @return - TVerdict + * Implementation of CTestStep base class virtual + * It is used for doing all initialisation common to derived classes in here. + * Make it being able to leave if there are any errors here as there's no point in + * trying to run a test step if anything fails. + * The leave will be picked up by the framework. + */ + { + // process some common pre setting to test steps then set SetTestStepResult to EFail or Epass. + SetTestStepResult(EPass); + return TestStepResult(); + } + +TVerdict CT_LbsPortedStepBase::doTestStepPostambleL() +/** + * @return - TVerdict + * Implementation of CTestStep base class virtual + * It is used for doing all after test treatment common to derived classes in here. + * Make it being able to leave + * The leave will be picked up by the framework. + */ + { + // process some common post setting to test steps then set SetTestStepResult to EFail or Epass. + // SetTestStepResult(EPass); // or EFail + return TestStepResult(); + } + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CT_LbsPortedStepBase::CT_LbsPortedStepBase(CT_LbsServer& aParent): CT_LbsStep(aParent) + { + iUidExternalGps.iUid = KUidExternalGps; + iUidManualInput.iUid = KUidManualInput; + iUidDefault.iUid = KUidDefault; + iUidStrategy.iUid = KUidStrategy; + iUidStubPositioner.iUid = KUidStubPositioner; + iUidSimulationPsy.iUid = KUidSimulationPsy; + iUidDynDbTestPsy.iUid = KUidDynDbTestPsy; + iUidInstallTestPsy.iUid = KUidInstallTestPsy; + iUidTestPsySimulateIsa.iUid = KUidTestPsySimulateIsa; + iUidTestPsy1.iUid = KUidTestPsy1; + iUidTestPsy2.iUid = KUidTestPsy2; + iUidTestPsy3.iUid = KUidTestPsy3; + iUidTestPsy4.iUid = KUidTestPsy4; + iUidTestPsy5.iUid = KUidTestPsy5; + iUidTestPsy6.iUid = KUidTestPsy6; + iUidTestPsy7.iUid = KUidTestPsy7; + iUidTestPsy8.iUid = KUidTestPsy8; + iUidTestPsy9.iUid = KUidTestPsy9; + iUidTestPsy10.iUid = KUidTestPsy10; + iUidTestPsy11.iUid = KUidTestPsy11; + iUidTestPsy12.iUid = KUidTestPsy12; + iUidTestPsy13.iUid = KUidTestPsy13; + iUidTestPsyTp176.iUid = KUidTestPsyTp176; + iUidMultiPsy.iUid = KUidMultiPsy; + iUidTestPsy256.iUid = KUidTestPsy256; + iUidExamplePsy.iUid = KUidExamplePsy; + iUidTestStatusPsy.iUid = KUidTestStatusPsy; + iUidTestTimerPsy.iUid = KUidTestTimerPsy; + iUidPanicPsy.iUid = KUidPanicPsy; + iUidPsySwitching.iUid = KUidPsySwitching; + iUidTestPsyPartialUpdate.iUid = KUidTestPsyPartialUpdate; + iUidTestPsyMaxAge.iUid = KUidTestPsyMaxAge; + iUidTestRangePsy.iUid = KUidTestRangePsy; + iUidTestSingPsy.iUid = KUidTestSingPsy; + iUidTestTrackingPsy.iUid = KUidTestTrackingPsy; + iUidTestProxyPsy1.iUid = KTestProxyPsy1; + iUidTestProxyPsy2.iUid = KTestProxyPsy2; + iUidTestProxyPsy3.iUid = KTestProxyPsy3; + iUidTestProxyPsy4.iUid = KTestProxyPsy4; + iUidInstallPsyTp273.iUid = KInstallPsyTp273; + iUidPartialUpdate2.iUid = KUidTestPsyPartialUpdate2; + iUidSatInfoPsy.iUid = KUidSatInfoPsy; + iUidBtgPsy.iUid = KUidBtgPsy; + iUidIgPsy.iUid = KUidIgPsy; + } + +// Destructor +CT_LbsPortedStepBase::~CT_LbsPortedStepBase() + { + iPositioner.Close(); + iPosServer.Close(); + delete iScheduler; + iFileServer.Close(); + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::StartL(TInt aIndex) + { + if (aIndex == 0) + { + __UHEAP_MARK; + + iLog = CT_LbsClientLog::NewL(Logger()); + + // Give extra time for epos server to shut down after previous tests: + User::After(2000000); + TRAPD(err, InitTestL()); + if (err == KErrNone) + { + TRAP(err, StartL()); + } + CloseTest(); + + delete iLog; + __UHEAP_MARKEND; + + if (err != KErrNone) + { + User::Leave(err); // Not using LeaveIfError to allow positive error codes + } + } + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::SetupPsyL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::SetupPsyL(const TUid aPsyUid, + TPosSetupPsyDirective /*aDirective*/) + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(EFalse); + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + // Disable all PSY:s except aPsyUid + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != aPsyUid) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + + // Enable the PSY that came as an in parameter + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(aPsyUid, *moduleUpdate); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } +// --------------------------------------------------------- +// CT_LbsPortedStepBase::InitTestL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::InitTestL() + { + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::CloseTest() + { + } + +// --------------------------------------------------------- +// CTe_LbsPortedStepBase::ConnectL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::ConnectL() + { + TInt err = iPosServer.Connect(); + if (err != KErrNone) + { + _LIT(KOpenError, + "TP%d, part %d failed. Unable to open connection to Epos, err = %d"); + TBuf<100> error; + error.Format(KOpenError, iModuleId, iNrOfRequests, err); + LogErrorAndLeaveL(error); + } + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::OpenPositionerByName +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CT_LbsPortedStepBase::OpenPositionerByName( + const TUid aPsyUid) + { + TInt err = iPositioner.Open(iPosServer, aPsyUid); + return err; + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::OpenPositionerL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CT_LbsPortedStepBase::OpenPositioner() + { + TInt err = iPositioner.Open(iPosServer); + return err; + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::ClosePositioner +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::ClosePositioner() + { + iPositioner.Close(); + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::Disconnect +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::Disconnect() + { + iPosServer.Close(); + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::PerformRequest +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::PerformRequestL(const TDesC& aRequestor, + CRequestor::_TRequestorType aRequestorType, + CRequestor::_TRequestorFormat aRequestorFormat) + { + iNrOfRequests++; + + iModuleInfo = TPositionInfo(); + TInt err = iPositioner.SetRequestor(aRequestorType, + aRequestorFormat, aRequestor); + if (err != KErrNone) + { + _LIT(KErrRequestor, "Error when setting requestor in PerformRequestL"); + LogErrorAndLeaveL(KErrRequestor, err); + } + + iPositioner.NotifyPositionUpdate(iModuleInfo, iStatus); + } + +// --------------------------------------------------------- +// CTe_LbsPortedStepBase::PerformRequestL +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::PerformRequestL( + const TDesC& aService, const TDesC& aContact, + CRequestor::_TRequestorType aServiceIdType, + CRequestor::_TRequestorType aContactIdType, + CRequestor::_TRequestorFormat aServiceFormat, + CRequestor::_TRequestorFormat aContactFormat) + { + CRequestor* contactId = + CRequestor::New(aContactIdType, aContactFormat, + aContact); + + CRequestor* servId = + CRequestor::New(aServiceIdType, aServiceFormat, + aService); + + RRequestorStack stack = RRequestorStack(); + stack.Append(contactId); + stack.Append(servId); + + CleanupStack::PushL(contactId); + CleanupStack::PushL(servId); + + iNrOfRequests++; + + TInt err = iPositioner.SetRequestor(stack); + stack.Close(); + if (err != KErrNone) + { + _LIT(KErrRequestor, "Error when setting requestor in PerformRequestL"); + LogErrorAndLeaveL(KErrRequestor, err); + } + + CleanupStack::PopAndDestroy(servId); + CleanupStack::PopAndDestroy(contactId); + iModuleInfo = TPositionInfo(); + iPositioner.NotifyPositionUpdate(iModuleInfo, iStatus); + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::PerformSyncRequestL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CT_LbsPortedStepBase::PerformSyncRequest( + const TDesC& aServiceName, + TPositionInfoBase* aModuleInfo) + { + iNrOfRequests++; + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, aServiceName); + + iPositioner.NotifyPositionUpdate(*aModuleInfo, iStatus); + + User::WaitForRequest(iStatus); + TInt err = iStatus.Int(); + return err; + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::CheckRequestResultL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::CheckRequestResultL(TInt aExpectedErrorCode, TBool aLogFlag) + { + User::WaitForRequest(iStatus); + + if (iStatus != aExpectedErrorCode) + { + _LIT(KError, "TP%d, request %d failed. iStatus = %d"); + TBuf<100> error; + error.Format(KError, iModuleId, iNrOfRequests, iStatus.Int()); + LogErrorAndLeaveL(error); + } + else { + if (aLogFlag) + { + _LIT(KMsg, "TP%d, part %d completed."); + TBuf<30> msg; + msg.Format(KMsg, iModuleId, iNrOfRequests); + INFO_PRINTF1(msg); + } + } + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::AssertTrueL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::AssertTrueL(TBool aCondition, + const TDesC& aErrorMsg, TInt aErrorCode) + { + if (!aCondition) + { + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + LogErrorAndLeaveL(buf); + } + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::AssertTrueL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::AssertTrueL(TBool aCondition, + const TDesC& aErrorMsg) + { + if (!aCondition) + { + LogErrorAndLeaveL(aErrorMsg); + } + } + +// --------------------------------------------------------- +// CTe_LbsPortedStepBase::AllocPositionInfoL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TPositionInfo CT_LbsPortedStepBase::AllocPositionInfoL() + { + TPositionInfo moduleInfo = TPositionInfo(); + iPositioner.GetLastKnownPosition(moduleInfo, iStatus); + return moduleInfo; + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::VerifyPsyLoadedL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::VerifyPsyLoadedL(TPositionModuleId aUid) + { + _LIT(KVerPSYLoaded, "Verifies if PSY: %x, is loaded by getting its status"); + TBuf<100> buf; + buf.Format(KVerPSYLoaded, aUid.iUid); + INFO_PRINTF1(buf); + + _LIT(KDevStatusErr, "The PSY has not reported expected Device Status."); + TPositionModuleStatus moduleStatus; + iPosServer.GetModuleStatus (moduleStatus, aUid); + AssertTrueL(TPositionModuleStatus::EDeviceReady == moduleStatus.DeviceStatus(), + KDevStatusErr, KErrGeneral); + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::VerifyPsyUnloadedL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::VerifyPsyUnloadedL(TPositionModuleId aUid) + { + _LIT(KVerPSYUnloaded, "Verifies if PSY: %x, is unloaded by getting its status"); + TBuf<100> buf; + buf.Format(KVerPSYUnloaded, aUid.iUid); + INFO_PRINTF1(buf); + + _LIT(KDevStatusErr, "The PSY has not reported expected Device Status."); + TPositionModuleStatus moduleStatus; + iPosServer.GetModuleStatus(moduleStatus, aUid); + AssertTrueL(TPositionModuleStatus::EDeviceInactive == moduleStatus.DeviceStatus(), + KDevStatusErr, KErrGeneral); + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::RequestL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::RequestL(TPositionInfo& aPosInfo, + const TInt& aRequestIndex, + const TInt& aExpectedErrorCode) + { + TBuf<100> info; + _LIT(KInfo, "Making request: %d"); + _LIT(KInfoCompCode, "Making request: %d, expecting completion code: %d."); + if (aExpectedErrorCode != 999) + { + info.Format(KInfoCompCode, aRequestIndex, aExpectedErrorCode); + } + else + { + info.Format(KInfo, aRequestIndex); + } + INFO_PRINTF1(info); + + aPosInfo.SetUpdateType(aRequestIndex); // Used here as request index + + TTime starttime, stoptime; + starttime.UniversalTime(); + + TRequestStatus status; + iPositioner.NotifyPositionUpdate(aPosInfo, status); + User::WaitForRequest(status); + + stoptime.UniversalTime(); + iRequestTime = stoptime.Int64() - starttime.Int64(); + + if (aExpectedErrorCode != 999) + { + _LIT(KUnexpectedErrCode, "Unexpected error code %d, expected %d."); + TBuf<200> buf; + buf.Format(KUnexpectedErrCode, status.Int(), aExpectedErrorCode); + AssertTrueL(status.Int() == aExpectedErrorCode, buf); + } + } + +// --------------------------------------------------------- +// CT_LbsPortedStepBase::LogErrorAndLeave +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +EXPORT_C void CT_LbsPortedStepBase::LogErrorAndLeaveL(const TDesC& aErrorInfo, + const TInt aReason) + { + ERR_PRINTF2(aErrorInfo, aReason); + User::Leave(aReason); + } + +TVerdict CT_LbsPortedStepBase::doTestStepL() +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ + { + if (TestStepResult() == EPass) + { + CActiveScheduler* sched = new (ELeave) CActiveScheduler; + sched->Install(sched); + CleanupStack::PushL(sched); + StartL(0); + CleanupStack::PopAndDestroy(sched); + + SetTestStepResult(EPass); + } + return TestStepResult(); + } + +// --------------------------------------------------------- +// CPosSimulationPSYTestProcedureBase::SetSimDataFile() +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::SetSimDataFileL(const TDesC& aFileName) + { + CRepository* repository = + CRepository::NewLC(KCRUidSimulationPSY); + TInt err = repository->Set(KCRKeySimPSYSimulationFile, + aFileName); + if (err != KErrNone) + { + _LIT(KErr, "CRepository::Set(KCRKeySimPSYSimulationFile...) returned error"); + INFO_PRINTF1(KErr); + LogErrorAndLeaveL(KErr); + } + + CleanupStack::PopAndDestroy(repository); + } + +// --------------------------------------------------------- +// CPosSimulationPSYTestProcedureBase::ResetDefaultPSYLastWorkingExtGPSPSYL() +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::ResetDefaultPSYLastWorkingExtGPSPSYL() + { + TPositionModuleId modId = KPositionNullModuleId; + + CRepository* repos = CRepository::NewL( KCRUidDefaultProxyConfiguration ); + TBuf<40> idBuf; + idBuf.AppendNumFixedWidth( modId.iUid, EHex, 8); + TInt err = repos->Set(KDefaultProxyLastWorkingGpsPsy, idBuf); + delete repos; + User::LeaveIfError(err); + + _LIT(KInfo, "ResetDefaultPSYLastWorkingExtGPSPSYL successfully executed."); + INFO_PRINTF1(KInfo); + } + +// --------------------------------------------------------- +// CPosSimulationPSYTestProcedureBase::VerifyPositionFromL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::VerifyPositionFromL(TPositionInfo& aPosInfo, + TPositionModuleId& aModuleId) + { + if (aModuleId.iUid != aPosInfo.ModuleId().iUid) + { + _LIT(KIncorrPsyErr, + "Position from wrong PSY received, got position from: %x, expected: %x."); + TBuf<200> buf; + buf.Format(KIncorrPsyErr, aPosInfo.ModuleId().iUid, aModuleId.iUid); + LogErrorAndLeaveL(buf); + } + } + +// --------------------------------------------------------- +// CPosSimulationPSYTestProcedureBase::VerifyPositionL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::VerifyPositionL(TPositionInfo& aPosInfo, + TReal64 aLat, TReal64 aLong, TReal64 aAlt) + { + _LIT(KWrongFix, "Wrong Fix"); + TPosition pos; + aPosInfo.GetPosition(pos); + AssertTrueL( aLat == pos.Latitude(), KWrongFix); + AssertTrueL( aLong == pos.Longitude(), KWrongFix); + AssertTrueL( aAlt == pos.Altitude(), KWrongFix); + } + +// --------------------------------------------------------- +// CPosSimulationPSYTestProcedureBase::VerifyRequestTimeLessThanL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPortedStepBase::VerifyRequestTimeLessThanL(TInt aExpectedReqTime) + { + if (iRequestTime > aExpectedReqTime) + { + _LIT(KTime, "Request time for last request was more than: %d"); + TBuf<100> buf; + buf.Format(KTime, aExpectedReqTime); + INFO_PRINTF1(buf); + } + } + +void CT_LbsPortedStepBase::ConstructL() + { + iScheduler = new ( ELeave ) CActiveScheduler; + CActiveScheduler::Install(iScheduler); + User::LeaveIfError(iFileServer.Connect()); + } +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsposclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsposclient.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,209 @@ +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsposclient.h" +#include "ctlbsposclientholder.h" +#include +#include + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CT_LbsPosClient::CT_LbsPosClient(CT_LbsPosClientHolder* aParent) +: CActive(EPriorityHigh), iParent(aParent) + { + CActiveScheduler::Add(this); + } + +// Destructor +CT_LbsPosClient::~CT_LbsPosClient() + { + Cancel(); + iPositioner.Close(); + if (!iSameClient) + iPosServer.Close(); + } + +// --------------------------------------------------------- +// CPosClient::ConstructL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClient::ConstructL(TUid aPsy) + { + //connect to EPos + User::LeaveIfError(iPosServer.Connect()); + iSameClient = EFalse; + //Open subsession + User::LeaveIfError(iPositioner.Open(iPosServer, aPsy)); + iModuleInfo = TPositionInfo(); + } + +// --------------------------------------------------------- +// CPosClient::ConstructL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClient::ConstructL(TUid aPsy, RPositionServer& aPositionServer) + { + //connect to EPos + //User::LeaveIfError(iPosServer.Connect()); + iPosServer = aPositionServer; + iSameClient = ETrue; + //Open subsession + User::LeaveIfError(iPositioner.Open(iPosServer, aPsy)); + iModuleInfo = TPositionInfo(); + } +// --------------------------------------------------------- +// CPosClient::NewL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +CT_LbsPosClient* CT_LbsPosClient::NewL(CT_LbsPosClientHolder* aParent, TUid aPsy) + { + CT_LbsPosClient* self = new (ELeave) CT_LbsPosClient(aParent); + CleanupStack::PushL(self); + self->ConstructL(aPsy); + CleanupStack::Pop(self); // self + return self; + } + +// --------------------------------------------------------- +// CPosClient::NewL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +CT_LbsPosClient* CT_LbsPosClient::NewL(CT_LbsPosClientHolder* aParent, TUid aPsy, RPositionServer& aPositionServer) + { + CT_LbsPosClient* self = new (ELeave) CT_LbsPosClient(aParent); + CleanupStack::PushL(self); + self->ConstructL(aPsy, aPositionServer); + CleanupStack::Pop(self); // self + return self; + } + + +// --------------------------------------------------------- +// CPosClient::MakeRequest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClient::MakeRequest() + { + _LIT(KContact, "11111"); + _LIT(KService, "SAAA"); + + //TPositionInfo moduleInfo = TPositionInfo(); + + CRequestor* contactId = + CRequestor::New(CRequestor::ERequestorContact, + CRequestor::EFormatTelephone, KContact); + + CRequestor* servId = + CRequestor::New(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KService); + + RRequestorStack stack = RRequestorStack(); + stack.Append(contactId); + stack.Append(servId); + + CleanupStack::PushL(contactId); + CleanupStack::PushL(servId); + + TInt err = iPositioner.SetRequestor(stack); + // what to do with err ??? + + if (err) + { + // Do something here? + } + stack.Close(); + + CleanupStack::PopAndDestroy(servId); + CleanupStack::PopAndDestroy(contactId); + + iStartTime.UniversalTime(); + + iPositioner.NotifyPositionUpdate(iModuleInfo, iStatus); + SetActive(); + } + +// --------------------------------------------------------- +// CPosClient::RunL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClient::RunL() + { + if (iStatus == KErrNone) + { + TTime now; + now.UniversalTime(); + iRequestTime = now.MicroSecondsFrom(iStartTime); + + iParent->HandleRequestDone(); + } + else + { + _LIT(KErr, "iStatus != KErrNone"); + RDebug::Print(KErr); + iParent->HandleRequestDone(); + } + } + +// --------------------------------------------------------- +// CPosClient::DoCancel +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClient::DoCancel() + { + iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); // Specified in LbsIpc.h + TTime now; + now.UniversalTime(); + iRequestTime = now.MicroSecondsFrom(iStartTime); + } + +// --------------------------------------------------------- +// CPosClient::GetResult +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClient::GetResult( + TInt& aStatus, + TPositionInfo& aModuleInfo, + TTimeIntervalMicroSeconds& aRequestTime) + { + aStatus = iStatus.Int(); + aModuleInfo = iModuleInfo; + aRequestTime = iRequestTime; + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsposclientholder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsposclientholder.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,224 @@ +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsposclientholder.h" +#include "ctlbsposclient.h" + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CT_LbsPosClientHolder::CT_LbsPosClientHolder() +: CActive(EPriorityHigh), iRequestsActive(EFalse), iCancelTime(0) + { + } + +// --------------------------------------------------------- +// CT_LbsPosClientHolder::ConstructL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClientHolder::ConstructL(TInt aRequestCount, TUid aPsy, TBool aSameServer) + { + User::LeaveIfError(iTimer.CreateLocal()); + CActiveScheduler::Add(this); + User::LeaveIfError(iPosServer.Connect()); + CT_LbsPosClient* requester = NULL; + for (TInt i = 0; i < aRequestCount; i++) + { + if (aSameServer) + { + requester = CT_LbsPosClient::NewL(this, aPsy,iPosServer); + } + else + { + requester = CT_LbsPosClient::NewL(this, aPsy); + } + CleanupStack::PushL(requester); + User::LeaveIfError(iRequesters.Append(requester)); + CleanupStack::Pop(requester); + } + } + +// --------------------------------------------------------- +// CT_LbsPosClientHolder::NewLC +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +CT_LbsPosClientHolder* CT_LbsPosClientHolder::NewLC(TInt aRequestCount, TUid aPsy, TBool aSameServer) + { + CT_LbsPosClientHolder* self = new (ELeave) CT_LbsPosClientHolder; + CleanupStack::PushL(self); + self->ConstructL(aRequestCount, aPsy, aSameServer); + return self; + } + + + +// Destructor +CT_LbsPosClientHolder::~CT_LbsPosClientHolder() + { + Cancel(); + iTimer.Close(); + iRequesters.ResetAndDestroy(); + iRequesters.Close(); + iRequestersWhoWillCancel.Close(); + iPosServer.Close(); + } + +// --------------------------------------------------------- +// CT_LbsPosClientHolder::MakeRequests +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClientHolder::MakeRequests() + { + if (iRequestsActive) + { + return; + } + iRequestsActive = ETrue; + TInt requesterCount = iRequesters.Count(); + iNofRequestsDone = 0; + for (TInt i = 0; i < requesterCount; i++) + { + iRequesters[i]->MakeRequest(); + } + + // initiate cancelling if this is set. + if (iRequestersWhoWillCancel.Count() > 0) + { + iTimer.After(iStatus, iCancelTime); + SetActive(); + } + + CActiveScheduler::Start(); + } + +// --------------------------------------------------------- +// CT_LbsPosClientHolder::HandleRequestDone +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClientHolder::HandleRequestDone() + { + iNofRequestsDone++; + if (iNofRequestsDone == iRequesters.Count()) + { + iRequestsActive = EFalse; + CActiveScheduler::Stop(); + } + } + +// --------------------------------------------------------- +// CT_LbsPosClientHolder::RunL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClientHolder::RunL() + { + // Cancel certain requests. + TInt nofRequestersWhoWillCancel = iRequestersWhoWillCancel.Count(); + for (TInt i = 0; i < nofRequestersWhoWillCancel; i++) + { + iRequesters[iRequestersWhoWillCancel[i]]->Cancel(); + HandleRequestDone(); + } + } + +// --------------------------------------------------------- +// CT_LbsPosClientHolder::DoCancel +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClientHolder::DoCancel() + { + iTimer.Cancel(); + } + +void CT_LbsPosClientHolder::StopRequests() + { + if (!iRequestsActive) + { + return; + } + Cancel(); + TInt requesterCount = iRequesters.Count(); + for (TInt i = 0; i < requesterCount; i++) + { + iRequesters[i]->Cancel(); + } + CActiveScheduler::Stop(); + iRequestsActive = EFalse; + } + +// --------------------------------------------------------- +// CT_LbsPosClientHolder::GetResult +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClientHolder::GetResult( + TInt& aStatus, + TPositionInfo& aModuleInfo, + TTimeIntervalMicroSeconds& aRequestTime, + TInt aRequesterIndex) + { + iRequesters[aRequesterIndex]->GetResult(aStatus, aModuleInfo, aRequestTime); + } + + + +// --------------------------------------------------------- +// CT_LbsPosClientHolder::SetRequesterWillCancelL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClientHolder::SetCancelTime(TTimeIntervalMicroSeconds32 aTimeInterval) + { + iCancelTime = aTimeInterval; + } + +// --------------------------------------------------------- +// CT_LbsPosClientHolder::SetRequesterWillCancelL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsPosClientHolder::SetRequesterWillCancelL(TInt aIndex) + { + TInt length = iRequestersWhoWillCancel.Count(); + for (TInt i = 0; i < length; i++) + { + if (iRequestersWhoWillCancel[i] == aIndex) return; + } + User::LeaveIfError(iRequestersWhoWillCancel.Append(aIndex)); + } + + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsrequester.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsrequester.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,261 @@ +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDE FILES +#include "ctlbsrequester.h" +#include "mctlbsrequestobserver.h" + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// Two-phased constructor. +CT_LbsRequester* CT_LbsRequester::NewL( + TUid aPsyUid, + MCT_LbsRequestObserver* aObserver, + CTestExecuteLogger& aLogger + ) + { + CT_LbsRequester* self = new (ELeave) CT_LbsRequester(aObserver); + CleanupStack::PushL(self); + self->ConstructL(aPsyUid, aLogger); + CleanupStack::Pop(); + return self; + } + +// Two-phased constructor. +CT_LbsRequester* CT_LbsRequester::NewL( + MCT_LbsRequestObserver* aObserver, + TTimeIntervalMicroSeconds aInterval, + CTestExecuteLogger& aLogger + ) + { + CT_LbsRequester* self = new (ELeave) CT_LbsRequester(aObserver); + CleanupStack::PushL(self); + self->ConstructL(aInterval, aLogger); + CleanupStack::Pop(); + return self; + } + +// Destructor +CT_LbsRequester::~CT_LbsRequester() + { + iObserver = NULL; + Cancel(); + iPositioner.Close(); + iPosServer.Close(); + } + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CT_LbsRequester::CT_LbsRequester( + MCT_LbsRequestObserver* aObserver) + : CActive(EPriorityStandard), iObserver(aObserver) + { + } + +// EPOC default constructor can leave. +void CT_LbsRequester::ConstructL( + TUid aPsyUid, + CTestExecuteLogger& aLogger + ) + { + iLogger = aLogger; + User::LeaveIfError(iPosServer.Connect()); + iModuleInfo = TPositionInfo(); + iCompletionCode = KErrNone; + User::LeaveIfError(iPositioner.Open(iPosServer, aPsyUid)); + _LIT(KService, "SAAA"); + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, + KService); + CActiveScheduler::Add(this); + } + +void CT_LbsRequester::ConstructL( + TTimeIntervalMicroSeconds aInterval, + CTestExecuteLogger& aLogger + ) + { + iLogger = aLogger; + User::LeaveIfError(iPosServer.Connect()); + iModuleInfo = TPositionInfo(); + iCompletionCode = KErrNone; + User::LeaveIfError(iPositioner.Open(iPosServer)); + TPositionUpdateOptions posOption; + posOption.SetUpdateInterval(aInterval); + User::LeaveIfError(iPositioner.SetUpdateOptions(posOption)); + _LIT(KService, "SAAA"); + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, + KService); + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------- +// CT_LbsRequester::CompletionTimeUTC +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +const TTime& CT_LbsRequester::CompletionTimeUTC() const + { + return iCompletionTimeUTC; + } + +// --------------------------------------------------------- +// CT_LbsRequester::CompletionCode +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CT_LbsRequester::CompletionCode() const + { + return iCompletionCode; + } + +// --------------------------------------------------------- +// CT_LbsRequester::StartRequest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsRequester::SetUpdateIntervalL(TTimeIntervalMicroSeconds aInterval) + { + TPositionUpdateOptions posOption; + posOption.SetUpdateInterval(aInterval); + User::LeaveIfError(iPositioner.SetUpdateOptions(posOption)); + } + +// --------------------------------------------------------- +// CT_LbsRequester::StartRequest +// +// (other items were commented in a header). +// --------------------------------------------------------- +void CT_LbsRequester::StartRequest() + { + iPositioner.NotifyPositionUpdate(iModuleInfo, iStatus); + SetActive(); + } + +// LOCAL FUNCTIONS +void CleanOpRequestorStack(TAny* aAnArray) + { + // Cleanup function the requestor stack + RRequestorStack* theStack = reinterpret_cast (aAnArray); + theStack->ResetAndDestroy(); + } + +// --------------------------------------------------------- +// CT_LbsRequester::SetRequestorStackL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CT_LbsRequester::SetRequestorStackL(const TDesC& aService, const TDesC& aContact) + { + CRequestor* contactId = + CRequestor::New(CRequestor::ERequestorContact, CRequestor::EFormatTelephone, + aContact); + + CRequestor* servId = + CRequestor::New(CRequestor::ERequestorService, CRequestor::EFormatApplication, + aService); + + // Create a requestor stack containing one contact and one service (the service must be last added) + RRequestorStack stack = RRequestorStack(); + CleanupStack::PushL(TCleanupItem(CleanOpRequestorStack ,&stack)); + stack.Append(contactId); + stack.Append(servId); + + CleanupStack::PushL(contactId); + CleanupStack::PushL(servId); + + TInt err = iPositioner.SetRequestor(stack); + + CleanupStack::PopAndDestroy(servId); + CleanupStack::PopAndDestroy(contactId); + stack.Close(); + CleanupStack::PopAndDestroy(1); // CleanOpTp226 stack + + return err; + } + +// --------------------------------------------------------- +// CT_LbsRequester::RunL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsRequester::RunL() + { + iCompletionCode = iStatus.Int(); + iCompletionTimeUTC.UniversalTime(); + RequestComplete(); + } + +// --------------------------------------------------------- +// CT_LbsRequester::DoCancel +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsRequester::DoCancel() + { + iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); + iCompletionTimeUTC.UniversalTime(); + RequestComplete(); + } + +// --------------------------------------------------------- +// CT_LbsRequester::RequestComplete +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsRequester::RequestComplete() + { + if (iObserver) + { + TRAPD(err, iObserver->RequestCompleteL()); + if(KErrNone != err) + { + _LIT(KRequestCompleteError, "Error in LbsRequester: %d"); + ERR_PRINTF2(KRequestCompleteError, err); + } + } + } + +void CT_LbsRequester::GetPositionInfo( + TPositionInfo& aModuleInfo) + { + aModuleInfo = iModuleInfo; + } + +// --------------------------------------------------------- +// CT_LbsRequester::SetUpdateType +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsRequester::SetUpdateType(const TInt& aUpdateType) + { + iModuleInfo.SetUpdateType(aUpdateType); + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsserver.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,221 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsServer.cpp +// This is the class implementation for the LBS Test Server +// +// + +// User includes +#include "ctlbsserver.h" + +// System includes +#include +#include + +// Header files of LBS API Test Steps +#include "ctlbsstepinstallscheduler.h" +#include "ctlbsstepcreateverifymoduledata.h" +#include "ctlbsstepcreateverifyposinfos.h" +#include "ctlbsstepverifyposinfos.h" +#include "ctlbsstepverifyroughposinfos.h" +#include "ctlbsstepverifymodinfo.h" +#include "ctlbsstepverifyloginfo.h" +#include "ctlbsstepverifymodstatus.h" +#include "ctlbsstepsetautonomousmode.h" +#include "ctlbsstepsetprivhandler.h" +#include "ctlbsstepresetdefaultadmin.h" +#include "ctlbsstepstartlbs.h" +#include "ctlbsstepstoplbs.h" +#include "ctlbsstepcreateverifymodinfo.h" +#include "ctlbsstepclearlog.h" +#include "ctlbsstepconfighybridmodule.h" +#include "ctlbsstepsetupstandaloneprivacymode.h" +#include "ctlbsstepsetupstandaloneprivacyandsimplectlr.h" +#include "ctlbsstepsetupstandaloneprivacywithnoctlr.h" +#include "ctlbsstepsetbehaviourmodeoriginal.h" +#include "ctlbsstepsetptamode.h" +#include "ctlbsstepsetatamode.h" +#include "ctlbsstepsetptbmode.h" + +CT_LbsServer::~CT_LbsServer() + { + delete iSharedData; + delete iScheduler; + } + + +/** + Function : CT_LbsServer + Description : Constructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +CT_LbsServer::CT_LbsServer() + { + } + +/** + Function : ConstructL + Description : + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +void CT_LbsServer::ConstructL(const TDesC& aName) + { + CTestServer::ConstructL(aName); + + iScheduler = new (ELeave) CActiveScheduler(); + + // check what this does, do we need it... + Logger().ShareAuto(); // enable the log system for all test threads via iParent.Logger() + } + + +/** + Function : CreateTestStep + Description : Creates a test step based on the step name read from the script file + @internalTechnology + @param : aStepName The step name which needs to be created + @return : Created object of type CTestStep + @precondition : none + @postcondition : none +*/ +CTestStep* CT_LbsServer::CreateTestStep(const TDesC& aStepName) + { + // NULL if insufficient memory. This suits the API. + + // Common test steps, used by many different test cases. + if (aStepName == KLbsStep_InstallScheduler) + { + return CT_LbsStep_InstallScheduler::New(*this); + } + + if (aStepName == KLbsStep_CreateVerifyModuleData) + { + return CT_LbsStep_CreateVerifyModuleData::New(*this); + } + + if (aStepName == KLbsStep_CreateVerifyPosInfos) + { + return CT_LbsStep_CreateVerifyPosInfos::New(*this); + } + + if (aStepName == KLbsStep_CreateVerifyModInfo) + { + return CT_LbsStep_CreateVerifyModInfo::New(*this); + } + + if (aStepName == KLbsStep_VerifyPosInfos) + { + return CT_LbsStep_VerifyPosInfos::New(*this); + } + + if (aStepName == KLbsStep_VerifyRoughPosInfos) + { + return CT_LbsStep_VerifyRoughPosInfos::New(*this); + } + + if(aStepName == KLbsStep_VerifyModInfo) + { + return CT_LbsStep_VerifyModInfo::New(*this); + } + + if (aStepName == KLbsStep_VerifyLogInfo) + { + return CT_LbsStep_VerifyLogInfo::New(*this); + } + + if (aStepName == KLbsStep_VerifyModuleStatus) + { + return CT_LbsStep_VerifyModStatus::New(*this); + } + + if (aStepName == KLbsStep_StartLbs) + { + return CT_LbsStep_StartLbs::New(*this); + } + + if (aStepName == KLbsStep_StopLbs) + { + return CT_LbsStep_StopLbs::New(*this); + } + + if (aStepName == KLbsStep_SetAutonomousMode) + { + return CT_LbsStep_SetAutonomousMode::New(*this); + } + + if (aStepName == KLbsStep_SetPrivacyHandler) + { + return CT_LbsStep_SetPrivacyHandler::New(*this); + } + + if (aStepName == KLbsStep_ResetDefaultAdmin) + { + return CT_LbsStep_ResetDefaultAdmin::New(*this); + } + + if (aStepName == KLbsStep_ClearLog) + { + return CT_LbsStep_ClearLog::New(*this); + } + + if (aStepName == KLbsStep_SetBehaviourModeOriginal) + { + return CT_LbsStep_SetBehaviourModeOriginal::New(*this); + } + + if (aStepName == KLbsStep_SetPTAMode) + { + return CT_LbsStep_SetPTAMode::New(*this); + } + + if (aStepName == KLbsStep_ConfigHybridModule) + { + return CT_LbsStep_ConfigHybridModule::New(*this); + } + + if (aStepName == KLbsStep_SetupStandalonePrivacyMode) + { + return CT_LbsStep_SetupStandalonePrivacyMode::New(*this); + } + + if (aStepName == KLbsStep_SetupStandalonePrivacyAndSimpleCtlr) + { + return CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr::New(*this); + } + + if (aStepName == KLbsStep_SetupStandalonePrivacyWithNoCtlr) + { + return CT_LbsStep_SetupStandalonePrivacyWithNoCtlr::New(*this); + } + + if (aStepName == KLbsStep_SetATAMode) + { + return CT_LbsStep_SetATAMode::New(*this); + } + + if (aStepName == KLbsStep_SetPTBMode) + { + return CT_LbsStep_SetPTBMode::New(*this); + } + + return NULL; + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsshareddata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsshareddata.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,111 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsSharedData.cpp +// This file contains the shared data class for the Lbs Test server +// +// + + +#include "ctlbsshareddata.h" + +/** + Function : NewL + Description : Constructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +CT_LbsSharedData* CT_LbsSharedData::NewL() + { + CT_LbsSharedData* sharedData=new(ELeave) CT_LbsSharedData(); + CleanupStack::PushL(sharedData); + sharedData->ConstructL(); + CleanupStack::Pop(sharedData); + + return sharedData; + } + + +/** + Function : ConstructL + Description : Constructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +void CT_LbsSharedData::ConstructL() + { + } + + +/** + Function : CT_LbsSharedData + Description : Constructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +CT_LbsSharedData::CT_LbsSharedData() + { + iTestModuleInUse = ETrue; // Default is to use the test module. + } + +/** + Function : ~CT_LbsSharedData + Description : Destructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +CT_LbsSharedData::~CT_LbsSharedData() + { + // Clear arrays. + for (TInt i = 0; i < iVerifyPosInfoArr.Count(); ++i) + delete iVerifyPosInfoArr[i]; + iVerifyPosInfoArr.Close(); + + for (TInt i = 0; i < iCurrentPosInfoArr.Count(); ++i) + delete iCurrentPosInfoArr[i]; + iCurrentPosInfoArr.Close(); + + //Clear logging arays + for (TInt i = 0; i < iSelfLocateLogInfoArr.Count(); ++i) + delete iSelfLocateLogInfoArr[i]; + iSelfLocateLogInfoArr.Close(); + + for (TInt i = 0; i < iNetworkLocateLogInfoArr.Count(); ++i) + delete iNetworkLocateLogInfoArr[i]; + iNetworkLocateLogInfoArr.Close(); + + for (TInt i = 0; i < iExternalLocateLogInfoArr.Count(); ++i) + delete iExternalLocateLogInfoArr[i]; + iExternalLocateLogInfoArr.Close(); + + for (TInt i = 0; i < iX3PLocateLogInfoArr.Count(); ++i) + delete iX3PLocateLogInfoArr[i]; + iX3PLocateLogInfoArr.Close(); + + for (TInt i = 0; i < iAssistanceDataLogInfoArr.Count(); ++i) + delete iAssistanceDataLogInfoArr[i]; + iAssistanceDataLogInfoArr.Close(); + + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstep.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,67 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsStep.cpp +// This is the class implementation for the LBS Test Step Base +// +// + +#include "ctlbsstep.h" + +#include "tlbsutils.h" +#include "ctlbsasyncwaiter.h" + + +/** + * @return - TVerdict + * Implementation of CTestStep base class virtual + * It is used for doing all initialisation common to derived classes in here. + * Make it being able to leave if there are any errors here as there's no point in + * trying to run a test step if anything fails. + * The leave will be picked up by the framework. + */ +TVerdict CT_LbsStep::doTestStepPreambleL() + { + // Process some common pre setting to test steps then set SetTestStepResult to EFail or Epass. + INFO_PRINTF1(_L(">>CT_LbsStep::doTestStepPreambleL()")); + SetTestStepResult(EPass); + + return TestStepResult(); + } + + +/** + * @return - TVerdict + * Implementation of CTestStep base class virtual + * It is used for doing all after test treatment common to derived classes in here. + * Make it being able to leave + * The leave will be picked up by the framework. + */ +TVerdict CT_LbsStep::doTestStepPostambleL() + { + // Process some common post setting to test steps then set SetTestStepResult to EFail or Epass. + INFO_PRINTF1(_L(">>CT_LbsStep::doTestStepPostabmleL()")); + + //SetTestStepResult(EPass); // or EFail + return TestStepResult(); + } + + +CT_LbsStep::~CT_LbsStep() + { + } + + +CT_LbsStep::CT_LbsStep(CT_LbsServer& aParent) : iParent(aParent) + { + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepclearlog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepclearlog.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,145 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepclearlog.cpp +// This is the class implementation to clear the log file +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include "ctlbsstepclearlog.h" + + +CT_LbsStep_ClearLog::CT_LbsStep_ClearLog(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_ClearLog); + } + +/** +Static Constructor +*/ +CT_LbsStep_ClearLog* CT_LbsStep_ClearLog::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_ClearLog(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** +@pre +@return Test verdict +@post Log file cleared +*/ + +TVerdict CT_LbsStep_ClearLog::doTestStepL() + { + SetTestStepResult(EPass); + + // Create necessary variables for Log reading + RFs theFs; + CLogClient* client; + CLogViewEvent* view; + CT_LbsAsyncWaiter* activeWaiter; + + // Initialise variables + TInt ErrorCode = theFs.Connect(); + if(ErrorCode) + { + INFO_PRINTF1(_L("\t Error: Open FileServer failed.")); + SetTestStepResult(EFail); + } + + + client = CLogClient::NewL(theFs, CActive::EPriorityStandard); + view = CLogViewEvent::NewL(*client, CActive::EPriorityStandard); + activeWaiter = CT_LbsAsyncWaiter::NewL(); // NEW activeWaiter + + + // Setup a time in the future, before which all events will be deleted + _LIT(KDateCorrect1,"20900101:"); + TTime time; + TBuf <10> theDate(KDateCorrect1); + TInt err=time.Set(theDate); + + // Ensure time has been set correctly + if(err != KErrNone) + { + INFO_PRINTF1(_L("Failed to set time")); + } + + if(err == KErrGeneral) + { + INFO_PRINTF1(_L("Time syntax is incorrect")); + } + + // Set the filter to view ALL logs + CLogFilter* filter = CLogFilter::NewL(); // NEW FILTER + CleanupStack::PushL(filter); + TBool res = view->SetFilterL(*filter, activeWaiter->iStatus); + if (res == EFalse) + { + INFO_PRINTF1(_L("\t No such events to filter in the view.")); + client->Cancel(); + } + else + { + // else If there are logs, flush them + + // Cancel outstanding requests + client->Cancel(); + activeWaiter->StartAndWait(); + if (activeWaiter->iStatus != KErrNone) + { + INFO_PRINTF2(_L("\t Error: Cancel returned error %d."),activeWaiter->iStatus.Int()); + SetTestStepResult(EFail); + } + + // Clear ALL logs + client->ClearLog(time, activeWaiter->iStatus); + activeWaiter->StartAndWait(); + if (activeWaiter->iStatus != KErrNone) + { + INFO_PRINTF2(_L("\t Error: Clear log returned error %d."),activeWaiter->iStatus.Int()); + SetTestStepResult(EFail); + } + + //Confirm log is cleared + if(view->CountL() != 0) + { + INFO_PRINTF2(_L("ERROR: Log still has %d entries"),view->CountL()); + SetTestStepResult(EFail); + } + + } + + CleanupStack::PopAndDestroy(filter); + + // Cleanup everything + view->Cancel(); + client->Cancel(); + + delete view; + delete client; + theFs.Close(); + delete activeWaiter; + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepconfighybridmodule.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepconfighybridmodule.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This is the class implementation for the configuration of the AGPS Hybrid Module +// The main purpose of this test step is to allow flexible configurability of the AGps Hybrid Module +// from the Test Harness. +// Various configuration options are read from the ini files and sent to the AGps Hybrid Module through the TH channel. +// The AGps Hybrid Module always acknowledges each configuration message (see ProcessAGpsResponseMessage() method below). +// This test step has been written to understand '.ini' files containing sections such as [Config2] below: +// [Config2] +// agps_module_update_file = c:\testdata\configs\lbs_molr.ini +// agps_module_multi_updates_opt = on +// agps_module_assistance_data_opt= on +// $update,1,2,49.2,NAN,NAN,2,3* +// $update,1,2,49.2,NAN,NAN,2,3* +// $update,1,2,49.2,3.5,50,2,3* +// => Current module possible options are: +// agps_module_multi_updates_opt = [ on | off ] +// It sets the module to send multiple updates after Target Time. +// - When this mode is "off" only one update is sent just after 'Target time' (that is, the next update item available +// from the module's update array). +// - When this mode is "on", the module sends N + 1 updates between 'Target time' and 'Max fix time' +// (currently hardcoded -> N = 2). +// The final update is the next update item available from the module's update array. +// The module calculates the first N updates from the final update, these updates contain incomplete +// positions (NAN longitude and latitude, ...). +// Note:'Target time' specifies the time when the location update should be provided by the AGPS module. +// 'Max fix time' specifies the time maximum time the module should spend calculating the current location. +// agps_module_assistance_data_opt = [ on | off ] +// Only applicable when in Preferred Terminal Mode. +// - When this mode is "on", for each new location request the AGps Module may Request new Assistance Data +// (if it has not been delivered already, sometimes assistance data is delivered to the module before it is requested). +// - When this mode is off, the default RequestAssistanceData(EAssistanceDataNone) call will always be made. +// agps_module_dynamic_ass_data_opt = [ on | off ] (off by default) +// Switches between different assistance data delivery methods: +// -> OFF - On the first RequestAssistanceData requests the assistance data aDataMask is always set to +// the assistance data that it needs. However for all subsequent assistance data requests the +// aDataMask will always be set to 0. This is the method used in all the hybrid tests. +// -> ON - Here the module will always request any assistance data that it has not yet received. So on +// the first assistanceData request the aDataMask is set to the assistance data it requires. On +// subsequent assistance data requests it will re-request the assistance data that has not yet +// been delivered. This is the method that should be used in SUPL tests. +// agps_module_clear_all_opt = [ on | off ] +// Sets all the possible module options to on. +// agps_module_set_all_opt = [ on | off ] +// Sets all the possible module options to off. +// => $update command: +// The $update entries in the ini files are used to populate the AGps Hybrid Module update array. +// Note: The Module's update array contains the update items used to generate the updates sent to the AGps Manager. +// The $update command syntax should be as follows: +// $update,num_of_updates,[num_of_measurements],[latitude],[longitude],[altitude],[horz_accuracy],[vert_accuracy],[update_err]* +// - where num_of_updates is the number of updates to add to the update array. For values greater than 1, each update +// will contain the same data position and measurement data as defined by the reminder of the sentence. +// - where num_of_measurements is the number of satellite measurements to define (see TPositionGpsMeasurementData). +// If this value is 0 no measurement data is defined and only the position data is defined. +// Values for the actual measurement data will be generated automatically. +// - where latitude, longitude, altitude, horz_accuracy, vert_accuracy are used to define the values for the +// TPositionInfo part of the TPositionSatelliteInfo. +// - where update_err, is the error code to return to the manager for the update. If NOT defined the value will be KErrNone. +// => Possible Enhancements: This test step might be enhanced later on to also additional functionality such as: +// agps_module_update_error = -1 +// agps_module_update_timeout = 5000000 +// agps_module_multi_updates_opt = 2 // where 2 is the number of multi updates sent before +// // the final update is sent prior to 'Max fix time' +// +// + + + +#include "ctlbsstepconfighybridmodule.h" + +#include "tlbsutils.h" + + +_LIT(KUpdateFile, "agps_module_update_file"); +_LIT(KClearAllOpt, "agps_module_clear_all_opt"); +_LIT(KAssistanceDataOpt, "agps_module_assistance_data_opt"); +_LIT(KMultiUpdateOpt, "agps_module_multi_updates_opt"); +_LIT(KReqAssDatReqOpt, "agps_module_req_ass_data_req_opt"); +_LIT(KSetAllOpt, "agps_module_set_all_opt"); +_LIT(KSuplAssDataOpt, "agps_module_dynamic_ass_data_opt"); +_LIT(KUpdateTimeout, "agps_module_update_timeout"); +_LIT(KOption_OFF, "off"); +_LIT(KOption_ON, "on"); +_LIT(KNoFileName, ""); + + +/** + * Constructor + */ +CT_LbsStep_ConfigHybridModule::CT_LbsStep_ConfigHybridModule(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_ConfigHybridModule); + } + + +/** +Static Constructor +*/ +CT_LbsStep_ConfigHybridModule* CT_LbsStep_ConfigHybridModule::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_ConfigHybridModule(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + +/** + * @return - TVerdict code + * Override of base class virtual + */ +TVerdict CT_LbsStep_ConfigHybridModule::doTestStepPreambleL() + { + INFO_PRINTF1(_L("Test Preamble. CT_LbsStep_ConfigHybridModule")); + + // create the test channel handler + iAGpsHandler = CT_LbsAGpsHandler::NewL(this); + + SetTestStepResult(EPass); + return TestStepResult(); + } + +/** + * @return - TVerdict code + * Override of base class virtual + */ +TVerdict CT_LbsStep_ConfigHybridModule::doTestStepPostambleL() + { + INFO_PRINTF1(_L("Test Postamble. CT_LbsStep_ConfigHybridModule")); + + delete iAGpsHandler; + iAGpsHandler = NULL; + + return TestStepResult(); + } + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsStep_ConfigHybridModule::doTestStepL() + { + INFO_PRINTF1(_L(">>CT_LbsStep_ConfigHybridModule::doTestStepL()")); // ?? + + if (TestStepResult() == EPass) + { + TPtrC configFileName; + GetStringFromConfig(ConfigSection(), KUpdateFile, configFileName); + if (configFileName != KNoFileName) + { + iConfigCtr++; + iAGpsHandler->SendRequestUpdateInitMsg(configFileName, ConfigSection()); + } + + TPtrC clearAllOpt; + GetStringFromConfig(ConfigSection(), KClearAllOpt, clearAllOpt); + if (clearAllOpt == KOption_ON) + { + iConfigCtr++; + iAGpsHandler->SendRequestClearAllModuleOptions(); + } + + TPtrC updateOpt; + GetStringFromConfig(ConfigSection(), KMultiUpdateOpt, updateOpt); + if (updateOpt == KOption_OFF) + { + iConfigCtr++; + iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_MultiUpdatesOn, EFalse); + } + else if (updateOpt == KOption_ON) + { + iConfigCtr++; + iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_MultiUpdatesOn, ETrue); + } + + TPtrC assDataOpt; + GetStringFromConfig(ConfigSection(), KAssistanceDataOpt, assDataOpt); + if (assDataOpt == KOption_OFF) + { + iConfigCtr++; + iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_AssistanceDataOn, EFalse); + } + else if (assDataOpt == KOption_ON) + { + iConfigCtr++; + iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_AssistanceDataOn, ETrue); + } + + + TPtrC reqAssDataOpt; + GetStringFromConfig(ConfigSection(), KReqAssDatReqOpt, reqAssDataOpt); + if (reqAssDataOpt == KOption_OFF) + { + iConfigCtr++; + iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_DisableReqAssistData, EFalse); + } + else if (reqAssDataOpt == KOption_ON) + { + iConfigCtr++; + iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_DisableReqAssistData, ETrue); + } + + + TPtrC suplAssDataOpt; + GetStringFromConfig(ConfigSection(), KSuplAssDataOpt, suplAssDataOpt); + if (suplAssDataOpt == KOption_OFF) + { + iConfigCtr++; + iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_DynamicAssistanceData, EFalse); + } + else if (suplAssDataOpt == KOption_ON) + { + iConfigCtr++; + iAGpsHandler->SendRequestModuleOption(ELbsHybridModuleOptions_DynamicAssistanceData, ETrue); + } + + + + TPtrC setAllOpt; + GetStringFromConfig(ConfigSection(), KSetAllOpt, setAllOpt); + if (setAllOpt == KOption_ON) + { + iConfigCtr++; + iAGpsHandler->SendRequestSetAllModuleOptions(); + } + TInt updateTimeout; + if (GetIntFromConfig(ConfigSection(), KUpdateTimeout, updateTimeout)) + { + TTimeIntervalMicroSeconds timeoutVal(updateTimeout); + + iConfigCtr++; + iAGpsHandler->SendRequestTimeOutMsg(timeoutVal); + } + + // All the configuration requests sent, now start the active scheduler + if (iConfigCtr) + { + CActiveScheduler::Start(); + } + } + + + INFO_PRINTF1(_L("<<CT_LbsStep_ConfigHybridModule::doTestStepL()")); //?? + + return TestStepResult(); + } + + +void CT_LbsStep_ConfigHybridModule::ProcessAGpsResponseMessage(const TT_LbsAGpsResponseMsg::TModuleResponseType aResponse) + { + iConfigCtr--; + + if (TT_LbsAGpsResponseMsg::EModuleResponseOk == aResponse) + { + // If any of the previous responses has failed do not override the verdict + if (iVerdict != EFail) + { + iVerdict = EPass; + } + } + else + { + iVerdict = EFail; + } + + if (!iConfigCtr) + { + SetTestStepResult(iVerdict); + CActiveScheduler::Stop(); + } + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepcreateupdateinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepcreateupdateinfo.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,67 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstep_createupdateinfo.cpp +// This is the class implementation for the Notify Position Update Tests +// +// + +#include "ctlbsstepcreateupdateinfo.h" + +#include "tlbsutils.h" + + +_LIT(KUpdateInfoFile, "update_info_file"); + +/** + * Constructor + */ +CT_LbsStep_CreateUpdateInfo::CT_LbsStep_CreateUpdateInfo(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_CreateUpdateInfo); + } + + +/** +Static Constructor +*/ +CT_LbsStep_CreateUpdateInfo* CT_LbsStep_CreateUpdateInfo::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_CreateUpdateInfo(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsStep_CreateUpdateInfo::doTestStepL() + { + INFO_PRINTF1(_L(">>CT_LbsStep_CreateUpdateInfo::doTestStepL()")); + + if (TestStepResult() == EPass) + { + TPtrC configFileName; + GetStringFromConfig(ConfigSection(), KUpdateInfoFile, configFileName); + RPointerArray& updateInfoArr = iParent.iSharedData->iUpdateArr; + //Populate the array by extracting the data from the ini file + } + + INFO_PRINTF1(_L("<<CT_LbsStep_CreateUpdateInfo::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepcreateverifymodinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepcreateverifymodinfo.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,80 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstep_createverifymodinfo.cpp +// This is the class implementation for the module info tests +// +// + +#include "ctlbsstepcreateverifymodinfo.h" + +#include "tlbsutils.h" + +//module_id in ini file +_LIT(KLbsModuleId, "module_id"); + +/** + * Constructor + */ +CT_LbsStep_CreateVerifyModInfo::CT_LbsStep_CreateVerifyModInfo(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_CreateVerifyModInfo); + } + + +/** +Static Constructor +*/ +CT_LbsStep_CreateVerifyModInfo* CT_LbsStep_CreateVerifyModInfo::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_CreateVerifyModInfo(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsStep_CreateVerifyModInfo::doTestStepL() + { + // Helper test step used to Create the Verify Mod Information + INFO_PRINTF1(_L(">>CT_LbsStep_CreateVerifyModInfo::doTestStepL()")); + + if (TestStepResult() == EPass) + { + TInt moduleid; + TBool moduleid_exists; + moduleid_exists = GetIntFromConfig(ConfigSection(), KLbsModuleId, moduleid); + if(!moduleid_exists) + { + INFO_PRINTF1(_L("Could not get module Id from section")); + SetTestStepResult(EFail); + } + + else + { + // Access the verify mod info and pass to utils func to be populated. + TPositionModuleInfo& modinfo = iParent.iSharedData->iVerifyModuleInfo; + T_LbsUtils utils; + TPositionModuleId moduleUid = TUid::Uid(moduleid); + utils.Create_ModuleInfoL(moduleUid,modinfo); + } + } + + INFO_PRINTF1(_L("<<CT_LbsStep_CreateVerifyModInfo::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepcreateverifymoduledata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepcreateverifymoduledata.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,104 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstep_createverifymoduledata.cpp +// This is the class implementation for the Notify Position Update Tests +// +// + +#include "ctlbsstepcreateverifymoduledata.h" + +#include "tlbsutils.h" + +/** + "module_data_file" = name of the .ini file containing the module data items including + position info array entries, module stauts, module update options. + + If the file name is not present the module data will contain default items. + See tlbsutils.cpp for details of support ini file commands. +*/ +_LIT(KModuleDataFile, "module_data_file"); + +/** + * Constructor + */ +CT_LbsStep_CreateVerifyModuleData::CT_LbsStep_CreateVerifyModuleData(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_CreateVerifyModuleData); + } + + +/** +Static Constructor +*/ +CT_LbsStep_CreateVerifyModuleData* CT_LbsStep_CreateVerifyModuleData::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_CreateVerifyModuleData(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsStep_CreateVerifyModuleData::doTestStepL() + { + // Helper test step used to Create the Verify Position Information Array. + INFO_PRINTF1(_L(">>CT_LbsStep_CreateVerifyModuleData::doTestStepL()")); + + if (TestStepResult() == EPass) + { + TPtrC configFileName; + GetStringFromConfig(ConfigSection(), KModuleDataFile, configFileName); + + // Access the verify pos array and pass to utils func to be populated. + RPointerArray& posInfoArr = iParent.iSharedData->iVerifyPosInfoArr; + TPositionUpdateOptions& updateOpts = iParent.iSharedData->iVerifyUpdateOpts; + TPositionModuleStatus& modStatus = iParent.iSharedData->iVerifyModuleStatus; + T_LbsUtils utils; + + // Populate the shared data items. + utils.GetConfigured_PosInfosL(configFileName, ConfigSection(), posInfoArr); // Note previous entries will be cleared. + utils.GetConfigured_ModuleStatusL(configFileName, ConfigSection(), modStatus); + utils.GetConfigured_ModuleUpdateOptionsL(configFileName, ConfigSection(), updateOpts); +// remove aove module does not know abot update options... + + // Notify the test module that it's required to update it's test data. + TPtrC modType; + GetStringFromConfig(ConfigSection(), KLbsModuleType, modType); + if (modType != KLbsModuleType_Real) + { + + TModuleDataIn modDataIn; + + modDataIn.iRequestType = TModuleDataIn::EModuleRequestConfig; + modDataIn.iConfigFileName = configFileName; + modDataIn.iConfigSection = ConfigSection(); + + // Now publish the ini file and section name to the test module - will block. + utils.NotifyModuleOfConfigChangeL(modDataIn); + } + else + { + iParent.iSharedData->iTestModuleInUse = EFalse; // Indicate to test harness the real A-GPS integration module is being used. + } + } + + INFO_PRINTF1(_L("<<CT_LbsStep_CreateVerifyModuleData::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepcreateverifyposinfos.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepcreateverifyposinfos.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,97 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstep_createverifyposinfos.cpp +// This is the class implementation for the Notify Position Update Tests +// +// + +#include "ctlbsstepcreateverifyposinfos.h" + +#include "tlbsutils.h" + +/** + "pos_infos_file" = name of the .ini file containing the position info array entries. + + If the file name is not present the array will contain a single default TPositionInfo entry. + See tlbsutils.cpp for details of support ini file commands. +*/ +_LIT(KPosInfosFile, "pos_infos_file"); + +/** + * Constructor + */ +CT_LbsStep_CreateVerifyPosInfos::CT_LbsStep_CreateVerifyPosInfos(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_CreateVerifyPosInfos); + } + + +/** +Static Constructor +*/ +CT_LbsStep_CreateVerifyPosInfos* CT_LbsStep_CreateVerifyPosInfos::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_CreateVerifyPosInfos(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsStep_CreateVerifyPosInfos::doTestStepL() + { + // Helper test step used to Create the Verify Position Information Array. + INFO_PRINTF1(_L(">>CT_LbsStep_CreateVerifyPosInfos::doTestStepL()")); + + if (TestStepResult() == EPass) + { + TPtrC configFileName; + GetStringFromConfig(ConfigSection(), KPosInfosFile, configFileName); + + // Access the verify pos array and pass to utils func to be populated. + RPointerArray& posInfoArr = iParent.iSharedData->iVerifyPosInfoArr; + T_LbsUtils utils; + + utils.GetConfigured_PosInfosL(configFileName, ConfigSection(), posInfoArr); // Note previous entries will be cleared. + + // Notify the test module that it's required to update it's test data. + TPtrC modType; + GetStringFromConfig(ConfigSection(), KLbsModuleType, modType); + if (modType != KLbsModuleType_Real) + { + + TModuleDataIn modDataIn; + + modDataIn.iRequestType = TModuleDataIn::EModuleRequestConfig; + modDataIn.iConfigFileName = configFileName; + modDataIn.iConfigSection = ConfigSection(); + + // Now publish the ini file and section name to the test module - will block. + utils.NotifyModuleOfConfigChangeL(modDataIn); + } + else + { + iParent.iSharedData->iTestModuleInUse = EFalse; // Indicate to test harness the real A-GPS integration module is being used. + } + } + + INFO_PRINTF1(_L("<<CT_LbsStep_CreateVerifyPosInfos::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepinstallscheduler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepinstallscheduler.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,64 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstep_installscheduler.cpp +// This is the class implementation for the Install Active Scheduler Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include "ctlbsstepinstallscheduler.h" + +CT_LbsStep_InstallScheduler::CT_LbsStep_InstallScheduler(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_InstallScheduler); + } + +/** +Static Constructor +*/ +CT_LbsStep_InstallScheduler* CT_LbsStep_InstallScheduler::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_InstallScheduler(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + +/** +@pre No Active Scheduler installed in the worker test thread +@return Test verdict +@post Test server's Active Scheduler member installed in worker thread +*/ +TVerdict CT_LbsStep_InstallScheduler::doTestStepL() + { + INFO_PRINTF1(_L(">>CT_LbsStep_InstallScheduler::doTestStepL()")); + + if( CActiveScheduler::Current() ) + { + INFO_PRINTF1(_L("Test Warning: Scheduler already installed in worker thread")); + + return TestStepResult(); + } + CActiveScheduler::Install( iParent.iScheduler ); + + INFO_PRINTF1(_L("<<CT_LbsStep_InstallScheduler::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepresetdefaultadmin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepresetdefaultadmin.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,84 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepresetdefaultadmin.cpp +// This is the class implementation for the Reset Default Admin Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include +#include "ctlbsstepresetdefaultadmin.h" +#include + +CT_LbsStep_ResetDefaultAdmin::CT_LbsStep_ResetDefaultAdmin(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_ResetDefaultAdmin); + } + +/** +Static Constructor +*/ +CT_LbsStep_ResetDefaultAdmin* CT_LbsStep_ResetDefaultAdmin::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_ResetDefaultAdmin(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** +@pre +@return Test verdict +@post All admin settings reset to default +*/ +TVerdict CT_LbsStep_ResetDefaultAdmin::doTestStepL() + { + INFO_PRINTF1(_L(">>CT_LbsStep_ResetDefaultAdmin::doTestStepL()")); + + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + + TInt err = adminApi->ResetToDefault(); + + if(!KErrNone == err) + { + SetTestStepResult(EFail); + } + + // Reset the LbsRoot cenrep also. + const TUid KLbsRootRepositoryUid = { 0x10282266 }; + CRepository* rootRep = CRepository::NewLC(KLbsRootRepositoryUid); + err = rootRep->Reset(); + + if(!KErrNone == err) + { + SetTestStepResult(EFail); + } + + INFO_PRINTF1(_L("<<CT_LbsStep_ResetDefaultAdmin::doTestStepL()")); + + CleanupStack::PopAndDestroy(2, adminApi); + + // Alow the change to be propagated + User::After(4000000); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetatamode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetatamode.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,99 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepsetatamode.cpp +// This is the class implementation for the Set Behaviour Mode Original Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include "ctlbsstepsetatamode.h" +#include + +CT_LbsStep_SetATAMode::CT_LbsStep_SetATAMode(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_SetATAMode); + } + +/** +Static Constructor +*/ +CT_LbsStep_SetATAMode* CT_LbsStep_SetATAMode::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_SetATAMode(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + */ +TBool CT_LbsStep_SetATAMode::SetAndVerifyATAModeL() + { + TBool ret = TRUE; + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + + TInt err = adminApi->Set(KLbsSettingRoamingGpsMode, CLbsAdmin::EGpsAlwaysTerminalAssisted); + User::LeaveIfError(err); + err = adminApi->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsAlwaysTerminalAssisted); + User::LeaveIfError(err); + // Alow he setting to be propagated + User::After(2000000); + + CLbsAdmin::TGpsMode gpsMode; + err = adminApi->Get(KLbsSettingRoamingGpsMode, gpsMode); + User::LeaveIfError(err); + if(gpsMode != CLbsAdmin::EGpsAlwaysTerminalAssisted) + { + INFO_PRINTF1(_L("Admin setting didn't work")); + ret = FALSE; + } + + err = adminApi->Get(KLbsSettingHomeGpsMode, gpsMode); + User::LeaveIfError(err); + if(gpsMode != CLbsAdmin::EGpsAlwaysTerminalAssisted) + { + INFO_PRINTF1(_L("Admin setting didn't work")); + ret = FALSE; + } + CleanupStack::PopAndDestroy(adminApi); + + return ret; + } + +/** +@pre +@return Test verdict +@post Lbs Behaviour mode set to "original" +*/ +TVerdict CT_LbsStep_SetATAMode::doTestStepL() + { + INFO_PRINTF1(_L(">>CT_LbsStep_SetATAMode::doTestStepL()")); + + if(!SetAndVerifyATAModeL()) + { + SetTestStepResult(EFail); + } + + INFO_PRINTF1(_L("<<CT_LbsStep_SetATAMode::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetautonomousmode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetautonomousmode.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,90 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstep_setautonomousmode.cpp +// This is the class implementation for the Set Autonomous Moder Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include "ctlbsstepsetautonomousmode.h" +#include + +CT_LbsStep_SetAutonomousMode::CT_LbsStep_SetAutonomousMode(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_SetAutonomousMode); + } + +/** +Static Constructor +*/ +CT_LbsStep_SetAutonomousMode* CT_LbsStep_SetAutonomousMode::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_SetAutonomousMode(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + */ +TBool CT_LbsStep_SetAutonomousMode::SetAndVerifyAutonomousGpsModeL() + { + TBool ret = TRUE; + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + CLbsAdmin::TGpsMode mode; + + TInt err = adminApi->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsAutonomous); + User::LeaveIfError(err); + err = adminApi->Get(KLbsSettingHomeGpsMode, mode); + User::LeaveIfError(err); + + if(mode != CLbsAdmin::EGpsAutonomous) + { + INFO_PRINTF1(_L("Admin setting didn't work")); + ret = FALSE; + } + CleanupStack::PopAndDestroy(adminApi); + + // Alow he setting to be propagated + User::After(2000000); + + return ret; + } + +/** +@pre +@return Test verdict +@post GPSMode set to autonomous +*/ +TVerdict CT_LbsStep_SetAutonomousMode::doTestStepL() + { + INFO_PRINTF1(_L(">>CT_LbsStep_SetAutonomousMode::doTestStepL()")); + + if(!SetAndVerifyAutonomousGpsModeL()) + { + SetTestStepResult(EFail); + } + + INFO_PRINTF1(_L("<<CT_LbsStep_SetAutonomousMode::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetbehaviourmodeoriginal.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetbehaviourmodeoriginal.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,91 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepsetbehaviourmodeoriginal.cpp +// This is the class implementation for the Set Behaviour Mode Original Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include "ctlbsstepsetbehaviourmodeoriginal.h" +#include + +CT_LbsStep_SetBehaviourModeOriginal::CT_LbsStep_SetBehaviourModeOriginal(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_SetBehaviourModeOriginal); + } + +/** +Static Constructor +*/ +CT_LbsStep_SetBehaviourModeOriginal* CT_LbsStep_SetBehaviourModeOriginal::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_SetBehaviourModeOriginal(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + */ +TBool CT_LbsStep_SetBehaviourModeOriginal::SetAndVerifyBehaviourModeOriginalL() + { + TBool ret = TRUE; + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + + CLbsAdmin::TLbsBehaviourMode behaviourMode; + + TInt err = adminApi->Set(KLbsSettingBehaviourMode, CLbsAdmin::ELbsBehaviourModeOriginal); + User::LeaveIfError(err); + err = adminApi->Get(KLbsSettingBehaviourMode, behaviourMode); + User::LeaveIfError(err); + + if(behaviourMode != CLbsAdmin::ELbsBehaviourModeOriginal) + { + INFO_PRINTF1(_L("Admin setting didn't work")); + ret = FALSE; + } + CleanupStack::PopAndDestroy(adminApi); + + // Alow he setting to be propagated + User::After(2000000); + + return ret; + } + +/** +@pre +@return Test verdict +@post Lbs Behaviour mode set to "original" +*/ +TVerdict CT_LbsStep_SetBehaviourModeOriginal::doTestStepL() + { + INFO_PRINTF1(_L(">>CT_LbsStep_SetBehaviourModeOriginal::doTestStepL()")); + + if(!SetAndVerifyBehaviourModeOriginalL()) + { + SetTestStepResult(EFail); + } + + INFO_PRINTF1(_L("<<CT_LbsStep_SetBehaviourModeOriginal::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetprivhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetprivhandler.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,119 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepsetprivhandler.cpp +// This is the class implementation for the Set Privacy Controller Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include "ctlbsstepsetprivhandler.h" + +//Literals Used +_LIT(KHandlerType, "privhandler_type"); + +CT_LbsStep_SetPrivacyHandler::CT_LbsStep_SetPrivacyHandler(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_SetPrivacyHandler); + } + +/** +Static Constructor +*/ +CT_LbsStep_SetPrivacyHandler* CT_LbsStep_SetPrivacyHandler::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_SetPrivacyHandler(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** Let LBS know whether we're using privacy controller or notifier: + */ +TBool CT_LbsStep_SetPrivacyHandler::SetAndVerifyPrivacyHandlerL(CLbsAdmin::TPrivacyHandler aPrivacyHandlerType) + { + TBool ret = TRUE; + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + TInt err; + + //CLbsAdmin::TPrivacyHandler privacyHandler = CLbsAdmin::EPrivacyHandleByController; + err = adminApi->Set(KLbsSettingPrivacyHandler, aPrivacyHandlerType); + + User::LeaveIfError(err); + err = adminApi->Get(KLbsSettingPrivacyHandler, aPrivacyHandlerType); + User::LeaveIfError(err); + + //Now we support 3 Privacy Handlers so need to comment out below check + //if(aPrivacyHandlerType != CLbsAdmin::EPrivacyHandleByController) + // { + // INFO_PRINTF1(_L("Admin setting didn't work")); + // ret = FALSE; + // } + + CleanupStack::PopAndDestroy(adminApi); + + // Allow he setting to be propagated + User::After(4 * 1000000); + + return ret; + } + +/** +@pre +@return Test verdict +@post GPSMode set to autonomous +*/ +TVerdict CT_LbsStep_SetPrivacyHandler::doTestStepL() + { + INFO_PRINTF1(_L(">>CT_LbsStep_SetPrivacyHandler::doTestStepL()")); + + CLbsAdmin::TPrivacyHandler privacyHandlerType = CLbsAdmin::EPrivacyHandleByController; + TInt privhandlerconfig; + + if (GetIntFromConfig(ConfigSection(), KHandlerType, privhandlerconfig)) + { + if(1 == privhandlerconfig) + { + privacyHandlerType = CLbsAdmin::EPrivacyHandleByController; + } + else if (2 == privhandlerconfig) + { + privacyHandlerType = CLbsAdmin::EPrivacyHandleByNotifier; + } + else if (3 == privhandlerconfig) + { + privacyHandlerType = CLbsAdmin::EPrivacyHandleByAdvancedNotifier; + } + else + { + INFO_PRINTF2(_L(">>Unrecognised privacyHandlerType: %d"), privacyHandlerType); + User::Invariant(); + } + + if(!SetAndVerifyPrivacyHandlerL(privacyHandlerType)) + { + SetTestStepResult(EFail); + } + } + INFO_PRINTF1(_L("<<CT_LbsStep_SetPrivacyHandler::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetptamode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetptamode.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,99 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepsetptamode.cpp +// This is the class implementation for the Set Behaviour Mode Original Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include "ctlbsstepsetptamode.h" +#include + +CT_LbsStep_SetPTAMode::CT_LbsStep_SetPTAMode(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_SetPTAMode); + } + +/** +Static Constructor +*/ +CT_LbsStep_SetPTAMode* CT_LbsStep_SetPTAMode::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_SetPTAMode(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + */ +TBool CT_LbsStep_SetPTAMode::SetAndVerifyPTAModeL() + { + TBool ret = TRUE; + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + + TInt err = adminApi->Set(KLbsSettingRoamingGpsMode, CLbsAdmin::EGpsPreferTerminalAssisted); + User::LeaveIfError(err); + err = adminApi->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsPreferTerminalAssisted); + User::LeaveIfError(err); + // Alow he setting to be propagated + User::After(2000000); + + CLbsAdmin::TGpsMode gpsMode; + err = adminApi->Get(KLbsSettingRoamingGpsMode, gpsMode); + User::LeaveIfError(err); + if(gpsMode != CLbsAdmin::EGpsPreferTerminalAssisted) + { + INFO_PRINTF1(_L("Admin setting didn't work")); + ret = FALSE; + } + + err = adminApi->Get(KLbsSettingHomeGpsMode, gpsMode); + User::LeaveIfError(err); + if(gpsMode != CLbsAdmin::EGpsPreferTerminalAssisted) + { + INFO_PRINTF1(_L("Admin setting didn't work")); + ret = FALSE; + } + CleanupStack::PopAndDestroy(adminApi); + + return ret; + } + +/** +@pre +@return Test verdict +@post Lbs Behaviour mode set to "original" +*/ +TVerdict CT_LbsStep_SetPTAMode::doTestStepL() + { + INFO_PRINTF1(_L(">>CT_LbsStep_SetPTAMode::doTestStepL()")); + + if(!SetAndVerifyPTAModeL()) + { + SetTestStepResult(EFail); + } + + INFO_PRINTF1(_L("<<CT_LbsStep_SetPTAMode::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetptbmode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetptbmode.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,99 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepsetptbmode.cpp +// This is the class implementation for the Set Gps Mode PTB +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include "ctlbsstepsetptbmode.h" +#include + +CT_LbsStep_SetPTBMode::CT_LbsStep_SetPTBMode(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_SetPTBMode); + } + +/** +Static Constructor +*/ +CT_LbsStep_SetPTBMode* CT_LbsStep_SetPTBMode::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_SetPTBMode(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + */ +TBool CT_LbsStep_SetPTBMode::SetAndVerifyPTBModeL() + { + TBool ret = TRUE; + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + + TInt err = adminApi->Set(KLbsSettingRoamingGpsMode, CLbsAdmin::EGpsPreferTerminalBased); + User::LeaveIfError(err); + err = adminApi->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsPreferTerminalBased); + User::LeaveIfError(err); + // Alow he setting to be propagated + User::After(2000000); + + CLbsAdmin::TGpsMode gpsMode; + err = adminApi->Get(KLbsSettingRoamingGpsMode, gpsMode); + User::LeaveIfError(err); + if(gpsMode != CLbsAdmin::EGpsPreferTerminalBased) + { + INFO_PRINTF1(_L("Admin setting didn't work")); + ret = FALSE; + } + + err = adminApi->Get(KLbsSettingHomeGpsMode, gpsMode); + User::LeaveIfError(err); + if(gpsMode != CLbsAdmin::EGpsPreferTerminalBased) + { + INFO_PRINTF1(_L("Admin setting didn't work")); + ret = FALSE; + } + CleanupStack::PopAndDestroy(adminApi); + + return ret; + } + +/** +@pre +@return Test verdict +@post Lbs Behaviour mode set to "original" +*/ +TVerdict CT_LbsStep_SetPTBMode::doTestStepL() + { + INFO_PRINTF1(_L(">>CT_LbsStep_SetPTBMode::doTestStepL()")); + + if(!SetAndVerifyPTBModeL()) + { + SetTestStepResult(EFail); + } + + INFO_PRINTF1(_L("<<CT_LbsStep_SetPTBMode::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetupprotocolstub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetupprotocolstub.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,78 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstep_setupprotocolstub.cpp +// This is the class implementation for the Set Autonomous Moder Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include "ctlbsstepsetupprotocolstub.h" +#include + +CT_LbsStep_SetupProtocolStub::CT_LbsStep_SetupProtocolStub(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_SetupProtocolStub); + } + +/** +Static Constructor +*/ +CT_LbsStep_SetupProtocolStub* CT_LbsStep_SetupProtocolStub::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_SetupProtocolStub(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** +@pre +@return Test verdict +@post GPSMode set to autonomous +*/ +TVerdict CT_LbsStep_SetupProtocolStub::doTestStepL() + { + INFO_PRINTF1(_L(">>CT_LbsStep_SetupProtocolStub::doTestStepL()")); + + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + TUid uid; + + TInt err = adminApi->Set(KLbsSettingHomeProtocolModule, TUid::Uid(0x10282293)); + User::LeaveIfError(err); + err = adminApi->Get(KLbsSettingHomeProtocolModule, uid); + User::LeaveIfError(err); + + if(uid.iUid != 0x10282293) + { + INFO_PRINTF1(_L("Admin setting didn't work")); + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(adminApi); + + // Alow he setting to be propagated + User::After(2000000); + + INFO_PRINTF1(_L("<<CT_LbsStep_SetupProtocolStub::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetuproamselflocate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetuproamselflocate.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,94 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepsetuproamlocate.cpp +// This is the class implementation for the Set Autonomous Moder Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include "ctlbsstepsetuproamselflocate.h" +#include + +CT_LbsStep_SetupRoamSelfLocate::CT_LbsStep_SetupRoamSelfLocate(CT_LbsServer& aParent) +:CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_SetupRoamSelfLocate); + } + +/** +Static Constructor +*/ +CT_LbsStep_SetupRoamSelfLocate* CT_LbsStep_SetupRoamSelfLocate::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_SetupRoamSelfLocate(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** +@pre +@return Test verdict +@post GPSMode set to autonomous +*/ +TVerdict CT_LbsStep_SetupRoamSelfLocate::doTestStepL() + { + INFO_PRINTF1(_L(">>CT_LbsStep_SetupRoamSelfLocate::doTestStepL()")); + + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + + // Switch on the self locate API when roaming. + CLbsAdmin::TSelfLocateService serviceSetting = CLbsAdmin::ESelfLocateUnknown; + + TInt err = adminApi->Set(KLbsSettingRoamingSelfLocate, CLbsAdmin::ESelfLocateOn); + User::LeaveIfError(err); + err = adminApi->Get(KLbsSettingRoamingSelfLocate, serviceSetting); + User::LeaveIfError(err); + + if(serviceSetting != CLbsAdmin::ESelfLocateOn) + { + INFO_PRINTF1(_L("Self locate API admin setting didn't work")); + SetTestStepResult(EFail); + } + + // Set gps mode when roaming. + CLbsAdmin::TGpsMode gpsModeSetting = CLbsAdmin::EGpsModeUnknown; + + err = adminApi->Set(KLbsSettingRoamingGpsMode, CLbsAdmin::EGpsPreferTerminalBased); + User::LeaveIfError(err); + err = adminApi->Get(KLbsSettingRoamingGpsMode, gpsModeSetting); + User::LeaveIfError(err); + + if (gpsModeSetting != CLbsAdmin::EGpsPreferTerminalBased) + { + INFO_PRINTF1(_L("Gps mode admin setting didn't work")); + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(adminApi); + + // Alow he setting to be propagated + User::After(2000000); + + INFO_PRINTF1(_L("<<CT_LbsStep_SetupRoamSelfLocate::doTestStepL()")); + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetupstandaloneprivacyandsimplectlr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetupstandaloneprivacyandsimplectlr.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,160 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstep_setupstandaloneprivacyandsimplectlr.cpp +// This is the class implementation for the Set Autonomous Mode Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include "ctlbsstepsetupstandaloneprivacyandsimplectlr.h" +#include +#include + + +CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr::CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_SetupStandalonePrivacyAndSimpleCtlr); + } + +/** +Static Constructor +*/ +CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr* CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** +@pre +@return Test verdict +@post LBS sub-system set to standalone privacy mode and using simple controller. +*/ +TVerdict CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr::doTestStepL() + { + + // lbsroot stuff (not ideal, currently defined in internal header file lbsrootcenrepdefs.h + const TUint KLbsCenRepUidValue = 0x10282266; + const TUid KLbsCenRepUid = {KLbsCenRepUidValue}; + + const TUint32 KLbsRootProcessNameFirstKey = 0x00001000; + const TUint32 KLbsRootProcessUidFirstKey = 0x00002000; + const TUint32 KLbsRootProcessIsServerFirstKey = 0x00003000; + + const TUint32 KLbsSystemTransientKey = 0x00000001; + const TUint32 KLbsRootProcessTransientKey = 0x00000002; + + const TUint32 KRootKeyMask = 0xFFFFF000; // don't care what the last 3 digits are + + INFO_PRINTF1(_L(">>CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr::doTestStepL()")); + + // Set the privacy protocol module as the protocol module to load in admin settings + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + + const TLbsProtocolModuleId KPrivacyPMUid = { 0x1028373C }; + TInt err = adminApi->Set(KLbsSettingHomeProtocolModule, KPrivacyPMUid); + User::LeaveIfError(err); + TUid uid; + err = adminApi->Get(KLbsSettingHomeProtocolModule, uid); + User::LeaveIfError(err); + + if(uid.iUid != KPrivacyPMUid.iUid) + { + INFO_PRINTF1(_L("Admin setting didn't work")); + SetTestStepResult(EFail); + } + + //Get privacy handler type + CLbsAdmin::TPrivacyHandler privacyHandlerType; + err = adminApi->Get(KLbsSettingPrivacyHandler, privacyHandlerType); + User::LeaveIfError(err); + + // Set the privacy timeout action as 'network defined' + err = adminApi->Set(KLbsSettingPrivacyTimeoutAction, CLbsAdmin::EPrivacyTimeoutNetworkDefined); + User::LeaveIfError(err); + + // Set the maximum number of simultaneous privacy requests allowed + const TUint KMaxExternalLocateRequests(150); + err = adminApi->Set(KLbsSettingMaximumExternalLocateRequests, KMaxExternalLocateRequests); + User::LeaveIfError(err); + + CleanupStack::PopAndDestroy(adminApi); + + // Alow the setting to be propagated + User::After(2000000); + + // Set-up the LbsRoot cenrep file so that: + // 1) LbsRoot is transient. + // 2) LbsRoot starts the LBS subsystem in transient mode + // 3) LbsRoot only starts the NRH and NG. + + CRepository* rootRep = CRepository::NewLC(KLbsCenRepUid); + + // Set Lbs system and LbsRoot process as transient. + + // Start the LBS sub-system in transient mode. + User::LeaveIfError(rootRep->Set(KLbsSystemTransientKey, 1)); + User::LeaveIfError(rootRep->Set(KLbsRootProcessTransientKey, 1)); + + // Set only NRH and NG to be started. + // First, clear out any existing startup entries. + TUint32 errorKey; + User::LeaveIfError(rootRep->Delete(KLbsRootProcessNameFirstKey, KRootKeyMask, errorKey)); + User::LeaveIfError(rootRep->Delete(KLbsRootProcessUidFirstKey, KRootKeyMask, errorKey)); + User::LeaveIfError(rootRep->Delete(KLbsRootProcessIsServerFirstKey, KRootKeyMask, errorKey)); + + // Set NRH and NG as startup entries. + _LIT(KNGProcessName, "lbsnetgateway.exe"); + const TUid KLbsNetworkGatewayUid = { 0x10281D46 }; + User::LeaveIfError(rootRep->Set(KLbsRootProcessNameFirstKey, KNGProcessName)); + User::LeaveIfError(rootRep->Set(KLbsRootProcessUidFirstKey, TInt(KLbsNetworkGatewayUid.iUid))); + User::LeaveIfError(rootRep->Set(KLbsRootProcessIsServerFirstKey, EFalse)); + + _LIT(KNRHProcessName, "lbsnetworkrequesthandler.exe"); + const TUid KLbsNetRequestHandlerUid = { 0x10281D45 }; + User::LeaveIfError(rootRep->Set(KLbsRootProcessNameFirstKey+1, KNRHProcessName)); + User::LeaveIfError(rootRep->Set(KLbsRootProcessUidFirstKey+1, TInt(KLbsNetRequestHandlerUid.iUid))); + User::LeaveIfError(rootRep->Set(KLbsRootProcessIsServerFirstKey+1, ETrue)); + + //If we are using Privacy Controller mode, start privacy controller as well + if(privacyHandlerType == CLbsAdmin::EPrivacyHandleByController) + { + _LIT(KPrivCtrlProcessName, "lbstestprivacycontrollersimple.exe"); + const TUid KLbsPrivacyControllerUid = { 0x10283746 }; + User::LeaveIfError(rootRep->Set(KLbsRootProcessNameFirstKey+2, KPrivCtrlProcessName)); + User::LeaveIfError(rootRep->Set(KLbsRootProcessUidFirstKey+2, TInt(KLbsPrivacyControllerUid.iUid))); + User::LeaveIfError(rootRep->Set(KLbsRootProcessIsServerFirstKey+2, EFalse)); + } + else + { + ERR_PRINTF1(_L("FAIL - Test Step is only useful with Privacy Controller")); + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(rootRep); + + INFO_PRINTF1(_L("<<CT_LbsStep_SetupStandalonePrivacyAndSimpleCtlr::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetupstandaloneprivacymode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetupstandaloneprivacymode.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,145 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstep_setupstandaloneprivacymode.cpp +// This is the class implementation for the Set Autonomous Moder Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include "ctlbsstepsetupstandaloneprivacymode.h" +#include +#include + + +CT_LbsStep_SetupStandalonePrivacyMode::CT_LbsStep_SetupStandalonePrivacyMode(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_SetupStandalonePrivacyMode); + } + +/** +Static Constructor +*/ +CT_LbsStep_SetupStandalonePrivacyMode* CT_LbsStep_SetupStandalonePrivacyMode::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_SetupStandalonePrivacyMode(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** +@pre +@return Test verdict +@post LBS sub-system set to standalone privacy mode. +*/ +TVerdict CT_LbsStep_SetupStandalonePrivacyMode::doTestStepL() + { + INFO_PRINTF1(_L(">>CT_LbsStep_SetupStandalonePrivacyMode::doTestStepL()")); + + // Set the privacy protocol module as the protocol module to load in admin settings + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + + const TLbsProtocolModuleId KPrivacyPMUid = { 0x1028373C }; + TInt err = adminApi->Set(KLbsSettingHomeProtocolModule, KPrivacyPMUid); + User::LeaveIfError(err); + TUid uid; + err = adminApi->Get(KLbsSettingHomeProtocolModule, uid); + User::LeaveIfError(err); + + if(uid.iUid != KPrivacyPMUid.iUid) + { + INFO_PRINTF1(_L("Admin setting didn't work")); + SetTestStepResult(EFail); + } + + //Get privacy handler type + CLbsAdmin::TPrivacyHandler privacyHandlerType; + err = adminApi->Get(KLbsSettingPrivacyHandler, privacyHandlerType); + User::LeaveIfError(err); + + // Turn off the LBS logger + err = adminApi->Set(KLbsSettingLogger, CLbsAdmin::ELoggerOff); + User::LeaveIfError(err); + + // Set the privacy timeout action as 'network defined' + err = adminApi->Set(KLbsSettingPrivacyTimeoutAction, CLbsAdmin::EPrivacyTimeoutNetworkDefined); + User::LeaveIfError(err); + + // Set the maximum number of simultaneous privacy requests allowed + const TUint KMaxExternalLocateRequests(150); + err = adminApi->Set(KLbsSettingMaximumExternalLocateRequests, KMaxExternalLocateRequests); + User::LeaveIfError(err); + + CleanupStack::PopAndDestroy(adminApi); + + // Alow the setting to be propagated + User::After(2000000); + + // Set-up the LbsRoot cenrep file so that: + // 1) LbsRoot is transient. + // 2) LbsRoot starts the LBS subsystem in transient mode + // 3) LbsRoot only starts the NRH and NG. + + CRepository* rootRep = CRepository::NewLC(KLbsCenRepUid); + + // Set Lbs system and LbsRoot process as transient. + + // Start the LBS sub-system in transient mode. + User::LeaveIfError(rootRep->Set(KLbsSystemTransientKey, 1)); + User::LeaveIfError(rootRep->Set(KLbsRootProcessTransientKey, 1)); + + // Set only NRH and NG to be started. + // First, clear out any existing startup entries. + TUint32 errorKey; + User::LeaveIfError(rootRep->Delete(KLbsRootProcessNameFirstKey, KRootKeyMask, errorKey)); + User::LeaveIfError(rootRep->Delete(KLbsRootProcessUidFirstKey, KRootKeyMask, errorKey)); + User::LeaveIfError(rootRep->Delete(KLbsRootProcessIsServerFirstKey, KRootKeyMask, errorKey)); + + // Set NRH and NG as startup entries. + _LIT(KNGProcessName, "lbsnetgateway.exe"); + const TUid KLbsNetworkGatewayUid = { 0x10281D46 }; + User::LeaveIfError(rootRep->Set(KLbsRootProcessNameFirstKey, KNGProcessName)); + User::LeaveIfError(rootRep->Set(KLbsRootProcessUidFirstKey, TInt(KLbsNetworkGatewayUid.iUid))); + User::LeaveIfError(rootRep->Set(KLbsRootProcessIsServerFirstKey, EFalse)); + + _LIT(KNRHProcessName, "lbsnetworkrequesthandler.exe"); + const TUid KLbsNetRequestHandlerUid = { 0x10281D45 }; + User::LeaveIfError(rootRep->Set(KLbsRootProcessNameFirstKey+1, KNRHProcessName)); + User::LeaveIfError(rootRep->Set(KLbsRootProcessUidFirstKey+1, TInt(KLbsNetRequestHandlerUid.iUid))); + User::LeaveIfError(rootRep->Set(KLbsRootProcessIsServerFirstKey+1, ETrue)); + + //If we are using Privacy Controller mode, start privacy controller as well + if(privacyHandlerType == CLbsAdmin::EPrivacyHandleByController) + { + _LIT(KPrivCtrlProcessName, "lbstestprivacycontroller.exe"); + const TUid KLbsPrivacyControllerUid = { 0x10283750 }; + User::LeaveIfError(rootRep->Set(KLbsRootProcessNameFirstKey+2, KPrivCtrlProcessName)); + User::LeaveIfError(rootRep->Set(KLbsRootProcessUidFirstKey+2, TInt(KLbsPrivacyControllerUid.iUid))); + User::LeaveIfError(rootRep->Set(KLbsRootProcessIsServerFirstKey+2, EFalse)); + } + + CleanupStack::PopAndDestroy(rootRep); + + INFO_PRINTF1(_L("<<CT_LbsStep_SetupStandalonePrivacyMode::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetupstandaloneprivacywithnoctlr.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepsetupstandaloneprivacywithnoctlr.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,145 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstep_setupstandaloneprivacywithnoctlr.cpp +// This is the class implementation for the Set Autonomous Mode Test Step +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#include "ctlbsstepsetupstandaloneprivacywithnoctlr.h" +#include +#include + + +CT_LbsStep_SetupStandalonePrivacyWithNoCtlr::CT_LbsStep_SetupStandalonePrivacyWithNoCtlr(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_SetupStandalonePrivacyWithNoCtlr); + } + +/** +Static Constructor +*/ +CT_LbsStep_SetupStandalonePrivacyWithNoCtlr* CT_LbsStep_SetupStandalonePrivacyWithNoCtlr::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_SetupStandalonePrivacyWithNoCtlr(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** +@pre +@return Test verdict +@post LBS sub-system set to standalone privacy mode and using simple controller. +*/ +TVerdict CT_LbsStep_SetupStandalonePrivacyWithNoCtlr::doTestStepL() + { + + // lbsroot stuff (not ideal, currently defined in internal header file lbsrootcenrepdefs.h + const TUint KLbsCenRepUidValue = 0x10282266; + const TUid KLbsCenRepUid = {KLbsCenRepUidValue}; + + const TUint32 KLbsRootProcessNameFirstKey = 0x00001000; + const TUint32 KLbsRootProcessUidFirstKey = 0x00002000; + const TUint32 KLbsRootProcessIsServerFirstKey = 0x00003000; + + const TUint32 KLbsSystemTransientKey = 0x00000001; + const TUint32 KLbsRootProcessTransientKey = 0x00000002; + + const TUint32 KRootKeyMask = 0xFFFFF000; // don't care what the last 3 digits are + + INFO_PRINTF1(_L(">>CT_LbsStep_SetupStandalonePrivacyWithNoCtlr::doTestStepL()")); + + // Set the privacy protocol module as the protocol module to load in admin settings + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + + const TLbsProtocolModuleId KPrivacyPMUid = { 0x1028373C }; + TInt err = adminApi->Set(KLbsSettingHomeProtocolModule, KPrivacyPMUid); + User::LeaveIfError(err); + TUid uid; + err = adminApi->Get(KLbsSettingHomeProtocolModule, uid); + User::LeaveIfError(err); + + if(uid.iUid != KPrivacyPMUid.iUid) + { + INFO_PRINTF1(_L("Admin setting didn't work")); + SetTestStepResult(EFail); + } + + //Get privacy handler type + CLbsAdmin::TPrivacyHandler privacyHandlerType; + err = adminApi->Get(KLbsSettingPrivacyHandler, privacyHandlerType); + User::LeaveIfError(err); + + // Set the privacy timeout action as 'network defined' + err = adminApi->Set(KLbsSettingPrivacyTimeoutAction, CLbsAdmin::EPrivacyTimeoutNetworkDefined); + User::LeaveIfError(err); + + // Set the maximum number of simultaneous privacy requests allowed + const TUint KMaxExternalLocateRequests(150); + err = adminApi->Set(KLbsSettingMaximumExternalLocateRequests, KMaxExternalLocateRequests); + User::LeaveIfError(err); + + CleanupStack::PopAndDestroy(adminApi); + + // Alow the setting to be propagated + User::After(2000000); + + // Set-up the LbsRoot cenrep file so that: + // 1) LbsRoot is transient. + // 2) LbsRoot starts the LBS subsystem in transient mode + // 3) LbsRoot only starts the NRH and NG. + + CRepository* rootRep = CRepository::NewLC(KLbsCenRepUid); + + // Set Lbs system and LbsRoot process as transient. + + // Start the LBS sub-system in transient mode. + User::LeaveIfError(rootRep->Set(KLbsSystemTransientKey, 1)); + User::LeaveIfError(rootRep->Set(KLbsRootProcessTransientKey, 1)); + + // Set only NRH and NG to be started. + // First, clear out any existing startup entries. + TUint32 errorKey; + User::LeaveIfError(rootRep->Delete(KLbsRootProcessNameFirstKey, KRootKeyMask, errorKey)); + User::LeaveIfError(rootRep->Delete(KLbsRootProcessUidFirstKey, KRootKeyMask, errorKey)); + User::LeaveIfError(rootRep->Delete(KLbsRootProcessIsServerFirstKey, KRootKeyMask, errorKey)); + + // Set NRH and NG as startup entries. + _LIT(KNGProcessName, "lbsnetgateway.exe"); + const TUid KLbsNetworkGatewayUid = { 0x10281D46 }; + User::LeaveIfError(rootRep->Set(KLbsRootProcessNameFirstKey, KNGProcessName)); + User::LeaveIfError(rootRep->Set(KLbsRootProcessUidFirstKey, TInt(KLbsNetworkGatewayUid.iUid))); + User::LeaveIfError(rootRep->Set(KLbsRootProcessIsServerFirstKey, EFalse)); + + _LIT(KNRHProcessName, "lbsnetworkrequesthandler.exe"); + const TUid KLbsNetRequestHandlerUid = { 0x10281D45 }; + User::LeaveIfError(rootRep->Set(KLbsRootProcessNameFirstKey+1, KNRHProcessName)); + User::LeaveIfError(rootRep->Set(KLbsRootProcessUidFirstKey+1, TInt(KLbsNetRequestHandlerUid.iUid))); + User::LeaveIfError(rootRep->Set(KLbsRootProcessIsServerFirstKey+1, ETrue)); + + CleanupStack::PopAndDestroy(rootRep); + + INFO_PRINTF1(_L("<<CT_LbsStep_SetupStandalonePrivacyWithNoCtlr::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepstartlbs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepstartlbs.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,146 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbslocdatasrc.cpp +// This is the class implementation for the step to start the lbs system +// EPOC includes. +// LBS includes. +// +// + +// LBS test includes. +#include "ctlbsstepstartlbs.h" +#include "tlbsutils.h" +#include "lbstestclient.h" + +/** + * Destructor + */ +CT_LbsStep_StartLbs::~CT_LbsStep_StartLbs() + { + } + + +/** + * Constructor + */ +CT_LbsStep_StartLbs::CT_LbsStep_StartLbs(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_StartLbs); + } + + +/** +Static Constructor +*/ +CT_LbsStep_StartLbs* CT_LbsStep_StartLbs::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_StartLbs(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsStep_StartLbs::doTestStepL() + { + // Test step used to start the location manager. + INFO_PRINTF1(_L(">>CT_LbsStep_StartLbs::doTestStepL()")); + + //*******************************************************************/ + // for diagnostics print out important Admin settings that will + // determine how lbs bahaves + + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + + CLbsAdmin::TGpsMode mode; + TInt err = adminApi->Get(KLbsSettingHomeGpsMode, mode); + if (err == KErrNone) + { + INFO_PRINTF2(_L("KLbsSettingHomeGpsMode = %d"),mode); + } + else + { + INFO_PRINTF1(_L("KLbsSettingHomeGpsMode not in Admin")); + } + + CLbsAdmin::TSpecialFeature specialFeature; + + err = adminApi->Get(KLbsSpecialFeatureIgnoreAccuracy, specialFeature); + if (err == KErrNone) + { + INFO_PRINTF2(_L("KLbsSpecialFeatureIgnoreAccuracy = %d"),specialFeature); + } + else + { + INFO_PRINTF1(_L("KLbsSpecialFeatureIgnoreAccuracy not in Admin")); + } + + err = adminApi->Get(KLbsSpecialFeatureAllowTBFinalNetPos, specialFeature); + if (err == KErrNone) + { + INFO_PRINTF2(_L("KLbsSpecialFeatureAllowTBFinalNetPos = %d"),specialFeature); + } + else + { + INFO_PRINTF1(_L("KLbsSpecialFeatureAllowTBFinalNetPos not in Admin")); + } + + err = adminApi->Get(KLbsSpecialFeatureWithholdDeliveryOfReferencePositions, specialFeature); + if (err == KErrNone) + { + INFO_PRINTF2(_L("KLbsSpecialFeatureWithholdDeliveryOfReferencePositions = %d"),specialFeature); + } + else + { + INFO_PRINTF1(_L("KLbsSpecialFeatureWithholdDeliveryOfReferencePositions not in Admin")); + } + + err = adminApi->Get(KLbsSpecialFeatureIntermediateFutileUpdate, specialFeature); + if (err == KErrNone) + { + INFO_PRINTF2(_L("KLbsSpecialFeatureIntermediateFutileUpdate = %d"),specialFeature); + } + else + { + INFO_PRINTF1(_L("KLbsSpecialFeatureIntermediateFutileUpdate not in Admin")); + } + + + CleanupStack::PopAndDestroy(adminApi); + + //*******************************************************************/ + + if (TestStepResult() == EPass) + { + // Create the test properties. + T_LbsUtils utils; + utils.CreateTestPropertiesL(); + + // Now start the LBS system + CLbsTestServer* testServer = CLbsTestServer::NewL(); + CleanupStack::PushL(testServer); + User::LeaveIfError(testServer->StartLbsSystem()); + CleanupStack::PopAndDestroy(testServer); + } + + INFO_PRINTF1(_L("<<CT_LbsStep_StartLbs::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepstoplbs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepstoplbs.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,76 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbslocdatasrc.cpp +// This is the class implementation for the step to stop the lbs system +// EPOC includes. +// LBS includes. +// +// + +// LBS test includes. +#include "ctlbsstepstoplbs.h" +#include + +/** + * Destructor + */ +CT_LbsStep_StopLbs::~CT_LbsStep_StopLbs() + { + } + + +/** + * Constructor + */ +CT_LbsStep_StopLbs::CT_LbsStep_StopLbs(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_StopLbs); + } + + +/** +Static Constructor +*/ +CT_LbsStep_StopLbs* CT_LbsStep_StopLbs::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_StopLbs(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsStep_StopLbs::doTestStepL() + { + // Test step used to stop the lbs system + INFO_PRINTF1(_L(">>CT_LbsStep_StopLbs::doTestStepL()")); + + if (TestStepResult() == EPass) + { + CLbsTestServer* testServer = CLbsTestServer::NewL(); + CleanupStack::PushL(testServer); + User::LeaveIfError(testServer->StopLbsSystem()); + + CleanupStack::PopAndDestroy(testServer); + } + + INFO_PRINTF1(_L("<<CT_LbsStep_StopLbs::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepverifyloginfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepverifyloginfo.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,1177 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepverifyloginfo.cpp +// This is the class implementation for the log verification test step +// +// + +#include "ctlbsstepverifyloginfo.h" + +_LIT(KLogType, "log_type"); + +/** +Public, non-leaving, static constructor +*/ +CT_LbsStep_VerifyLogInfo* CT_LbsStep_VerifyLogInfo::New(CT_LbsServer& aParent) + { + CT_LbsStep_VerifyLogInfo* self = NULL; + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + TRAPD(err, self = NewL(aParent)); + if(KErrNone != err) + { + self = NULL; + } + return self; + } +/** + * Static Constructor that may leave + */ +CT_LbsStep_VerifyLogInfo* CT_LbsStep_VerifyLogInfo::NewL(CT_LbsServer& aParent) + { + CT_LbsStep_VerifyLogInfo* verifyLog = new(ELeave) CT_LbsStep_VerifyLogInfo(aParent); + CleanupStack::PushL(verifyLog); + verifyLog->ConstructL(); + CleanupStack::Pop(verifyLog); + + return verifyLog; + } +/** +2nd phase Constructor that may leave +*/ +void CT_LbsStep_VerifyLogInfo::ConstructL() + { + + // Create everything for the right hand side of all compares + _LIT(KTheDest,"07712345678"); + TPtrC theDest(KTheDest); + + iX3PLogIntiailisedFromValues = CLbsTransmitLocationLogEvent::NewL(TUid::Uid(0), NULL, theDest); + iSelfLocateLogIntiailisedFromValues = CLbsSelfLocateLogEvent::NewL(TUid::Uid(0), NULL); + iExternalLocateLogIntiailisedFromValues = CLbsExternalLocateLogEvent::NewL(TUid::Uid(0), NULL, NULL); + iNetworkLocateLogIntiailisedFromValues = CLbsNetworkLocateLogEvent::NewL(TUid::Uid(0), NULL); + iAssistanceDataLogIntiailisedFromValuesFirst = CLbsAssistanceDataLogEvent::NewL(0, 0); + + //Setup other reference position + iRefPosTwo = new TPositionInfo(); + TPosition refpos; + refpos.SetCoordinate(REFPOS_LAT, REFPOS_LONG, REFPOS_ALT); + refpos.SetAccuracy(REFPOS_HORZ_ACCURACY, REFPOS_VERT_ACCURACY); + refpos.SetCurrentTime(); + iRefPosTwo->SetPosition(refpos); + + + // read logs using CLogViewEvent + TInt ErrorCode = itheFs.Connect(); + if(ErrorCode) + { + INFO_PRINTF1(_L("\t Error: Open FileServer failed.")); + SetTestStepResult(EFail); + } + + iclient = CLogClient::NewL(itheFs, CActive::EPriorityStandard); + iview = CLogViewEvent::NewL(*iclient, CActive::EPriorityStandard); + + iActiveWaiter = CT_LbsAsyncWaiter::NewL(); // NEW iActiveWaiter + + } +/** + * Destructor + */ +CT_LbsStep_VerifyLogInfo::~CT_LbsStep_VerifyLogInfo() + { + iview->Cancel(); + iclient->Cancel(); + delete iview; + delete iclient; + itheFs.Close(); + delete iActiveWaiter; + // Delete everything for the right hand side of all compares + delete iRefPosTwo; + delete iSelfLocateLogIntiailisedFromValues; + delete iExternalLocateLogIntiailisedFromValues; + delete iNetworkLocateLogIntiailisedFromValues; + delete iAssistanceDataLogIntiailisedFromValuesFirst; + delete iX3PLogIntiailisedFromValues; + + } + + +/** + * Constructor + */ +CT_LbsStep_VerifyLogInfo::CT_LbsStep_VerifyLogInfo(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_VerifyLogInfo); + } + + +TVerdict CT_LbsStep_VerifyLogInfo::doTestStepPreambleL() + { + + return TestStepResult(); + } + +TVerdict CT_LbsStep_VerifyLogInfo::doTestStepPostambleL() + { + + return TestStepResult(); + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsStep_VerifyLogInfo::doTestStepL() + { + // Helper test step used to Verify the Position Information Array. + INFO_PRINTF1(_L(">>CT_LbsStep_VerifyLogInfo::doTestStepL()")); + + if (TestStepResult() == EPass) + { + + // Left and right parameters of compare functions. + if (GetIntFromConfig(ConfigSection(), KLogType, iLogType)) + { + + + if(iParent.iSharedData->iTestModuleInUse) + { + iWhatAccuracyToUse = T_LbsUtils::EExactAccuracy; + } + else + { + iWhatAccuracyToUse = T_LbsUtils::ERoughAccuracy; + } + + InitialiseRHS(); + + switch(iLogType) + { + case EAutonomousSelfLocateRequest: // Enum 0 + { + AutonomousSelfLocateLogTest(); + } + break; + + case EMOLRSelfLocateRequest: // Enum 1 + { + MOLRSelfLocateRequest(); + } + break; + + case EMOLRCellBasedLocationRequest: // Enum 2 + { + MOLRCellBasedLocationRequest(); + } + break; + + case EMOLRTransmitTo3rdPartyLocationRequest: // Enum 3 + { + MOLRTransmitTo3rdPartyLocationRequest(); + } + break; + + case EMTLR: // Enum 4 + { + MTLR(); + } + break; + + case EMOLRTrackingLocationRequest: // Enum 5 + { + MOLRTrackingLocationRequest(); + } + break; + + case EAutonomousTrackingLocationRequest: // Enum 6 + { + AutonomousTrackingLocationRequest(); + } + break; + + default: + { + INFO_PRINTF1(_L("Failed to match a test case Id.")); + SetTestStepResult(EFail); + } + break; + }// End of switch + + ClearLog(); + }// End of GetIntFromConfig()... + + } // End of "If TestStepResult..." + + + INFO_PRINTF1(_L("<<CT_LbsStep_VerifyLogInfo::doTestStepL()")); + + return TestStepResult(); + } +TVerdict CT_LbsStep_VerifyLogInfo::ReadFromLogL(TInt aUidForTheLogType) + { + + /** + * Filter the type of log we are looking for based on UID + */ + CLogFilter* filter = CLogFilter::NewL(); // NEW FILTER + CleanupStack::PushL(filter); + filter->SetEventType(TUid::Uid(aUidForTheLogType)); + + /* + * Obtain the last added event from LBS logger + */ + TBool res = iview->SetFilterL(*filter, iActiveWaiter->iStatus); + if (res == EFail) + { + INFO_PRINTF1(_L("\t Error: Set filter failed.")); + return EFail; + } + + iActiveWaiter->StartAndWait(); + if (iActiveWaiter->iStatus != KErrNone) + { + INFO_PRINTF1(_L("\t Error: Create Log iview failed.")); + return EFail; + } + + /* + * Count how many of these events there are and + * store each event in the relevant array + */ + + TInt count = iview->CountL(); + TLinearOrder selfLocLogOrder(SelfLocateLogEventTimestampCompare); + for(int i=0 ; i 0) + { + // Get first event in order of occurance + if(!iview->LastL(iActiveWaiter->iStatus)) + { + INFO_PRINTF2(_L("\t Error: Read last log failed with error %d."), iActiveWaiter->iStatus.Int()); + return EFail; + } + } + + if(i>0 && iCancel(); + iActiveWaiter->StartAndWait(); + if (iActiveWaiter->iStatus != KErrNone) + { + INFO_PRINTF1(_L("\t Error: Failed to cancel outstanding request.")); + return EFail; + } + + // Move onto the next event in order of occurance and store it in succession + if(!iview->PreviousL(iActiveWaiter->iStatus)) + { + INFO_PRINTF2(_L("\t Error: Read previous log failed with error %d."), iActiveWaiter->iStatus.Int()); + return EFail; + } + } + + CLogEvent* logEvent = CLogEvent::NewL(); // NEW LOGEVENT + CleanupStack::PushL(logEvent); + logEvent->CopyL(iview->Event()); + + // Pass ownership to the relevant array + switch(aUidForTheLogType) + { + case KLogLbsSelfLocateEventType: + { + RPointerArray& logInfoArr = iParent.iSharedData->iSelfLocateLogInfoArr; + CLbsSelfLocateLogEvent* selfLocateEv = static_cast(CLbsLogEvent::NewL(*logEvent)); + CleanupStack::PushL(selfLocateEv); + // SelfLoc Log events seem to be returned out of order, so wee need to sort them + logInfoArr.InsertInOrder(selfLocateEv, selfLocLogOrder); + CleanupStack::Pop(selfLocateEv); + } + break; + + case KLogLbsNetworkLocateEventType: + { + RPointerArray& logInfoArr = iParent.iSharedData->iNetworkLocateLogInfoArr; + CLbsNetworkLocateLogEvent* networkLocateEv = static_cast(CLbsLogEvent::NewL(*logEvent)); + CleanupStack::PushL(networkLocateEv); + logInfoArr.AppendL(networkLocateEv); // Store it in the array + CleanupStack::Pop(networkLocateEv); } + break; + + case KLogLbsExternalLocateEventType: + { + RPointerArray& logInfoArr = iParent.iSharedData->iExternalLocateLogInfoArr; + CLbsExternalLocateLogEvent* externalLocateEv = static_cast(CLbsLogEvent::NewL(*logEvent)); + CleanupStack::PushL(externalLocateEv); + logInfoArr.AppendL(externalLocateEv); // Store it in the array + CleanupStack::Pop(externalLocateEv); + } + break; + + case KLogLbsTransmitLocationEventType: + { + RPointerArray& logInfoArr = iParent.iSharedData->iX3PLocateLogInfoArr; + CLbsTransmitLocationLogEvent* x3pLocateEv = static_cast(CLbsLogEvent::NewL(*logEvent)); + CleanupStack::PushL(x3pLocateEv); + logInfoArr.AppendL(x3pLocateEv); // Store it in the array + CleanupStack::Pop(x3pLocateEv); + } + break; + + case KLogLbsAssistanceDataEventType: + { + RPointerArray& logInfoArr = iParent.iSharedData->iAssistanceDataLogInfoArr; + CLbsAssistanceDataLogEvent* assistanceLogEv = static_cast(CLbsLogEvent::NewL(*logEvent)); + CleanupStack::PushL(assistanceLogEv); + logInfoArr.AppendL(assistanceLogEv); // Store it in the array + CleanupStack::Pop(assistanceLogEv); + } + break; + + default: + { + INFO_PRINTF1(_L("\t Error: Couldnt match UID to a testable logtype.")); + i = count; // Force loop exit + SetTestStepResult(EFail); + } + } + + // Cleanup scoped variables + CleanupStack::PopAndDestroy(logEvent); + }// End of for loop + + // Cancel outstanding request... + iActiveWaiter->Cancel(); + iActiveWaiter->StartAndWait(); + if (iActiveWaiter->iStatus != KErrNone) + { + INFO_PRINTF1(_L("\t Error: Failed to cancel any outstanding requests.")); + return EFail; + } + + // Cleanup local variables + CleanupStack::PopAndDestroy(filter); + + return EPass; + } + +void CT_LbsStep_VerifyLogInfo::SelfLocateLogTest() + { + + INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *")); + INFO_PRINTF1(_L("SelfLocateLogTest>>")); + TVerdict res; + TBool compareResult; + + // Empty SharedData values between update options tests + iParent.iSharedData->iSelfLocateLogInfoArr.Reset(); + + // reads all self-locate log entries into iSelfLocateLogInfoArr: + res = ReadFromLogL(KLogLbsSelfLocateEventType); + + if (res == EFail) // if readfromlog fails... + { + INFO_PRINTF1(_L("SelfLocateRequest > ReadFromLog Failed")); + SetTestStepResult(EFail); + } + else + { + + // Compare DB log event and expected log event + INFO_PRINTF1(_L("SelfLocateRequest > About to compare...")); + + + RPointerArray& logInfoArr = iParent.iSharedData->iSelfLocateLogInfoArr; + + TInt sizeOfArray = logInfoArr.Count(); + + if( ((sizeOfArray != 2) && (iLogType == EAutonomousTrackingLocationRequest)) || + ((sizeOfArray != 3) && (iLogType == EMOLRTrackingLocationRequest)) + ) + { + INFO_PRINTF2(_L("Update Log test failed, there were %d Self Locate events"),sizeOfArray); + SetTestStepResult(EFail); + } + else + { + // Change reference location to be expected value + TPositionInfo* posInfoSecond = new TPositionInfo(); + SecondPositionFromArray(posInfoSecond); + + for(TInt i = 0 ; i < sizeOfArray ; i++) + { + // note that events are in reverse order, therefore the reference position is last rather than first of 2 + if(iLogType == EMOLRTrackingLocationRequest && i == 2) + { + iSelfLocateLogIntiailisedFromValues->SetPositionInfo(posInfoSecond); + } + + + if(iLogType == EMOLRSelfLocateRequest && i == 1) + { + iSelfLocateLogIntiailisedFromValues->SetPositionInfo(posInfoSecond); + } + + compareResult = iUtils.Compare_SelfLocateLog( *(reinterpret_cast(logInfoArr[i])) , + *iSelfLocateLogIntiailisedFromValues + ); + if(!compareResult) + { + INFO_PRINTF2(_L("SelfLocateRequest > compare returns false for element %d..."),i); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF1(_L("SelfLocateRequest > compare returns true...")); + } + } + + delete posInfoSecond; + + } + } + + INFO_PRINTF1(_L("SelfLocateLogTest<<")); + INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *")); + } + + +void CT_LbsStep_VerifyLogInfo::NetworkLocateLogTest() + { + INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *")); + INFO_PRINTF1(_L("NetworkLocateLogTest>>")); + TVerdict res; + TBool compareResult; + + res = ReadFromLogL(KLogLbsNetworkLocateEventType); + + if (res == EFail) // if readfromlog fails... + { + INFO_PRINTF1(_L("NetworkLocateRequest > Readfrom log failed")); + SetTestStepResult(EFail); + } + else + { + // Compare DB log event and expected log event + INFO_PRINTF1(_L("NetworkSelfLocateRequest > About to compare...")); + + RPointerArray& logInfoArr = iParent.iSharedData->iNetworkLocateLogInfoArr; + + TInt sizeOfArray = logInfoArr.Count(); + + + for(TInt i = 0 ; i < sizeOfArray ; i++) + { + + compareResult = iUtils.Compare_NetworkLocateLog( *(reinterpret_cast(logInfoArr[i])) , + *iNetworkLocateLogIntiailisedFromValues + ); + if(!compareResult) + { + INFO_PRINTF2(_L("NetworkLocateRequest > compare returns false for element %d..."),i); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF1(_L("NetworkLocateRequest > compare returns true...")); + } + } + + } + + INFO_PRINTF1(_L("NetworkLocateLogTest<<")); + INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *")); + } + +void CT_LbsStep_VerifyLogInfo::ExternalLocateLogTest() + { + + INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *")); + INFO_PRINTF1(_L("ExternalLocateLogTest>>")); + TVerdict res; + TBool compareResult; + + res = ReadFromLogL(KLogLbsExternalLocateEventType); + + if (res == EFail) // if readfromlog fails... + { + INFO_PRINTF1(_L("ExternalLocateRequest > ReadFromLog Failed")); + SetTestStepResult(EFail); + } + else + { + // Compare DB log event and expected log event + INFO_PRINTF1(_L("NetworkSelfLocateRequest > About to compare...")); + + RPointerArray& logInfoArr = iParent.iSharedData->iExternalLocateLogInfoArr; + + TInt sizeOfArray = logInfoArr.Count(); + TPositionInfo* posInfoSecond = new TPositionInfo(); + TPositionInfo* commonPosinfo = CommonPositionInfo(); + for(TInt i = 0 ; i < sizeOfArray ; i++) + { + if(iLogType==EMOLRTrackingLocationRequest && i%2==1) + { + TInt gatewayId = 271064388; // KLbsGpsLocManagerUidValue + TUid gatewayUid = TUid::Uid(gatewayId); + iExternalLocateLogIntiailisedFromValues->SetRequestOriginator(gatewayUid); + + TLbsRequestOutcome tweakedOutcome = ELbsRequestOutcomeInconclusive; + iExternalLocateLogIntiailisedFromValues->SetRequestOutcome(tweakedOutcome); + + SecondPositionFromArray(posInfoSecond); + iExternalLocateLogIntiailisedFromValues->SetReferenceLocation(posInfoSecond); + iExternalLocateLogIntiailisedFromValues->SetPositionInfo(commonPosinfo); + } + + // logtype 5 + if(iLogType==EMOLRTrackingLocationRequest && i%2==0) + { + TInt gatewayId = 271064388; // KLbsGpsLocManagerUidValueS + TUid gatewayUid = TUid::Uid(gatewayId); + iExternalLocateLogIntiailisedFromValues->SetRequestOriginator(gatewayUid); + + // Change outcome to expected value + TLbsRequestOutcome tweakedOutcome = ELbsRequestOutcomeSuccess; + iExternalLocateLogIntiailisedFromValues->SetRequestOutcome(tweakedOutcome); + + // Change reference location to be expected value + // Set the reference position, which also be used for any required verification. + TPosition refPos; + TPositionInfo* posInfo = new TPositionInfo(); + refPos.SetCoordinate(REFPOS_LAT_OTHER, REFPOS_LONG_OTHER, REFPOS_ALT_OTHER); + refPos.SetAccuracy(REFPOS_HORZ_ACCURACY_OTHER, REFPOS_VERT_ACCURACY_OTHER); + refPos.SetCurrentTime(); + static_cast(posInfo)->SetPosition(refPos); + + iExternalLocateLogIntiailisedFromValues->SetReferenceLocation(posInfo); + delete posInfo; + } + + // logtype 1 + if(iLogType==EMOLRSelfLocateRequest) + { + TInt locManagerId = 271064388; // KLbsGpsLocManagerUidValue + TUid locManagerUid = TUid::Uid(locManagerId); + iExternalLocateLogIntiailisedFromValues->SetRequestOriginator(locManagerUid); + + // Change outcome to expected value + TLbsRequestOutcome tweakedOutcome = ELbsRequestOutcomeSuccess; + iExternalLocateLogIntiailisedFromValues->SetRequestOutcome(tweakedOutcome); + + // Expect position to be NULL for first event + // Set expected outcome of second External event + if(i==1) + { + TLbsRequestOutcome tweakedOutcome = ELbsRequestOutcomeInconclusive; + iExternalLocateLogIntiailisedFromValues->SetRequestOutcome(tweakedOutcome); + iExternalLocateLogIntiailisedFromValues->SetPositionInfo(commonPosinfo); + iExternalLocateLogIntiailisedFromValues->SetReferenceLocation(iRefPosTwo); + } + } + + if(iLogType==EMOLRTransmitTo3rdPartyLocationRequest && i==1) + { + TLbsRequestOutcome tweakedOutcome = ELbsRequestOutcomeInconclusive; + iExternalLocateLogIntiailisedFromValues->SetRequestOutcome(tweakedOutcome); + SecondPositionFromArray(posInfoSecond); + iExternalLocateLogIntiailisedFromValues->SetReferenceLocation(posInfoSecond); + } + + if(iLogType==EMOLRTransmitTo3rdPartyLocationRequest && i==1) + { + iExternalLocateLogIntiailisedFromValues->SetPositionInfo(commonPosinfo); + } + + + if(iLogType == EMTLR) + { + iExternalLocateLogIntiailisedFromValues->SetPositionInfo(commonPosinfo); + InitialiseRHSforMTLR(); + } + + + compareResult = iUtils.Compare_ExternalLocateLog( *(reinterpret_cast(logInfoArr[i])) , + *iExternalLocateLogIntiailisedFromValues + ); + if(!compareResult) + { + INFO_PRINTF2(_L("ExternalLocateLog > compare returns false for element %d..."),i); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF1(_L("ExternalLocateLog > compare returns true...")); + } + } // End for loop + delete commonPosinfo; + delete posInfoSecond; + } + + INFO_PRINTF1(_L("ExternalLocateLogTest<<")); + INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *")); + + } + +void CT_LbsStep_VerifyLogInfo::X3PLocateLogTest() + { + INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *")); + INFO_PRINTF1(_L("X3PLocateLogTest>>")); + TVerdict res; + TBool compareResult; + + res = ReadFromLogL(KLogLbsTransmitLocationEventType); + + if (res == EFail) // if readfromlog fails... + { + INFO_PRINTF1(_L("X3PLocateRequest > ReadFromLog Failed")); + SetTestStepResult(EFail); + } + else + { + // Compare DB log event and expected log event + INFO_PRINTF1(_L("X3PLocateLog > About to compare...")); + + RPointerArray& logInfoArr = iParent.iSharedData->iX3PLocateLogInfoArr; + + TInt sizeOfArray = logInfoArr.Count(); + + for(TInt i = 0 ; i < sizeOfArray ; i++) + { + compareResult = iUtils.Compare_TransmitLocationLog( *(reinterpret_cast(logInfoArr[i])) , + *iX3PLogIntiailisedFromValues + ); + if(!compareResult) + { + INFO_PRINTF2(_L("X3PLocateLogTest > compare returns false for element %d..."),i); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF1(_L("X3PLocateLogTest > compare returns true...")); + } + } + } + + INFO_PRINTF1(_L("X3PLocateLogTest<<")); + INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *")); + } + +void CT_LbsStep_VerifyLogInfo::AssistanceDataLogTest() + { + + INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *")); + INFO_PRINTF1(_L("AssistanceDataLogTest>>")); + TVerdict res; + TBool compareResult = ETrue; + + res = ReadFromLogL(KLogLbsAssistanceDataEventType); + + if (res == EFail) // if readfromlog fails... + { + INFO_PRINTF1(_L("AssistanceDataLog > ReadFromLog Failed")); + SetTestStepResult(EFail); + } + else + { + // Compare DB log event and expected log event + INFO_PRINTF1(_L("AssistanceDataLog > About to compare...")); + + RPointerArray& logInfoArr = iParent.iSharedData->iAssistanceDataLogInfoArr; + + TInt sizeOfArray = logInfoArr.Count(); + TPositionInfo* commonPosinfo = CommonPositionInfo(); + for(TInt i = 0 ; i < sizeOfArray ; i++) + { + + if( iLogType == EMOLRTrackingLocationRequest || + iLogType ==EMOLRTransmitTo3rdPartyLocationRequest ) + { + iAssistanceDataLogIntiailisedFromValuesFirst->SetRequestAssistanceDataType(0); + } + + + /* + * If we run X3P log test on its own we get logs that are different than when its run + * in sequence with other tests. + */ + if(sizeOfArray > 1 && iLogType ==EMOLRTransmitTo3rdPartyLocationRequest) + { + if(i==1) + { + // Second log has a mask of 0 + iAssistanceDataLogIntiailisedFromValuesFirst->SetRequestAssistanceDataType(0); + compareResult = iUtils.Compare_AssistanceDataLog( *(reinterpret_cast(logInfoArr[i])) , + *iAssistanceDataLogIntiailisedFromValuesFirst + ); + } + else + { + iAssistanceDataLogIntiailisedFromValuesFirst->SetRequestAssistanceDataType(8); + compareResult = iUtils.Compare_AssistanceDataLog( *(reinterpret_cast(logInfoArr[i])) , + *iAssistanceDataLogIntiailisedFromValuesFirst + ); + } + } + + if(!compareResult) + { + INFO_PRINTF2(_L("AssistanceDataLogTest > compare returns false for element %d..."),i); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF1(_L("AssistanceDataLogTest > compare returns true...")); + } + }// End of for loop + delete commonPosinfo; + } + + INFO_PRINTF1(_L("AssistanceDataLogTest<<")); + INFO_PRINTF1(_L("* * * * * * * * * * * * * * * * * * * * * *")); + } + + + +// Top level functionality + +void CT_LbsStep_VerifyLogInfo::AutonomousSelfLocateLogTest() + { + SelfLocateLogTest(); + } + +void CT_LbsStep_VerifyLogInfo::MOLRSelfLocateRequest() // ** Similar ** + { + ExternalLocateLogTest(); + AssistanceDataLogTest(); + SelfLocateLogTest(); + } + +void CT_LbsStep_VerifyLogInfo::MOLRCellBasedLocationRequest() + { + NetworkLocateLogTest(); + } + +void CT_LbsStep_VerifyLogInfo::MOLRTransmitTo3rdPartyLocationRequest() + { + AssistanceDataLogTest(); + ExternalLocateLogTest(); + X3PLocateLogTest(); + } + +void CT_LbsStep_VerifyLogInfo::MTLR() // ** Similar ** + { + // SelfLocateLogTest(); + ExternalLocateLogTest(); + AssistanceDataLogTest(); + } + +void CT_LbsStep_VerifyLogInfo::MOLRTrackingLocationRequest() // ** Similar ** + { + SelfLocateLogTest(); + AssistanceDataLogTest(); + ExternalLocateLogTest(); + } + +void CT_LbsStep_VerifyLogInfo::AutonomousTrackingLocationRequest() + { + SelfLocateLogTest(); + } + + + + +void CT_LbsStep_VerifyLogInfo::InitialiseRHS() + { + // Variables needed for all reads + // CommonToAll + TBool direction; // Inbound or outbound + + // wont be filled in components ELbsRequestOutcomeSuccess/ELbsRequestOutcomeFailed/...Inconclusive etc + TLbsRequestOutcome theSelfLocateRequestOutcome; + TLbsRequestOutcome theX3PRequestOutcome; + TLbsRequestOutcome theExternalLocateRequestOutcome; + TLbsRequestOutcome theNetworkLocateRequestOutcome; + TLbsRequestOutcome theAssistanceDataRequestOutcome; + + // Common to 4/5 but not assistance + TInt theCost; // not implemented + + // Common to 4/5 but not external + TUid theLocalAppUid; // work out from PID + + // Common only to External Locate + TInt theOriginator; // From network gateway + TInt theSessionNum; // TNetLocSessionID? + TInt theSessionOwner; // TNetLocSessionID? + TInt theAction; // Set within privacy request + TInt theAdvice; // Set within privacy request + TPtrC theClientName; // Set within privacy request + TPtrC theExternalId; // Set within privacy request + TPtrC theRequestor; // Set within privacy request + TInt theResult; // ENum within privacy response + + // Common only to X3P Locate + TUid theX3PUid; // work out from PID + + // Common only to Assistance + TInt theFirstRequestMask; // Set within GPSlocmanager // Set within GPSlocmanager for wanted + TInt theReceiveMask; // Set within GPSlocmanager // Set within GPSlocmanager for recieved + + + // Specialised variables + theCost = 0; + theLocalAppUid = TUid::Uid(RProcess().SecureId()); // Get this from ProcessId each time + TInt testX3PserverId = 271065697; + theX3PUid = TUid::Uid(testX3PserverId); // Id of NRH + TInt locServerAppId = 271064387; + TUid locServerAppUid = TUid::Uid(locServerAppId); + + direction = EFalse; + + theSelfLocateRequestOutcome = ELbsRequestOutcomeSuccess; // or ELbsRequestOutcomeFailed or Inconclusive etc + theX3PRequestOutcome = ELbsRequestOutcomeSuccess;// Set it to this for X3P test + theExternalLocateRequestOutcome = ELbsRequestOutcomeSuccess; + theNetworkLocateRequestOutcome = ELbsRequestOutcomeSuccess; + theAssistanceDataRequestOutcome = ELbsRequestOutcomeInconclusive; // Set it to this for X3P test + + TPositionInfo* commonPosinfo = CommonPositionInfo(); + + + // Set up relevant 5 Log variables for comparison using position info etc + // SELF LOCATE LOG + iSelfLocateLogIntiailisedFromValues->SetPositionInfo(commonPosinfo); + iSelfLocateLogIntiailisedFromValues->SetDirection(direction); + iSelfLocateLogIntiailisedFromValues->SetLocalApp(theLocalAppUid); // This apps UID + iSelfLocateLogIntiailisedFromValues->SetCostInformation(theCost); // set cost information if there are any; + iSelfLocateLogIntiailisedFromValues->SetRequestOutcome(theSelfLocateRequestOutcome); // by passing the location request outcome; + + + // EXTERNAL LOG + iExternalLocateLogIntiailisedFromValues->SetDirection(direction); + iExternalLocateLogIntiailisedFromValues->SetCostInformation(theCost); + iExternalLocateLogIntiailisedFromValues->SetRequestOutcome(theExternalLocateRequestOutcome); // by passing the location request outcome; + // No local app id to set for external log + // Common only to External Locate + theOriginator = 271064389; // From Network request handler + theSessionOwner = 0; // 268440115 TNetLocSessionID? + theSessionNum = 0; // TNetLocSessionID? + theAction = 0; // Set within privacy request 0 + theAdvice = 0; // Set within privacy request 0 = ERequestAdviceNotUsed, 1 = ERequestActionAllow + + _LIT(KClientName,""); + _LIT(KRequestor,""); + _LIT(KExternalId,""); + theClientName.Set(KClientName); // Set within privacy request + theRequestor.Set(KRequestor); // Set within privacy request + theExternalId.Set(KExternalId); // Set within privacy request + theResult = 0; // ENum within privacy response, 1 = ERequestAccepted + + // set privacy request parameters + TLbsLoggingPrivacyRequestParams reqParams; + TLbsNetSessionId sessionId(TUid::Uid(0), (TUint32)theSessionNum); + reqParams.iSessionId.SetSessionOwner(TUid::Uid(theSessionOwner)); + reqParams.iSessionId.SetSessionNum(theSessionNum); + reqParams.iRequestPrivacy.SetRequestAction((TLbsNetPosRequestPrivacy::TLbsRequestAction)theAction); + reqParams.iRequestPrivacy.SetRequestAdvice((TLbsNetPosRequestPrivacy::TLbsRequestAdvice)theAdvice); + + TPtrC8 ptrReq((TUint8*)theRequestor.Ptr(), theRequestor.Size()); + TPtrC8 ptrClient((TUint8*)theClientName.Ptr(), theClientName.Size()); + TPtrC8 ptrId((TUint8*)theExternalId.Ptr(), theExternalId.Size()); + reqParams.iRequestInfo.SetRequesterId(reinterpret_cast(ptrReq)); + reqParams.iRequestInfo.SetClientName(reinterpret_cast(ptrClient)); + reqParams.iRequestInfo.SetClientExternalId(reinterpret_cast(ptrId)); + + // set privacy response parameters + TLbsLoggingPrivacyResponseParams respParams; + respParams.iSessionId.SetSessionOwner(TUid::Uid(0)); + respParams.iSessionId.SetSessionNum(0); + respParams.iResult = static_cast(theResult); + + iExternalLocateLogIntiailisedFromValues->SetRequestOriginator(TUid::Uid(theOriginator)); + iExternalLocateLogIntiailisedFromValues->SetPrivacyRequestParams(reqParams); // set privacy request parameters from request originator + iExternalLocateLogIntiailisedFromValues->SetPrivacyResponseParams(respParams); // set privacy response parameters from privacy controller + iExternalLocateLogIntiailisedFromValues->SetReferenceLocation(commonPosinfo); + + + // X3P LOG + iX3PLogIntiailisedFromValues->SetPositionInfo(commonPosinfo); + iX3PLogIntiailisedFromValues->SetDirection(direction); + iX3PLogIntiailisedFromValues->SetCostInformation(theCost); // set cost information if there are any; + iX3PLogIntiailisedFromValues->SetRequestOutcome(theX3PRequestOutcome); // by passing the location request outcome; + // X3P log only + iX3PLogIntiailisedFromValues->SetX3PApp(theX3PUid); // This apps Uid + + + + // FIRST ASSISTANCE DATA LOG + iAssistanceDataLogIntiailisedFromValuesFirst->SetDirection(direction); + iAssistanceDataLogIntiailisedFromValuesFirst->SetRequestOutcome(theAssistanceDataRequestOutcome); // by passing the location request outcome; + // No cost to set for assistance log + // Common only to Assistance + theFirstRequestMask = 8; // Set within GPSlocmanager for wanted (8 for first in array, 0 for second) + theReceiveMask = 8; // Set within GPSlocmanager for recieved + iAssistanceDataLogIntiailisedFromValuesFirst->SetRequestAssistanceDataType(theFirstRequestMask); + iAssistanceDataLogIntiailisedFromValuesFirst->SetReceiveAssistanceDataType(theReceiveMask); + + + + // NETWORK LOCATE LOG + commonPosinfo->SetModuleId(TUid::Uid(0)); + + iNetworkLocateLogIntiailisedFromValues->SetPositionInfo(commonPosinfo); + iNetworkLocateLogIntiailisedFromValues->SetDirection(direction); + iNetworkLocateLogIntiailisedFromValues->SetCostInformation(theCost); // set cost information if there are any; + iNetworkLocateLogIntiailisedFromValues->SetRequestOutcome(theNetworkLocateRequestOutcome); // by passing the location request outcome; + iNetworkLocateLogIntiailisedFromValues->SetLocalApp(locServerAppUid); // This apps UID + + delete commonPosinfo; + } + +void CT_LbsStep_VerifyLogInfo::InitialiseRHSforMTLR() + { + // For MTLR, most of the expected external logs values need to be completely different. + + TInt theOriginator; // From network gateway + TInt theSessionNum; // TNetLocSessionID? + TInt theSessionOwner; // TNetLocSessionID? + TInt theAction; // Set within privacy request + TInt theAdvice; // Set within privacy request + TPtrC8 theClientName; // Set within privacy request + TPtrC8 theExternalId; // Set within privacy request + TPtrC8 theRequestor; // Set within privacy request + TInt theRequestResult; // ENum within privacy response + + theOriginator = 271064432; // From Protocol Module + theSessionOwner = 271064432; // Protocol Module + theSessionNum = 1; // TNetLocSessionID? + theAction = 1; // Set within privacy request 0 + theAdvice = 1; // Set within privacy request 0 = ERequestAdviceNotUsed, 1 = ERequestActionAllow + + _LIT8(KMTLRClientName,"MT-LR test client name"); + _LIT8(KMTLRRequestor,"MT-LR test requester id"); + _LIT8(KMTLRExternalId,"MT-LR test client external id"); + theClientName.Set(KMTLRClientName); // Set within privacy request + theRequestor.Set(KMTLRRequestor); // Set within privacy request + theExternalId.Set(KMTLRExternalId); // Set within privacy request + theRequestResult = 1; // ENum within privacy response, 1 = ERequestAccepted + + + // set privacy request parameters + TLbsLoggingPrivacyRequestParams reqParams; + TLbsNetSessionId sessionId(TUid::Uid(0), (TUint32)theSessionNum); + reqParams.iSessionId.SetSessionOwner(TUid::Uid(theSessionOwner)); + reqParams.iSessionId.SetSessionNum(theSessionNum); + reqParams.iRequestPrivacy.SetRequestAction((TLbsNetPosRequestPrivacy::TLbsRequestAction)theAction); + reqParams.iRequestPrivacy.SetRequestAdvice((TLbsNetPosRequestPrivacy::TLbsRequestAdvice)theAdvice); + + TPtrC8 ptrReq((TUint8*)theRequestor.Ptr(), theRequestor.Size()); + TPtrC8 ptrClient((TUint8*)theClientName.Ptr(), theClientName.Size()); + TPtrC8 ptrId((TUint8*)theExternalId.Ptr(), theExternalId.Size()); + reqParams.iRequestInfo.SetRequesterId(reinterpret_cast(ptrReq)); + reqParams.iRequestInfo.SetClientName(reinterpret_cast(ptrClient)); + reqParams.iRequestInfo.SetClientExternalId(reinterpret_cast(ptrId)); + + // set privacy response parameters + TLbsLoggingPrivacyResponseParams respParams; + respParams.iSessionId.SetSessionOwner(TUid::Uid(theSessionOwner )); + respParams.iSessionId.SetSessionNum(theSessionNum ); + respParams.iResult = static_cast(theRequestResult); + + iExternalLocateLogIntiailisedFromValues->SetRequestOriginator(TUid::Uid(theOriginator)); + iExternalLocateLogIntiailisedFromValues->SetPrivacyRequestParams(reqParams); // set privacy request parameters from request originator + iExternalLocateLogIntiailisedFromValues->SetPrivacyResponseParams(respParams); // set privacy response parameters from privacy controller + } + +void CT_LbsStep_VerifyLogInfo::ClearLog() + { + // Setup a time in the future, before which all events will be deleted + _LIT(KDateCorrect1,"20900101:"); + TTime time; + TBuf <10> theDate(KDateCorrect1); + TInt err=time.Set(theDate); + + // Ensure time has been set correctly + if(err != KErrNone) + { + INFO_PRINTF1(_L("Failed to set time")); + } + + if(err == KErrGeneral) + { + INFO_PRINTF1(_L("Time syntax is incorrect")); + } + + // Set the filter to view ALL logs + CLogFilter* filter = CLogFilter::NewL(); // NEW FILTER + CleanupStack::PushL(filter); + TBool res = iview->SetFilterL(*filter, iActiveWaiter->iStatus); + if (res == EFalse) + { + INFO_PRINTF1(_L("\t No such events to filter in the view.")); + iclient->Cancel(); + } + else + { + // else If there are logs, flush them + + // Cancel outstanding requests + iclient->Cancel(); + iActiveWaiter->StartAndWait(); + if (iActiveWaiter->iStatus != KErrNone) + { + INFO_PRINTF2(_L("\t Error: Cancel returned error %d."),iActiveWaiter->iStatus.Int()); + SetTestStepResult(EFail); + } + + // Clear ALL logs + iclient->ClearLog(time, iActiveWaiter->iStatus); + iActiveWaiter->StartAndWait(); + if (iActiveWaiter->iStatus != KErrNone) + { + INFO_PRINTF2(_L("\t Error: Clear log returned error %d."),iActiveWaiter->iStatus.Int()); + SetTestStepResult(EFail); + } + + //Confirm log is cleared + if(iview->CountL() != 0) + { + INFO_PRINTF2(_L("ERROR: Log still has %d entries"),iview->CountL()); + SetTestStepResult(EFail); + } + + } + + CleanupStack::PopAndDestroy(filter); + + } +void CT_LbsStep_VerifyLogInfo::SecondPositionFromArray(TPositionInfo* aPosInfoSecond) +{ + + //All this in TPosInfo Structure + TUid theModuleId; // use from VerifyLogInfo array + TPositionModuleInfo::TTechnologyType theTechType; + TPositionModeReason theModeReason; + TReal32 theVerAccuracy; + TReal32 theHorAccuracy; + TReal64 theLat; + TReal64 theLong; + TReal theAltitude; + + // Initialise variables from Verify array + RPointerArray& logInfoArr = iParent.iSharedData->iVerifyPosInfoArr; + TPositionInfo* tPosInfo = (reinterpret_cast(logInfoArr[0])); + TPosition tPos; + tPosInfo->GetPosition(tPos); + + theModuleId = TUid::Uid(271064388); // 271064388; + theTechType = tPosInfo->PositionMode(); + theModeReason = tPosInfo->PositionModeReason(); + theVerAccuracy = REFPOS_VERT_ACCURACY; // For second x3p reference position comparison + theHorAccuracy = REFPOS_HORZ_ACCURACY; // For second x3p reference position comparison + theLat = REFPOS_LAT; // For second x3p reference position comparison + theLong = REFPOS_LONG; // For second x3p reference position comparison + theAltitude = REFPOS_ALT; // For second x3p reference position comparison + + + // Setup position information using intialised variables + aPosInfoSecond->SetModuleId(theModuleId); + aPosInfoSecond->SetUpdateType(EPositionUpdateGeneral); + aPosInfoSecond->SetPositionMode((TPositionModuleInfo::TTechnologyType)theTechType); + aPosInfoSecond->SetPositionModeReason((TPositionModeReason)theModeReason); + TPosition position; + position.SetCurrentTime(); + position.SetAccuracy(theHorAccuracy,theVerAccuracy); + position.SetCoordinate(theLat,theLong, theAltitude); + static_cast(aPosInfoSecond)->SetPosition(position); +} + + +TPositionInfo* CT_LbsStep_VerifyLogInfo::CommonPositionInfo() +{ + //All this in TPosInfo Structure + TUid theModuleId; // use from VerifyLogInfo array + TPositionModuleInfo::TTechnologyType theTechType; + TPositionModeReason theModeReason; + TReal32 theVerAccuracy; + TReal32 theHorAccuracy; + TReal64 theLat; + TReal64 theLong; + TReal theAltitude; + + // All this in TPosInfo Structure use from VerifyLogInfo array + RPointerArray& logInfoArr = iParent.iSharedData->iVerifyPosInfoArr; + + // Initialise variables from Verify array + TPositionInfo* tPosInfo = (reinterpret_cast(logInfoArr[0])); + TPosition tPos; + tPosInfo->GetPosition(tPos); + + theModuleId = TUid::Uid(271064388); // 271064388; + theTechType = tPosInfo->PositionMode(); + theModeReason = tPosInfo->PositionModeReason(); + theVerAccuracy = tPos.VerticalAccuracy(); + theHorAccuracy = tPos.HorizontalAccuracy(); + theLat = tPos.Latitude(); + theLong = tPos.Longitude(); + theAltitude = tPos.Altitude(); + + + // Setup position information using intialised variables + TPositionInfo* posInfo = new TPositionInfo(); + posInfo->SetModuleId(theModuleId); + posInfo->SetUpdateType(EPositionUpdateGeneral); + posInfo->SetPositionMode((TPositionModuleInfo::TTechnologyType)theTechType); + posInfo->SetPositionModeReason((TPositionModeReason)theModeReason); + TPosition position; + position.SetCurrentTime(); + position.SetAccuracy(theHorAccuracy,theVerAccuracy); + position.SetCoordinate(theLat,theLong, theAltitude); + static_cast(posInfo)->SetPosition(position); + + return posInfo; +} + +/** Compares the timestamps of two log events + returns 1 if the lhs is newer, -1 if the lhs is older or 0 if both are the same */ +TInt CT_LbsStep_VerifyLogInfo::SelfLocateLogEventTimestampCompare(const CLbsSelfLocateLogEvent& aLog1, + const CLbsSelfLocateLogEvent& aLog2) + { + TPositionInfo* tPosInfo1 = static_cast(aLog1.PositionInfo()); + TPositionInfo* tPosInfo2 = static_cast(aLog2.PositionInfo()); + TPosition tPos1; + TPosition tPos2; + tPosInfo1->GetPosition(tPos1); + tPosInfo2->GetPosition(tPos2); + TInt64 t1 = tPos1.Time().Int64(); + TInt64 t2 = tPos2.Time().Int64(); + if(t1 < t2) + { + // lhs is Newer + return 1; + } + else if(t1 > t2) + { + // lhs is Older + return -1; + } + // the same + return 0; + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepverifymodinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepverifymodinfo.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,75 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepverifymodinfo.cpp +// This is the class implementation for the Verify Module Information test step +// +// + +#include "ctlbsstepverifymodinfo.h" + +#include "tlbsutils.h" + + +/** + * Constructor + */ +CT_LbsStep_VerifyModInfo::CT_LbsStep_VerifyModInfo(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_VerifyModInfo); + } + + +/** +Static Constructor +*/ +CT_LbsStep_VerifyModInfo* CT_LbsStep_VerifyModInfo::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_VerifyModInfo(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsStep_VerifyModInfo::doTestStepL() + { + // Helper test step used to verify module information. + INFO_PRINTF1(_L(">>CT_LbsStep_VerifyModInfo::doTestStepL()")); + + if (TestStepResult() == EPass) + { + // Access the module infos to be compared. + TPositionModuleInfo& verifyModInfo = iParent.iSharedData->iVerifyModuleInfo; + TPositionModuleInfo& currentModInfo = iParent.iSharedData->iCurrentModuleInfo; + T_LbsUtils utils; + + // Verify module informations are equal. + TBool res = utils.Compare_ModuleInfo(verifyModInfo, currentModInfo); + + // Fail test if they do not match. + if (!res) + { + SetTestStepResult(EFail); + } + } + + INFO_PRINTF1(_L("<<CT_LbsStep_VerifyModInfo::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepverifymodstatus.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepverifymodstatus.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,76 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstepverifymodinfo.cpp +// This is the class implementation for the Verify Module Status test step +// +// + +#include "ctlbsstepverifymodstatus.h" +#include "tlbsutils.h" + + +/** + * Constructor + */ +CT_LbsStep_VerifyModStatus::CT_LbsStep_VerifyModStatus(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_VerifyModuleStatus); + } + + +/** +Static Constructor +*/ +CT_LbsStep_VerifyModStatus* CT_LbsStep_VerifyModStatus::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_VerifyModStatus(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsStep_VerifyModStatus::doTestStepL() + { + // Helper test step used to verify module information. + INFO_PRINTF1(_L(">>CT_LbsStep_VerifyModStatus::doTestStepL()")); + + if (TestStepResult() == EPass) + { + // Access the module infos to be compared. + TPositionModuleStatus& verifyModStatus = iParent.iSharedData->iVerifyModuleStatus; + TPositionModuleStatus& currentModStatus = iParent.iSharedData->iCurrentModuleStatus; + T_LbsUtils utils; + + // Verify module informations are equal. + TBool res; + + res = utils.Compare_ModuleStatus(verifyModStatus, currentModStatus); + + // Fail test if they do not match. + if (!res) + { + SetTestStepResult(EFail); + } + } + + INFO_PRINTF1(_L("<<CT_LbsStep_VerifyModStatus::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepverifyposinfos.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepverifyposinfos.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,73 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstep_verifyposinfos.cpp +// This is the class implementation for the Notify Position Update Tests +// +// + +#include "ctlbsstepverifyposinfos.h" + +#include "tlbsutils.h" + + +/** + * Constructor + */ +CT_LbsStep_VerifyPosInfos::CT_LbsStep_VerifyPosInfos(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_VerifyPosInfos); + } + + +/** +Static Constructor +*/ +CT_LbsStep_VerifyPosInfos* CT_LbsStep_VerifyPosInfos::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_VerifyPosInfos(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsStep_VerifyPosInfos::doTestStepL() + { + // Helper test step used to Verify the Position Information Array. + INFO_PRINTF1(_L(">>CT_LbsStep_VerifyPosInfos::doTestStepL()")); + + if (TestStepResult() == EPass) + { + // Access the arrays to be compared. + RPointerArray& verifyPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr; + RPointerArray& currentPosInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + T_LbsUtils utils; + + // Verify arrays are equal. + TBool res = utils.Compare_PosInfoArr(verifyPosInfoArr, currentPosInfoArr, T_LbsUtils::EExactAccuracy); + + // Fail test if arrays do not match. + if (!res) + SetTestStepResult(EFail); + } + + INFO_PRINTF1(_L("<<CT_LbsStep_VerifyPosInfos::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/common/src/ctlbsstepverifyroughposinfos.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/common/src/ctlbsstepverifyroughposinfos.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,73 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsstep_verifyposinfos.cpp +// This is the class implementation for the Notify Position Update Tests +// +// + +#include "ctlbsstepverifyroughposinfos.h" + +#include "tlbsutils.h" + + +/** + * Constructor + */ +CT_LbsStep_VerifyRoughPosInfos::CT_LbsStep_VerifyRoughPosInfos(CT_LbsServer& aParent) : CT_LbsStep(aParent) + { + SetTestStepName(KLbsStep_VerifyRoughPosInfos); + } + + +/** +Static Constructor +*/ +CT_LbsStep_VerifyRoughPosInfos* CT_LbsStep_VerifyRoughPosInfos::New(CT_LbsServer& aParent) + { + return new CT_LbsStep_VerifyRoughPosInfos(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsStep_VerifyRoughPosInfos::doTestStepL() + { + // Helper test step used to Verify the Position Information Array. + INFO_PRINTF1(_L(">>CT_LbsStep_VerifyRoughPosInfos::doTestStepL()")); + + if (TestStepResult() == EPass) + { + // Access the arrays to be compared. + RPointerArray& verifyPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr; + RPointerArray& currentPosInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + T_LbsUtils utils; + + // Verify arrays are equal. + TBool res = utils.Compare_PosInfoArr(verifyPosInfoArr, currentPosInfoArr, T_LbsUtils::ERoughAccuracy); + + // Fail test if arrays do not match. + if (!res) + SetTestStepResult(EFail); + } + + INFO_PRINTF1(_L("<<CT_LbsStep_VerifyRoughPosInfos::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/group/bld.inf Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,21 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "../lbstestutils/group/bld.inf" +#include "../internal/lbstestserver/group/bld.inf" +#include "../lbsclient/group/bld.inf" + +// Hybrid mode support +#include "../lbstestchannel/group/bld.inf" diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/BWINS/lbstestclientU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/BWINS/lbstestclientU.DEF Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,6 @@ +EXPORTS + ?NewL@CLbsTestServer@@SAPAV1@XZ @ 1 NONAME ; class CLbsTestServer * CLbsTestServer::NewL(void) + ?StopLbsSystem@CLbsTestServer@@QAEHXZ @ 2 NONAME ; int CLbsTestServer::StopLbsSystem(void) + ?ResetLbsSystem@CLbsTestServer@@QAEHXZ @ 3 NONAME ; int CLbsTestServer::ResetLbsSystem(void) + ?StartLbsSystem@CLbsTestServer@@QAEHXZ @ 4 NONAME ; int CLbsTestServer::StartLbsSystem(void) + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/EABI/lbstestclientU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/EABI/lbstestclientU.DEF Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,6 @@ +EXPORTS + _ZN14CLbsTestServer13StopLbsSystemEv @ 1 NONAME + _ZN14CLbsTestServer4NewLEv @ 2 NONAME + _ZN14CLbsTestServer14ResetLbsSystemEv @ 3 NONAME + _ZN14CLbsTestServer14StartLbsSystemEv @ 4 NONAME + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/group/bld.inf Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,22 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + +PRJ_TESTEXPORTS +../inc/lbstestclient.h /epoc32/include/lbs/test/lbstestclient.h + +PRJ_TESTMMPFILES +lbstestclient.mmp +lbstestserver.mmp diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/group/lbstestclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/group/lbstestclient.mmp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,32 @@ +// +// lbstestclient.mmp +// +// Project file for the LBS test client dll +// + +TARGET lbstestclient.dll +TARGETTYPE dll + +UID 0x1000007A 0x10282282 + +CAPABILITY All -Tcb + +SOURCEPATH ../src +SOURCE lbstestclient.cpp +SOURCE lbstestclientimpl.cpp + +// Generic server framework +//SOURCEPATH ../../../../../locationmgmt/locationcore/LbsLocCommon/ServerFramework/src +SOURCE cserverlaunch.cpp +SOURCE rsecuresessionbase.cpp +SOURCE tserverstartparams.cpp +SOURCE tstartparamsbase.cpp + + +USERINCLUDE ../inc +//USERINCLUDE ../../../../../locationmgmt/locationcore/LbsLocCommon/ServerFramework/inc + +SYSTEMINCLUDE /epoc32/include +SYSTEMINCLUDE /epoc32/include/lbs + +LIBRARY euser.lib diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/group/lbstestserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/group/lbstestserver.mmp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,42 @@ +// +// lbstestserver.mmp +// +// Project file for the LBS test server +// + +TARGET lbstestserver.exe +TARGETTYPE exe + +UID 0x1000007A 0x10282283 + +CAPABILITY All -Tcb + +SOURCEPATH ../src +SOURCE lbstestservermain.cpp +SOURCE lbstestserver.cpp +SOURCE lbstestsession.cpp + +// Generic server framework +//SOURCEPATH ../../../../../locationmgmt/locationcore/LbsLocCommon/ServerFramework/src +SOURCE csecureasbase.cpp +SOURCE csecureserverbase.cpp +SOURCE csecuresessionbase.cpp +SOURCE cshutdowntimer.cpp +SOURCE messageutils.cpp +SOURCE tserverstartparams.cpp +SOURCE tprocessstartparams.cpp +SOURCE cprocesslaunch.cpp +SOURCE tstartparamsbase.cpp + + +USERINCLUDE ../inc +//USERINCLUDE ../../../../../locationmgmt/locationcore/lbsrootapi/inc +//USERINCLUDE ../../../../../locationmgmt/locationcore/LbsLocCommon/ServerFramework/inc + +SYSTEMINCLUDE /epoc32/include +SYSTEMINCLUDE /epoc32/include/lbs + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY lbsrootapi.lib +LIBRARY lbspartnercommon.lib diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/claunchedprocess.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/claunchedprocess.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,47 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of class used to launch a LBS processes (non-server) +// +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef __LBSPROCESSLAUNCH_H__ +#define __LBSPROCESSLAUNCH_H__ + +#include +#include "tprocessstartparams.h" + +/** +@internalTechnology +@released + +CBase based Class, presents the launch process of the server side + */ + class CLaunchedProcess : public CBase + { +public: + static TInt CompleteProcessLaunch(); + static TInt CompleteProcessLaunch(TProcessStartParams& aParams); +protected: + static TInt DoCompleteProcessLaunchL(); + static TInt DoCompleteProcessLaunchL(TProcessStartParams& aParams); + }; + +#endif // __LBSPROCESSLAUNCH_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/cprocesslaunch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/cprocesslaunch.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,49 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of class used to launch a LBS processes (non-server) +// +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef __LBSPROCESSLAUNCH_H__ +#define __LBSPROCESSLAUNCH_H__ + +#include +#include "tprocessstartparams.h" + +/** +@internalTechnology +@released + +CBase based Class, presents the launch process of the server side + */ + class CProcessLaunch : public CBase + { +public: + static TInt CreateProcess(); + static TInt CreateProcess(TProcessStartParams& aParams); + static TInt ProcessLaunch(TProcessStartParams& aParams); +protected: + static TInt DoCreateProcessL(); + static TInt DoCreateProcessL(TProcessStartParams& aParams); + static TInt DoProcessLaunch(TProcessStartParams& aParams); + }; + +#endif // __LBSPROCESSLAUNCH_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/cquietus.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/cquietus.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,70 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/* +Quietus is Medieval Latin for discharged from an obligation, which comes form the Latin +(he is) at rest. So its a synonym for death :). See teh references below. +Which is exaclt what this object is all about - it starts the process that will kill any +process based around a CActiveScheduler. + +from Dictionary.com + +qui·e·tus + + 1. Something that serves to suppress, check, or eliminate. + 2. Release from life; death. + 3. A final discharge, as of a duty or debt. +[Short for Middle English quietus (est), (he is) discharged (of an obligation), +from Medieval Latin quitus (est), from Latin, (he is) at rest. See quiet.] + +from thesaurus.com +Main Entry: death +Part of Speech: noun +Definition: end +Synonyms: afterlife, annihilation, bereavement, casualty, cessation, curtains*, darkness, decease, demise, departure, destruction, dissolution, downfall, dying, end, ending, eradication, eternal rest, euthanasia, exit, expiration, extermination, extinction, fatality, finis*, finish, future home, grave, grim reaper*, heaven, loss, mortality, necrosis, obliteration, oblivion, paradise, parting, passing, passing over, quietus, release, repose, ruin, ruination, silence, sleep, termination, tomb, un +Antonyms: being, birth, existence, life, living, nascency +Source: Roget's New Millennium™ Thesaurus, First Edition (v 1.2.1) +Copyright © 2006 by Lexico Publishing Group, LLC. All rights reserved. +* = informal or slang + +*/ + +#ifndef __LBSQUIETUS_H__ +#define __LBSQUIETUS_H__ + +#include + +/** +@internalTechnology +@released + +CActive object, starts the process to kill any +process based around a CActiveScheduler. +*/ + +class CQuietus : public CActive + { +public: + static CQuietus* NewL(); + ~CQuietus(); + void CoupDeGrace(); +private: + CQuietus(); // make this private. + // from CActive + void RunL(); + void DoCancel(); + }; + +#endif // __LBSQUIETUS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/csecureasbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/csecureasbase.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,74 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of class used to start a LBS server process +// +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef __LBSSECUREASBASE_H__ +#define __LBSSECUREASBASE_H__ + +#include + +// forward classes +class TServerStartParams; + +/** +@internalTechnology +@released + + Interface to create server + */ +class MCreateServerImpl + { +public: + virtual void CreateServerLC(TServerStartParams& aParams) = 0; + }; + +/** +@internalTechnology +@released + +CActiveScheduler Class. + */ +class CSecureASBase : public CActiveScheduler + { +public: + enum TSecureASBasePanic + { + ECreateServerLCNotOverridden = 0 + }; +public: + CSecureASBase(); + static TInt ServerLaunch(TServerStartParams& aParams); + static TInt ServerMain(TServerStartParams& aParams); +protected: + static TInt RunServerL(TServerStartParams& aParams); + TInt CreateServer(); + + // create the derived server object and leave it on the cleanup stack + //virtual void CreateServerLC(TServerStartParams& aParams); + MCreateServerImpl* GetImplLC(); + void Panic(const TSecureASBasePanic aPanic); + }; + + + +#endif // __LBSSECUREASBASE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/csecureprocessasbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/csecureprocessasbase.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,53 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of class used to start a LBS non-server process +// +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef __LBSSECUREPROCESSASBASE_H__ +#define __LBSSECUREPROCESSASBASE_H__ + +#include + +/** +@internalTechnology +@released + +CActiveScheduler Class. + */ +class CSecureProcessASBase : public CActiveScheduler + { +public: + /** Secure process panic type */ + enum TSecureProcessASBasePanic + { + ECreateRootObjectNotOverridden = 1, + EEntryPointNotOverridden = 2 + }; +public: + // new bits for processes + virtual CBase* CreateRootObjectL(); + virtual TInt EntryPointL(CBase* aObj); + virtual void Final(); + void Panic(const TSecureProcessASBasePanic aPanic); + }; + +#endif //__LBSSECUREPROCESSASBASE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/csecureserverbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/csecureserverbase.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,100 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// csesureserverbase.h +// Definition of class used to encapsulate a LBS server +// (for example, LbsLocServer.exe) +// +// + + + +/** + @file + @internalTechnology +*/ + + +#ifndef __LBSSECURESERVERBASE_H__ +#define __LBSSECURESERVERBASE_H__ + +#include + +// forward classes +class CShutdownTimer; + +/** default server shutdown delay */ +const TTimeIntervalMicroSeconds32 KDefaultShutdownDelay = 2*1000*1000; + +// NB this and the panic list should be pblisghed all + released... +/** Liternal used as the panic catageory by the server framework */ +_LIT(KServerFrameworkPanic, "ServerFramework"); +enum TServerFrameWorkPanics + { + ESecureSubSessionBaseUnknownSubSessionType = 1 // the sever does not reognise the session type. + }; + +/** +@internalTechnology +@released +@see CShutdownTimer +@see CPolicyServer + +CPolicy based class to provde security functionalities to the server base + */ +class CSecureServerBase : public CPolicyServer + { +public: + /** Secure server base panic type */ + enum ESecureServerBasePanic + { + EBaseConstructNotCalled = 0, + EBaseCreateNotCalled = 1 + }; +public: + // creation - called from CPolicyServer + virtual CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const; + // secondary creation - called by the implementaion of NewSessionL above + virtual CSession2* DoNewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const = 0; + virtual TVersion GetServerVersion() const = 0; + // destruction + virtual ~CSecureServerBase(); +public: + void IncSession(); + void DecSession(); + + TInt GetSessionCount() const; + TTimeIntervalMicroSeconds32 GetShutdownDelay() const; + void SetShutdownDelay(const TTimeIntervalMicroSeconds32 aDelay); + // must be public to the sessions can so this is required. + void PanicServer(TInt aPanicCode) const; +protected: + CSecureServerBase(TInt aPriority, const TPolicy& aSecurityPolicy); + void BaseConstructL(TBool aShutdownTimerRequired = ETrue); +protected: + // property + // protected in case a derived class ever has to overload + /** number of sessions to the server */ + TInt iSessionCount; + /** shut down timer for the server */ + CShutdownTimer* iShutdownTimer; + /** shut down time delay */ + TTimeIntervalMicroSeconds32 iShutdownDelay; +private: + // property - really do mean private here + /** indicate whether the base construct has been called */ + TBool iBaseConstructCalled; + }; + + +#endif // __LBSSECURESERVERBASE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/csecuresessionbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/csecuresessionbase.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,54 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// csesuresessionbase.h +// CSession2 based secure session to the server +// +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef __LBSSECURESESSIONBASE_H__ +#define __LBSSECURESESSIONBASE_H__ + +#include + +/** +@internalTechnology +@released + +CSession2 based secure session to the server + */ +class CSecureSessionBase : public CSession2 + { +public: + CSecureSessionBase(); + virtual ~CSecureSessionBase(); + virtual void CreateL(); + virtual void Disconnect(const RMessage2& aMessage); + virtual void ServiceL(const RMessage2& aMessage); + virtual void ServiceError(const RMessage2& aMessage, TInt aError); +protected: + // Helpers + virtual void DispatchL(const RMessage2& aMessage) = 0; + virtual void DispatchError(const RMessage2& aMessage, const TInt aError) = 0; // force people to think about errors! + virtual void ConstructSubSessionL(); + virtual void DestroySubSession(); + }; + +#endif // __LBSSECURESESSIONBASE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/csecuresessionsubsessionbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/csecuresessionsubsessionbase.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,71 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of secure subsession base class +// +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef __LBSSECURESESSIONSUBSESSIONBASE_H__ +#define __LBSSECURESESSIONSUBSESSIONBASE_H__ + +#include // for CObject etc. +#include "csecuresessionbase.h" +#include "csecureserverbase.h" + + +/** +@internalTechnology +@released + +Subsession base class + */ +class CSecureSessionSubSessionBase : public CSecureSessionBase + { +public: + CSecureSessionSubSessionBase(); + virtual ~CSecureSessionSubSessionBase(); + virtual void CreateL(); + virtual void CreateSubSessionL(const RMessage2& aMessage); + virtual void DestroySubSession(const RMessage2& aMessage); +protected: + virtual void DispatchMessageL(const RMessage2& aMesssage); + const CSecureServerBase* Server() const; + // Helpers + virtual void DispatchL(const RMessage2& aMessage); + virtual void DispatchError(const RMessage2& aMessage, const TInt aError); // force people to think about errors! + virtual void ServiceMessageL(const RMessage2& aMessage) = 0; + virtual void ServiceMessageError(const RMessage2& aMessage, const TInt aError) = 0; +protected: + // property + /** the array to store subsession object handles */ + CObjectIx* iObjectIx; + /** the array container to store subsessions */ + CObjectConIx* iContainerIx; + /** array to store subsessions */ + CObjectCon* iObjectCon; +private: + // property - really do mean private here + /** indicate whether the base construct has been called */ + TBool iBaseCreateCalled; + }; + + + +#endif // __LBSSECURESESSIONSUBSESSIONBASE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/cserverlaunch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/cserverlaunch.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,42 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of class used to launch a LBS server +// +// + + + +/** + @file + @internalTechnology +*/ + + +#ifndef __LBSSERVERLAUNCH_H__ +#define __LBSSERVERLAUNCH_H__ + +#include + +// forward classes +class TServerStartParams; + +class CServerLaunch : public CBase + { +public: + static TInt ServerLaunch(TServerStartParams& aParams); +protected: + static TInt CreateServerProcess(TServerStartParams& aParams); + }; + +#endif // __LBSSERVERLAUNCH_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/cshutdowntimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/cshutdowntimer.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,49 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of class used to shut down a server after a specified time +// +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef __LBSSHUTDOWNTIMER_H__ +#define __LBSSHUTDOWNTIMER_H__ + +#include + +/** +@internalTechnology +@released + + CTimer base class, it is used to shut down the server in specified time span + */ +class CShutdownTimer : public CTimer + { +public: + CShutdownTimer(); + ~CShutdownTimer(); + void ConstructL(); + void Start(const TTimeIntervalMicroSeconds32 aDelay); + void Stop(); +protected: + // from CActive + void RunL(); + }; + +#endif // __LBSSHUTDOWNTIMER_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/csubsessionbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/csubsessionbase.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,124 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of Subsession base object +// +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef __LBSSUBSESSIONBASE_H__ +#define __LBSSUBSESSIONBASE_H__ + +#include + +// forward classes +class CSecureServerBase; + +/** +@internalTechnology +@released + +Interface for release resource + */ +class MRelease + { +public: + virtual void VirtualRelease() = 0; // THIS MUST delete any implementation! + }; + +/** +@internalTechnology + +MRelease interface function pointer + */ +typedef void (MRelease::* TReleaseFunc)(); + + +/** +@internalTechnology +@released + +static class for push the resource needed to be released to stack + */ +class CleanupVirtualRelease + { +public: + inline static void PushL(MRelease& aRef); +private: + static void Release(TAny *aPtr); + }; + +void CleanupVirtualReleasePushL(MRelease& aRef); + + +/** +@internalTechnology +@released +@see MRelease + +/** +@internalTechnology +@released +@see MRelease + +MRelease based Interface, interface for subsession + */ +class MSubSessionImpl : public MRelease + { +public: + virtual void DispatchL(const RMessage2& aMessage) = 0; + virtual void DispatchError(const RMessage2& aMessage, TInt aError) = 0; + virtual void CreateSubSessionL(const RMessage2& aMessage, const CSecureServerBase* aServer) = 0; + virtual void CloseSubSession() = 0; + }; + +/** +@internalTechnology +@released +@see MSubSessionImpl + + Subsession base object + */ +class CSubSessionBase : public CObject + { +public: + /** Panic type for subsession objects */ + enum TSubSessionBasePanic + { + EDispatchLNotOverriden = 1, + EDispatchErrorNotOverriden = 2, + ECreateSubSessionLNotOverriden = 3, + ECloseSubSessionNotOverriden = 4 + }; +public: + CSubSessionBase(); + virtual ~CSubSessionBase(); + MSubSessionImpl* GetImplL(const RMessage2& aMessage); + void SetImpl(MSubSessionImpl* aImpl); + MSubSessionImpl* Impl(); +protected: + void Panic(const TSubSessionBasePanic aPanic); +protected: + // property - later derived class may wish to acess so protected, not private + /** Generic interface pointer to subsession implemetations */ + MSubSessionImpl* iImpl; + }; + + +#endif // __LBSSUBSESSIONBASE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbsprocesssupervisor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbsprocesssupervisor.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,126 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// lbsrootapi.h +// +// + + + +/** + @file + @internalTechnology + @released +*/ + +#ifndef __LBS_PROCESSSUPERVISOR_H__ +#define __LBS_PROCESSSUPERVISOR_H__ + +#include +#include +#include +#include +#include +#include "lbsprocessuiddefs.h" + +/** + * Class which allows processes to register to be notified for closedown, + * and to confirm closedown when it is completed. + */ +class RLbsProcessSupervisor + { +public: + /** + * Values for closedown request property which indicate whether the + * process is to close itself down or reset itself. + */ + enum TProcessSignal + { + EProcessSignalUnknown = 0, + EProcessCloseDown, + EProcessReset + }; + +public: + IMPORT_C static void InitializeL(); + IMPORT_C static void ShutDownL(); + + IMPORT_C RLbsProcessSupervisor(); + IMPORT_C void OpenL(TUid aModuleId); + IMPORT_C void Close(); + + IMPORT_C void CloseDownProcess(); + IMPORT_C void ResetProcess(); + + void NotifyCloseDownRequest(TRequestStatus& aStatus); + IMPORT_C void CancelNotifyCloseDownRequest(); + + TInt ProcessSignal(); + +private: + RProperty iRequestCloseDown; + TUid iModuleId; + }; + +/** + * Mixin class defining a function implemented by LBS processes/servers started + * by LBS Root and which is called when the process/server is to close itself + * down + */ +class MLbsProcessCloseDown + { +public: + virtual void OnProcessCloseDown() = 0; + }; + +/** + * Mixin class defining a function implemented by LBS processes/servers started + * by LBS Root and which is called when the process/server is to 'reset' itself + * (e.g. clear internal cache, state variable). This is expected mainly to be + * used for test purposes. + */ +class MLbsProcessReset + { +public: + virtual void OnProcessReset() = 0; + }; + + +class CLbsCloseDownRequestDetector : public CActive + { +public: + // Not all process need to implement a reset function, so allow a default + // value of NULL for the reset observer. + IMPORT_C static CLbsCloseDownRequestDetector* NewL( + MLbsProcessCloseDown* aCloseDownObserver, + TUid aProcessUid, + MLbsProcessReset* aResetObserver = NULL); + ~CLbsCloseDownRequestDetector(); + +protected: + CLbsCloseDownRequestDetector(MLbsProcessCloseDown* aCloseDown, + MLbsProcessReset* aResetObserver); + void ConstructL(TUid aProcessUid); + +protected: + //From CActive + virtual void RunL(); + virtual void DoCancel(); + +private: + RLbsProcessSupervisor iLbsSupervisor; + MLbsProcessCloseDown* iCloseDownObserver; + MLbsProcessReset* iResetObserver; + }; + +#endif //__LBS_PROCESSSUPERVISOR_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbspropertykeydefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbspropertykeydefs.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,102 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +/** + @file + @internalTechnology + @released +*/ + +#ifndef LBSPROPERTYKEYDEFS_H +#define LBSPROPERTYKEYDEFS_H + +#include + + + + +//This header splits up the key space for the process that defines the LBS P&S properties. +//It then goes on to map ModuleId-Property type pairs to individual key vaules. + + +//We offset from 0 - this is to make debugging easier (0 means a lot of things, 1000 is a better clue). +//Also, several places in the implementation use the fact that 0 is NEVER a valid key value. + +const TUint KLbsPowerModeAdviceKeyBase = 0x00001000; //Base value for RLbsManagerPowerModeAdvice keys +const TUint KLbsModuleInfoKeyBase = 0x01001000; //Base value for LbsModuleInfo keys +const TUint KLbsModuleStatusKayBase = 0x02001000; //Base value for RLbsModuleStatus keys +const TUint KLbsPositionUpdatesKeyBase = 0x03001000; //Base value for RLbsPositionUpdates keys +const TUint KLbsGpsMeasurementUpdatesKeyBase = 0x03001100; //Base value for RLbsGpsMeasurementUpdates keys +const TUint KLbsPositionUpdateRequestsKeyBase = 0x04001000; //Base value for RLbsPositionUpdateRequests keys +const TUint KLbsSystemModuleEventKeyBase = 0x05001000; //Base value for RLbsSystemModuleEvent keys + +// The following section lists the keys used by lbsnetinternalapi + +/* Key value used to publish message data */ +const TUint KNetGatewayMessageKey = 0x06001000; + +/* Key value used to publish the 'message read' acknowledgement */ +const TUint KNetGatewayMessageReadAckKey = 0x06001010; + +/* Key value used to publish message data */ +const TUint KNetRequestMessageKey = 0x06001020; + +/* Key value used to publish the 'message read' acknowledgement */ +const TUint KNetRequestMessageReadAckKey = 0x06001030; + +/* Key value used to publish message data */ +const TUint KNetworkLocationRequestMessageKey = 0x06001040; + +/* Key value used to publish message data */ +const TUint KNetworkLocationResponseMessageKey = 0x06001060; + +/* Key value used to publish network reference position data */ +const TUint KNetworkReferencePositionUpdateKey = 0x06001080; + +/* Key value used to publish network final position data */ +const TUint KNetworkFinalPositionUpdateKey = 0x06001088; + +/* Key value used to publish messages from AGPS Manager to Network Gateway + and the corresponding acknowledgement */ +const TUint KNetAGPS2NGMessageKey = 0x06001090; +const TUint KNetAGPS2NGMessageReadAckKey = 0x060010a0; + +/* Key value used to publish messages from the Network Gateway to the AGPS Manager + and the corresponding acknowledgement */ +const TUint KNetNG2AGPSMessageKey = 0x060010b0; +const TUint KNetNG2AGPSMessageReadAckKey = 0x060010c0; + +/* Key value used to publish network registration status */ +const TUint KNetworkRegistrationStatusKey = 0x060010d0; + +/* Key value used to support LS to NRH communication for client/network + * symmetry requirement*/ +const TUint KLSToNRHKey = 0x060010e0; + +/* Key value used to support NRH to LScommunication for client/network + * symmetry requirement */ +const TUint KNRHToLSKey = 0x060010f0; + +// End of section keys used by lbsnetinternalapi + + +const TUint KLbsRootProcessKeyBase = 0x07001000; //Base value for LBS Root Api keys +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 + +#endif //LBSPROPERTYKEYDEFS_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbsrootapi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbsrootapi.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,54 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +/** + @file + @internalTechnology + @released +*/ + +#ifndef __LBSROOTAPI_H__ +#define __LBSROOTAPI_H__ + +#include "lbspropertykeydefs.h" +#include "lbsprocesssupervisor.h" +#include "lbssystemcontroller.h" +#include "lbsprocessuiddefs.h" + +enum + { + KLbsStartupRequestKey = KLbsRootProcessKeyBase, + KLbsStartupCompleteKey, + KLbsCloseDownRequestKey, + KLbsCloseDownCompleteKey, + /** + * Make sure this is the last one, as it's used as the base for + * the definition of n * 2 properties + */ + KLbsCloseDownBaseKey + }; + +_LIT(KLbsRootProcessName, "lbsroot.exe"); + +// Full path of lbsroot executable +_LIT(KLbsRootFileName, "\\sys\\bin\\lbsroot.exe"); + +// Need a wildcard when checking to see whether a process is open, to cope +// with system-derived accretions e.g. lbsroot.exe[0001] +_LIT(KLbsRootProcessSearchString, "lbsroot.exe*"); + +#endif //__LBSROOTAPI_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbssystemcontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbssystemcontroller.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,169 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +/** + @file + @internalTechnology + @released +*/ +#ifndef __LBS_SYSTEMSTARTER_H__ +#define __LBS_SYSTEMSTARTER_H__ + +#include +#include +#include +#include +#include +#include "lbstimer.h" + +class CLbsSystemStarter; + + +const TInt KDefaultStartupTimeout = 30; + +// Responses to a request to start the LBS system +enum + { + ELbsStartupSuccess, + ELbsStartupFail, + ELbsStartupRootNotFound + }; +// Responses to a request to close down the LBS system +enum + { + ELbsCloseDownRejected, + ELbsCloseDownInProgress, + ELbsCloseDownComplete, + ELbsCloseDownRootNotFound + }; + +class RLbsSystemController + { +public: +enum + { + ELbsCloseDown = 1, + ELbsCloseDownAndConfirm, + ELbsResetOnly, // Just tell the process to clear the cache etc. rather than close down completely + ELbsTotalCloseDown // Close the LBS Root process as well. + }; +public: + IMPORT_C static void InitializeL(); + IMPORT_C static void ShutDownL(); + + IMPORT_C RLbsSystemController(); + IMPORT_C void OpenL(TUid aModuleId); + IMPORT_C void Close(); + + IMPORT_C void NotifySystemStartRequest(TRequestStatus& aStatus); + IMPORT_C TInt RequestSystemStartup(); + IMPORT_C void SystemStartComplete(TInt aStartupResult); + IMPORT_C void NotifySystemCloseDownRequest(TRequestStatus& aStatus); + IMPORT_C TInt RequestSystemCloseDown(); + IMPORT_C TInt RequestSystemCloseDown(TBool aNoWaitForResponse); + IMPORT_C void SystemCloseDownResponse(TInt aResponse); + IMPORT_C TInt GetCloseDownType(); + IMPORT_C void RequestSystemReset(); + IMPORT_C TInt RequestCompleteCloseDown(); + + TInt GetStartupData(TDes8& aData); + +private: + TBool CheckLbsRootProcessIsUp(); + +private: + RProperty iLbsStartupRequest; + RProperty iLbsStartupComplete; + RProperty iLbsCloseDownRequest; + RProperty iLbsCloseDownComplete; + }; + +/* + * + * Observer used to pass system startup requests to the LBS Root process + */ +class MLbsSystemStartupObserver + { +public: + virtual void OnStartupRequest() = 0; + }; + +/* + * Active object which monitors the property which signals + * when startup is required. + */ +class CLbsSystemStartupRequestHandler : public CActive + { +public: + IMPORT_C static CLbsSystemStartupRequestHandler* NewL( + MLbsSystemStartupObserver* aObserver, + TUid aProcessUid); + IMPORT_C ~CLbsSystemStartupRequestHandler(); + IMPORT_C void ConfirmStartup(TInt aStartupStatus); + +protected: + CLbsSystemStartupRequestHandler(MLbsSystemStartupObserver* aObserver); + void ConstructL(TUid aProcessUid); + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: + MLbsSystemStartupObserver* iObserver; + RLbsSystemController iLbsSystemController; + }; + +/* + * + * Observer used to pass system startup requests to the LBS Root process + */ +class MLbsSystemCloseDownObserver + { +public: + virtual void OnCloseDownRequest(TBool aConfirmCloseDownComplete) = 0; + virtual void OnResetRequest() = 0; + virtual void OnCompleteCloseDownRequest() = 0; + }; + +/* + * Active object which monitors the property which signals + * when closedown is required. + */ +class CLbsSystemCloseDownRequestHandler : public CActive + { +public: + IMPORT_C static CLbsSystemCloseDownRequestHandler* NewL( + MLbsSystemCloseDownObserver* aObserver, + TUid aProcessUid); + IMPORT_C ~CLbsSystemCloseDownRequestHandler(); + IMPORT_C void ConfirmCloseDown(TInt aResponse); + +protected: + CLbsSystemCloseDownRequestHandler(MLbsSystemCloseDownObserver* aObserver); + void ConstructL(TUid aProcessUid); + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: + MLbsSystemCloseDownObserver* iObserver; + RLbsSystemController iLbsSystemController; + }; + +#endif //__LBS_SYSTEMSTARTER_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestclient.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,55 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Client-side code for the Lbs test server +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef LBSERVERCLIENT_H__ +#define LBSERVERCLIENT_H__ + + +class CLbsTestServerImpl; + +/** Class used to access the LBS test server. +*/ +NONSHARABLE_CLASS(CLbsTestServer) : public CBase + { +public: + IMPORT_C static CLbsTestServer* NewL(); + ~CLbsTestServer(); + +public: + IMPORT_C TInt StopLbsSystem(); + IMPORT_C TInt StartLbsSystem(); + IMPORT_C TInt ResetLbsSystem(); + +protected: + CLbsTestServer(); + void ConstructL(); + +private: + CLbsTestServerImpl* iImpl; + + TUint8 iReserved[12]; // reserved for future use (to preserve BC). + }; + +#endif // LBSERVERCLIENT_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestclientimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestclientimpl.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,56 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Header for the implementation of the client-side code +// for the Lbs test server. +// +// + +#include "rsecuresessionbase.h" +#include "tserverstartparams.h" + + +/* Session class that derives from the server framework session. +*/ +NONSHARABLE_CLASS(RLbsTestSession) : public RSecureSessionBase + { +public: + TVersion Version(); + + TInt StopLbsSystem(); + TInt StartLbsSystem(); + TInt ResetLbsSystem(); + }; + +/* Implementation of the client code. +*/ +NONSHARABLE_CLASS(CLbsTestServerImpl) : public CBase + { +public: + static CLbsTestServerImpl* NewL(); + ~CLbsTestServerImpl(); + + TInt StopLbsSystem(); + TInt StartLbsSystem(); + TInt ResetLbsSystem(); + +protected: + CLbsTestServerImpl(); + +private: + void ConstructL(); + +private: + RLbsTestSession iSession; + TServerStartParams iParams; // MUST live for as long as the client + }; diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestmessageenums.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestmessageenums.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,46 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// The message enums/opcodes shared between the client and the server sides +// +// + +#ifndef LBSTESTMESSAGEENUMS_H__ +#define LBSTESTMESSAGEENUMS_H__ + +#include "lbsmessageenums.h" + +enum ELbsTestClientServerMessageEnums + { + // + // If you need to add any more message Ids, add them between + // EFirstLbsTestServerMessage and ELastLbsTestServerMessage. + // (Otherwise the security policy in lbstestserver.cpp may not + // allow the new message.) + // + + // Start of lbstest specific messages after the last of the + // basic server framework messages, ELastSessionMessageId, + // which is defined as KMaxInt32/2 aka 16383 (0x3FFFFFFF) + // in lbsmessageenums.h + EFirstLbsTestServerMessage = 0x40000000, + + ELbsTestStopLbsSystem = EFirstLbsTestServerMessage, + ELbsTestStartLbsSystem = 0x40000001, + ELbsTestResetLbsSystem = 0x40000002, + + ELastLbsTestServerMessage, + + }; + +#endif //LBSTESTMESSAGEENUMS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestopensessionparams.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestopensessionparams.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,62 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// opensessionparams.h +// +// + +#ifndef __OPENSESSIONPARAMS_H__ +#define __OPENSESSIONPARAMS_H__ + +#include +#include + +// class used to pass data about the sub session type to/from the client/server +class TSubSessionType + { +public: + enum TSubSessionTypeEnum + { + EExInvalidSubsession = 0, + EExTimeSubSession = 1, + EExServerNameSubSession = 2 + }; +public: + TSubSessionType() + { + }; + TSubSessionType(const TSubSessionTypeEnum aSubSessionType) : iSubSessionType(aSubSessionType) + { + }; + const TSubSessionTypeEnum GetSubSessionType() const + { + return iSubSessionType; + }; +protected: + TSubSessionTypeEnum iSubSessionType; + }; + + +// this is a sample calss, to to show that you can pass +// blocks of data around +class TTimeOpenSessionParams + { +public: + TInt iDummyNumberParam; + TBuf<32> iDummyBufParam; + }; + +// this is another sample to prove that you don't need a class +typedef TInt TServerNameOpenSessionParams; + +#endif // __ OPENSESSIONPARAMS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestserver.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,50 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// serverside.h +// server side exmaple of how to use the abstract server framework +// +// + +#ifndef LBSTESTSERVER_H__ +#define LBSTESTSERVER_H__ + +#include "tserverstartparams.h" +#include "csecureasbase.h" +#include "csecureserverbase.h" + + +/* +*/ +class CLbsTestServerImpl : public CBase, public MCreateServerImpl + { +public: + virtual void CreateServerLC(TServerStartParams& aParams); + }; + +/* Main server class +*/ +class CLbsTestServer : public CSecureServerBase + { +public: + CLbsTestServer(TInt aPriority, const CPolicyServer::TPolicy& aSecurityPolicy); + ~CLbsTestServer(); + void ConstructL(const TDesC& aServerName); + CSession2* DoNewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const; + TVersion GetServerVersion() const; +protected: + // property + TVersion iVersion; + }; + +#endif //LBSTESTSERVER_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestserverdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestserverdata.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,36 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// data which identifies the server used to communicate with the LBS +// Network Request Handler +// +// + +#ifndef LBSTESTSERVERDATA_H__ +#define LBSTESTSERVERDATA_H__ + +// Define the file and process of the Lbs test server +_LIT(KTestServerFileName, "\\sys\\bin\\lbstestserver.exe"); +_LIT(KTestServerName, "lbstestserver.exe"); + +// Current version number of the Lbs test server. +const TInt8 KTestServerMajorVersionNumber = 1; +const TInt8 KTestServerMinorVersionNumber = 0; +const TInt16 KTestServerBuildVersionNumber = 0; + +// Uid3 of the Lbs test server +const TUint KLbsTestServerUidValue = 0x10282281; +const TUid KLbsTestServerUid = {KLbsTestServerUidValue}; + + +#endif // LBSTESTSERVERDATA_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/lbstestsession.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,47 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// serverside.h +// server side exmaple of how to use the abstract server framework +// +// + +#ifndef LBSTESTSESSION_H__ +#define LBSTESTSESSION_H__ + +#include "csecuresessionbase.h" +#include "csecuresessionsubsessionbase.h" +#include "csubsessionbase.h" +#include "messageutils.h" + + +/* Session class that implements the actual functions. +*/ +class CLbsTestSession : public CSecureSessionBase + { +public: + void CreateL(); + +protected: + void DispatchL(const RMessage2& aMessage); + void DispatchError(const RMessage2& aMessage, const TInt aError); + +private: + void StopLbsSystem(const RMessage2& aMessage); + void StartLbsSystem(const RMessage2& aMessage); + void ResetLbsSystem(const RMessage2& aMessage); + + TBool FindRootProcess(RProcess& aProcess); + }; + +#endif //LBSTESTSESSION_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/messageutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/messageutils.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,46 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of utilty class used to write ans read RMessage2 and send panic message +// +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef __LBSMESSAGEUTILS_H__ +#define __LBSMESSAGEUTILS_H__ + +#include + +/** +@internalTechnology +@released + +Message object handling class, include message writing, reading and send panic message to client. + */ +class MessageUtils + { +public: + static TInt Write(const RMessage2& aMessage, const TInt aIndex, const TDesC16& aBuf); + static TInt Write(const RMessage2& aMessage, const TInt aIndex, const TDesC8& aBuf); + static TInt Read(const RMessage2& aMessage, const TInt aIndex, TDes16& aBuf); + static TInt Read(const RMessage2& aMessage, const TInt aIdnex, TDes8& aBuf); + static void PanicClient(const RMessage2&, const TDesC& aCat, const TInt aReason); + }; + +#endif // __LBSMESSAGEUTILS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/rsecuresessionbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/rsecuresessionbase.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,64 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// rsecureasbase.h +// Definition of base class for secure sessions +// +// + + + +/** + @file + @internalTechnology +*/ + + +#ifndef __LBSSECURESESSIONBASE_H__ +#define __LBSSECURESESSIONBASE_H__ + +#include +#include "tserverstartparams.h" +#include "lbsmessageenums.h" + +NONSHARABLE_CLASS(RSecureSessionBase) : public RSessionBase + { +public: + TInt Connect(TServerStartParams& aParams); + virtual void Close(); + virtual TVersion Version() = 0; + virtual TInt StartServer(TServerStartParams& aParams); + }; + +NONSHARABLE_CLASS(RSecureSubSessionBase) : public RSubSessionBase + { +public: + // template code MUST be inlined + template + inline TInt Open(RSecureSessionBase& aServer, S& aSubSessionType, T& aOpenData); + //TInt Open(RSecureSessionBase& aServer, const TInt& aOpenData); + virtual void Close(); + }; + +template +TInt RSecureSubSessionBase::Open(RSecureSessionBase& aServer, S& aSubSessionType, T& aOpenData) + { + TPckg subSessPckg(aSubSessionType); + TPckg openPckg(aOpenData); + //TPckg openPckg(aOpenData); + TIpcArgs args(&subSessPckg, &openPckg); + return CreateSubSession(aServer, ESecureSubSessionBaseOpen, args); + } + + +#endif // __LBSSECURESESSSIONBASE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/tprocessstartparams.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/tprocessstartparams.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,63 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of class used to define process start parameters +// +// + + + +/** + @file + @internalTechnology +*/ + + +#ifndef __LBSPROCESSSTARTPARAMS_H__ +#define __LBSPROCESSSTARTPARAMS_H__ + +#include +#include +#include "tstartparamsbase.h" + +/** +@internalTechnology +@released + +Parameters for starting the server process + */ +NONSHARABLE_CLASS(TProcessStartParams) : public TStartParamsBase + { +public: + TProcessStartParams(); + void SetProcessFileName(const TDesC& aExeName); + void SetProcessName(const TDesC& aProcessName); + void SetRendezvousRequired(TBool aRendezvousRequired); + TBool GetRendezvousRequired() const; + const TDesC& GetProcessFileName() const; + const TDesC& GetProcessName() const; + TPtrC GetAsCommandLine() const; +private: + // from TStartParamsBase + void SetType(); +private: + // property and really do mean private here + /** whether or not the process Rendezvous is required */ + TBool iRendezvousRequired; + /** server process file name */ + TFileName iProcessFileName; + /** server process name */ + TFileName iProcessName; + }; + +#endif // __LBSPROCESSSTARTPARAMS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/tserverstartparams.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/tserverstartparams.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,69 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of class used to define server start parameters +// +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef __SERVERSTARTPARAMS_H__ +#define __SERVERSTARTPARAMS_H__ + +#include +#include +#include "tstartparamsbase.h" + +const TInt KServerFrameworkDefaultMessageSlots = 4; + + +/** +@internalTechnology +@released + +Parameters for starting server + */ +NONSHARABLE_CLASS(TServerStartParams) : public TStartParamsBase + { +public: + TServerStartParams(); + void SetServerFileName(const TDesC& aExeName); + void SetServerName(const TDesC& aServerName); + void SetNumberOfServerSlots(TInt aSlots); + void SetServerUids(TUid aUid1, TUid aUid2, TUid aUid3); + const TDesC& GetServerFileName(); + const TDesC& GetServerName(); + TInt GetNumberOfServerSlots(); + TPtrC GetAsCommandLine() const; + TUidType& GetServerUids(); +private: + // from TStartParamsBase + void SetType(); +private: + // property and really do mean private here + /** Server file name */ + TFileName iServerFileName; + /** Server name */ + TFileName iServerName; + /** Number of slots in server */ + TInt iNumberOfSlots; + /** a set of three unique identifiers (UIDs) identify the server */ + TUidType iUids; + }; + +#endif // __SERVERSTARTPARAMS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/tstartparamsbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/inc/tstartparamsbase.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,51 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of class used to define server start parameters +// +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef __STARTPARAMSBASE_H__ +#define __STARTPARAMSBASE_H__ + +#include +#include + + +const TUint KServerStartParamsTypeValue = 0x10282243; +const TUid KServerStartParamsTypeUid = {KServerStartParamsTypeValue}; + +const TUint KProcessStartParamsTypeValue = 10282242; +const TUid KProcessStartParamsTypeUid = {KProcessStartParamsTypeValue}; + + +NONSHARABLE_CLASS(TStartParamsBase) + { +public: + virtual ~TStartParamsBase(); + const TUid GetType() const; +protected: + void SetType(const TUid& aType); + virtual void SetType() = 0; +private: + TUid iType; + }; + +#endif // __STARTPARAMSBASE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/claunchedprocess.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/claunchedprocess.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,172 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "lbsmemlogger.h" +#include "claunchedprocess.h" +#include "csecureprocessasbase.h" + + +/** Create instance of trap handler and cleanup stack +called by the launched process! + +@return Symbian error code +@internalTechnology +@released + */ + TInt CLaunchedProcess::CompleteProcessLaunch() + { + __UHEAP_MARK; + CTrapCleanup* cleanup=CTrapCleanup::New(); + TInt r=KErrNoMemory; + if (cleanup) + { + TRAP(r,DoCompleteProcessLaunchL()); + delete cleanup; + } + __UHEAP_MARKEND; + return r; + + } + + +/** Create the server process, create, install and run the active scheduler +wait for scheduler to be stopped to return process + +@return Symbian error code +@internalTechnology +@released + */ + TInt CLaunchedProcess::DoCompleteProcessLaunchL() + { + TInt r = KErrNone; + // create and install the active scheduler we need + CSecureProcessASBase* s=new(ELeave) CSecureProcessASBase(); + CleanupStack::PushL(s); + CActiveScheduler::Install(s); + + // Create the memory logger object for monitoring memory + LBSMEMLOG_BEGIN(); + + CBase* baseObj = s->CreateRootObjectL(); + + CleanupStack::PushL(baseObj); + + r = s->EntryPointL(baseObj); + + RProcess().Rendezvous(KErrNone); + + // Ready to run + CActiveScheduler::Start(); + + // + // Cleanup the client + CleanupStack::PopAndDestroy(1); + + // Cleanup the mem logger + LBSMEMLOG_END(); + + // + // do any _FINAL _ operations. If anything.. default does nothing + s->Final(); + // Cleanup the scheduler + CleanupStack::PopAndDestroy(s); + return r; + } + + +/** Create instance of trap cleanup stack and the process by specified parameters + +@param aParams A reference to TProcessStartParams object +@return Symbian error code +@see TProcessStartParams +@internalTechnology +@released + */ + TInt CLaunchedProcess::CompleteProcessLaunch(TProcessStartParams& aParams) + { + __UHEAP_MARK; + CTrapCleanup* cleanup=CTrapCleanup::New(); + TInt r=KErrNoMemory; + if (cleanup) + { + TRAP(r,DoCompleteProcessLaunchL(aParams)); + delete cleanup; + } + __UHEAP_MARKEND; + return r; + + } + +/** Create the server process by specified parameters, create, install and run the active scheduler +wait for scheduler to be stopped to return process + +@param aParams A reference to TProcessStartParams object +@return Symbian error code +@see TProcessStartParams +@internalTechnology +@released + */ + TInt CLaunchedProcess::DoCompleteProcessLaunchL(TProcessStartParams& aParams) + { + // first check that we are about to create the right type of server + if(aParams.GetType() != KProcessStartParamsTypeUid) + { + // this is not a process type that we understand. Has the caller + // pass TServerStartParams by mistake? + User::Leave(KErrArgument); // this aborts the server startup + } + + // rename our main thread + User::LeaveIfError(User::RenameThread(aParams.GetProcessName())); + + TInt r = KErrNone; + // create and install the active scheduler we need + CSecureProcessASBase* s=new(ELeave) CSecureProcessASBase(); + CleanupStack::PushL(s); + CActiveScheduler::Install(s); + + // Create the memory logger object for monitoring memory + LBSMEMLOG_BEGIN(); + + CBase* baseObj = s->CreateRootObjectL(); + + CleanupStack::PushL(baseObj); + + r = s->EntryPointL(baseObj); + + // is the process that started us interested in known that we are alive and well + if(aParams.GetRendezvousRequired()) + { + // tell any starting process that we have started successfully and are + // now ready to receieve mesages or process events + RProcess::Rendezvous(KErrNone); + } + // Ready to run + CActiveScheduler::Start(); + // + // Cleanup the client + CleanupStack::PopAndDestroy(1); + + // Cleanup the mem logger + LBSMEMLOG_END(); + + // + // do any _FINAL _ operations. If anything.. default does nothing + s->Final(); + // Cleanup the scheduler + CleanupStack::PopAndDestroy(s); + return r; + } + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/cprocesslaunch.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/cprocesslaunch.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,102 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// processlaunch.cpp +// +// + +#include +#include "cprocesslaunch.h" + +//---------------------------------------------------------------------------- + +/** called by the launcher! Launch the process by specified parameters +find the process and launch it + +@param aParams A reference to TProcessStartParams object +@return Symbian error code +@see TProcessStartParams +@internalTechnology +@released + */ +TInt CProcessLaunch::ProcessLaunch(TProcessStartParams& aParams) +// now prevents multiple instances of the same image being launched! +// So P&S servers now look like realCServer2 servers. + { + TFullName fullName; + _LIT(KStar, "*"); + TParse parser; + parser.SetNoWild(aParams.GetProcessFileName(), NULL, NULL); + fullName.Append(parser.NameAndExt()); + fullName.Append(KStar); + + TFindProcess processFinder(fullName); + TInt err = KErrNotFound; + while (err = processFinder.Next(fullName), err == KErrNone) + { + RProcess process; + TInt processOpenErr = process.Open(processFinder); + if (processOpenErr == KErrNone) + { + TExitType exitType = process.ExitType(); + if (exitType == EExitPending) + { + // Found a running instance of the process, + // so return without starting another instance. + process.Close(); + return KErrNone; + } + } + process.Close(); + } + + // No running instance found, so start one. + return (DoProcessLaunch(aParams)); + } + +/** Create the process by specified parameters and wait for the request + +@param aParams A reference to TProcessStartParams object +@return Symbian error code +@see TProcessStartParams +@internalTechnology +@released + */ +TInt CProcessLaunch::DoProcessLaunch(TProcessStartParams& aParams) + { + RProcess process; + + TInt r=process.Create(aParams.GetProcessFileName(),aParams.GetAsCommandLine()); + if (r!=KErrNone) + { + return r; + } + // are we expecing to rendezvous with the process we have created above + if(aParams.GetRendezvousRequired()) + { + TRequestStatus stat; + process.Rendezvous(stat); + if (stat!=KRequestPending) + { + process.Kill(0); + } + else + { + process.Resume(); + } + User::WaitForRequest(stat); + r=(process.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); + } + process.Close(); + return r; + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/cquietus.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/cquietus.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,86 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "cquietus.h" + +/** static method to create CQuietus object + +@return The singleton CQuietus object +@internalTechnology +@released + */ +CQuietus* CQuietus::NewL() + { + CQuietus* self = new(ELeave) CQuietus(); + return self; + } + +/** destructor, cancel any outstanding request + +@internalTechnology +@released + */ +CQuietus::~CQuietus() + { + Cancel(); + } + +/** constructor, create CActive object with standard priority and add itself to AS + +@return The singleton CQuietus object +@internalTechnology +@released + */ +CQuietus::CQuietus() : CActive(CActive::EPriorityStandard) + { + CActiveScheduler::Add(this); + } + +/** setactive itself and issue a message to force complete the request to enter into RunL + +@internalTechnology +@released + */ +void CQuietus::CoupDeGrace() + { + // kill out active scheduler. thsi can only be done under a RunL, so we'll + // force ourselves into the active scheduler Q and kill ourseleves when we run + SetActive(); + TRequestStatus* trs = &iStatus; + User::RequestComplete(trs, KErrNone); + } + +/** All it does is to kill the process! + +@internalTechnology +@released + */ +void CQuietus::RunL() + { + // kill the controlling AS + CActiveScheduler::Stop(); + } + +/** Do the cancel job if cancel is issued to cancel an outstanding request + +@internalTechnology +@released + */ +void CQuietus::DoCancel() + { + // no operation!! + // This operationin NOT CANCELABLE by defination and design + // No this is NOT a bug :) + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/csecureasbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/csecureasbase.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,131 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include +#include "lbsdevloggermacros.h" +#include "csecureasbase.h" +#include "tserverstartparams.h" + +/** +Default constructor + +@internalTechnology +@released + */ +CSecureASBase::CSecureASBase() + { + } + +/** +The main sever entry point with sever start parameters, create the cleanup stack + +@param aParams A reference to TServerStartParams object +@see TServerStartParams +@return Symbian Standard Error code +@internalTechnology +@released + */ +TInt CSecureASBase::ServerMain(TServerStartParams& aParams) + { + // called from the server process from E32Main + __UHEAP_MARK; + // + CTrapCleanup* cleanup=CTrapCleanup::New(); + TInt r=KErrNoMemory; + if (cleanup) + { + TRAP(r,RunServerL(aParams)); + delete cleanup; + } + // + __UHEAP_MARKEND; + return r; + + } + +/** +start sever with parameters, create ActiveScheduler and install it +create a server implementation and signal the client when initialisation completes +start the AS object and wait to destroy. + +@param aParams A reference to TServerStartParams object +@see TServerStartParams +@return Symbian Standard Error code +@internalTechnology +@released + */ +TInt CSecureASBase::RunServerL(TServerStartParams& aParams) + { + LBSLOG(ELogP3, "->CSecureASBase::RunServerL"); + + // first check that we are about to create the right type of server + if(aParams.GetType() != KServerStartParamsTypeUid) + { + // this is not a process type that we understand. Has the caller + // pass TProcessStartParams by mistake? + User::Leave(KErrArgument); // this aborts the server startup + } + User::LeaveIfError(User::RenameThread(aParams.GetServerName())); + // + // create and install the active scheduler we need + CSecureASBase* s = new (ELeave) CSecureASBase(); + CleanupStack::PushL(s); + CActiveScheduler::Install(s); + + LBSMEMLOG_BEGIN(); + + // test with the impl + MCreateServerImpl* impl = s->GetImplLC(); + // + // create the server (leave it on the cleanup stack) + impl->CreateServerLC(aParams); + // + // Initialisation complete, now signal the client + RProcess().Rendezvous(KErrNone); + // + // Ready to run + LBSLOG(ELogP3, "Calling CActiveScheduler::Start"); + CActiveScheduler::Start(); + // + // Cleanup the impl, server and scheduler. Impl is destroyed via ~CBase not the M class + LBSLOG(ELogP3, "Calling CleanupStack::PopAndDestroy(3)"); + + CleanupStack::PopAndDestroy(3); + + LBSLOG(ELogP3, "<-CSecureASBase::RunServerL"); + + LBSMEMLOG_END(); + + return KErrNone; + } + + +/** +Panic the server with CSecureASBase category + +@param aPanic Reason to painc +@see TSecureASBasePanic +@internalTechnology +@released + */ +void CSecureASBase::Panic(const TSecureASBasePanic aPanic) + { + _LIT(KSecureAsBase, "CSecureASBase"); + User::Panic(KSecureAsBase, aPanic); + } + + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/csecureprocessasbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/csecureprocessasbase.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,30 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "csecureprocessasbase.h" + +/** Panic the secure process + +@param aPanic A reference to TSecureProcessASBasePanic object +@see TSecureProcessASBasePanic +@internalTechnology +@released + */ +void CSecureProcessASBase::Panic(const TSecureProcessASBasePanic aPanic) + { + _LIT(KSecureProcessAsBase, "CSecureProcessASBase"); + User::Panic(KSecureProcessAsBase, aPanic); + } + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/csecureserverbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/csecureserverbase.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,189 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// csesuresessionbase.cpp +// +// + +#include "csecureserverbase.h" +#include "cshutdowntimer.h" +#include +/// Lbs +#include "lbsdevloggermacros.h" + +/** +Create a new session, called from CPolicyServer + +@param aVersion TVersion reference +@param aMessage RMessage2 object reference +@return CSession2 based object pointer +@internalTechnology +@released + */ +CSession2* CSecureServerBase::NewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const + { + TVersion v = GetServerVersion(); + if(!User::QueryVersionSupported(v, aVersion)) + { + User::Leave(KErrNotSupported); + } + CSession2* session = DoNewSessionL(aVersion, aMessage); + return session; + } + +/** +destrcutor, cancel if any outstanding request of shutdown timer and release it. + +@internalTechnology +@released + */ +CSecureServerBase::~CSecureServerBase() + { + LBSLOG(ELogP1,"->CSecureServerBase::~CSecureServerBase"); + if(iShutdownTimer) + { + if(iShutdownTimer->IsActive()) + iShutdownTimer->Cancel(); + } + delete iShutdownTimer; + iShutdownTimer = NULL; + LBSLOG(ELogP1,"->CSecureServerBase::~CSecureServerBase"); + } + +/** +Create shut down timer + +@internalTechnology +@released + */ +void CSecureServerBase::BaseConstructL(TBool aShutdownTimerRequired) + { + LBSLOG(ELogP1,"->CSecureServerBase::BaseConstructL"); + iBaseConstructCalled = ETrue; + if(aShutdownTimerRequired) + { + iShutdownTimer = new (ELeave) CShutdownTimer(); + iShutdownTimer->ConstructL(); + } + LBSLOG(ELogP1,"<-CSecureServerBase::BaseConstructL"); + } + +/** +constructor, create server base with specified priority and policy, default shut down time delay + +@param aPriority Defined server priority +@param aSecurityPolicy A TPolicy object reference, to define server security policy +@internalTechnology +@released + */ +CSecureServerBase::CSecureServerBase(TInt aPriority, const TPolicy& aSecurityPolicy) : CPolicyServer(aPriority, aSecurityPolicy), + iShutdownDelay(KDefaultShutdownDelay) + { + // nothing to do? + } + +/** +Increase the session count by 1 +The function is called whenever a new session is created, cancel the current outstanding request of shutdown timer + +@internalTechnology +@released + */ +void CSecureServerBase::IncSession() + { + LBSLOG(ELogP1,"->CSecureServerBase::IncSession"); + __ASSERT_ALWAYS(iBaseConstructCalled, PanicServer(EBaseConstructNotCalled)); + ++iSessionCount; + if(iShutdownTimer) + { + iShutdownTimer->Cancel(); + } + LBSLOG(ELogP1,"<-CSecureServerBase::IncSession"); + } + +/** +Decrease the session count by 1 +The function is called whenever a new session is released, start shutdown timer with current shut down timer delay + +@internalTechnology +@released + */ +void CSecureServerBase::DecSession() + { + LBSLOG(ELogP1,"->CSecureServerBase::DecSession"); + + __ASSERT_ALWAYS(iBaseConstructCalled, PanicServer(EBaseConstructNotCalled)); + --iSessionCount; + if(iSessionCount > 0) + return; // bail out early + // ~CSecureSessionBase calls this, but it can be called after + // ~CSecureServerBase(!) e.g. a forced shutdown of the server with clients still connected + // so we need to guard this. + if(iShutdownTimer) + { + iShutdownTimer->Start(iShutdownDelay); // otherwise start the shutdown timer. + } + LBSLOG(ELogP1,"<-CSecureServerBase::DecSession"); + } + +/** +Return the session count + +@return Session count +@internalTechnology +@released + */ +TInt CSecureServerBase::GetSessionCount() const + { + __ASSERT_ALWAYS(iBaseConstructCalled, PanicServer(EBaseConstructNotCalled)); + return iSessionCount; + } + +/** +Get the current shut down delay + +@return Shut down time delay +@internalTechnology +@released + */ +TTimeIntervalMicroSeconds32 CSecureServerBase::GetShutdownDelay() const + { + __ASSERT_ALWAYS(iBaseConstructCalled, PanicServer(EBaseConstructNotCalled)); + return iShutdownDelay; + } + +/** +Set shut down delay + +@param aDelay Shut down time delay +@internalTechnology +@released + */ +void CSecureServerBase::SetShutdownDelay(const TTimeIntervalMicroSeconds32 aDelay) + { + __ASSERT_ALWAYS(iBaseConstructCalled, PanicServer(EBaseConstructNotCalled)); + iShutdownDelay = aDelay; + } + +/** +Panic the server with specified panic reason code + +@param aPanicCode Panic reason code +@internalTechnology +@released + */ +void CSecureServerBase::PanicServer(TInt aPanicCode) const + { + _LIT(KSecureServerBase, "SecureServerBase"); + User::Panic(KSecureServerBase, aPanicCode); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/csecuresessionbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/csecuresessionbase.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,123 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// csesuresessionbase.cpp +// +// + +#include "csecuresessionbase.h" +#include "csecureserverbase.h" +#include "lbsmessageenums.h" +#include +/// Lbs +#include "lbsdevloggermacros.h" +/** +constructor, call the CSession2 base class constructor + +@internalTechnology +@released + */ +CSecureSessionBase::CSecureSessionBase() : CSession2() + { + LBSLOG(ELogP1,"CSecureSessionBase::CSecureSessionBase"); + } + +/** +destructor, decrease the server session count, which will inturn start shutdown timer. + +@internalTechnology +@released + */ +CSecureSessionBase::~CSecureSessionBase() + { + LBSLOG(ELogP1,"CSecureSessionBase::~CSecureSessionBase"); + const CServer2* baseServer = Server(); + reinterpret_cast(const_cast(baseServer))->DecSession(); // reduce the server session count - start shutdown timer etc. + } + + +/** +function is called by CSession2 to increase the server session count, which will inturn reset shutdown timer. + +@internalTechnology +@released + */ +void CSecureSessionBase::CreateL() + { + const CServer2* baseServer = Server(); + reinterpret_cast(const_cast(baseServer))->IncSession(); // increase the server session count - stop shutdown timer etc. + } + +/** +Disconnect the session. + +@param aMessage A reference to RMessage2 object +@internalTechnology +@released + */ +void CSecureSessionBase::Disconnect(const RMessage2& aMessage) + { + LBSLOG(ELogP1,"CSecureSessionBase::Disconnect"); + CSession2::Disconnect(aMessage); + // used for a breakpoint + } + +/** +Session message dispatch function + +@param aMessage A reference to RMessage2 object +@internalTechnology +@released + */ +void CSecureSessionBase::ServiceL(const RMessage2& aMessage) + { + DispatchL(aMessage); // if this leaves it hits CSession2::ServiceError (or the derived version of it) + } + +/** +Session error message dispatch function, this is called when error happens, it dispatches the error locally and +then pass the error message to CSession2 + +@param aMessage A reference to RMessage2 object +@param aError Error code +@internalTechnology +@released + */ +void CSecureSessionBase::ServiceError(const RMessage2& aMessage, TInt aError) + { + DispatchError(aMessage, aError); // provide the opportunity to do something locally + // now take the base class actions + CSession2::ServiceError(aMessage, aError); // will complete aMessage with aError if not already completed. + } + +/** +Nothing here. a place for extra subsession construction functionalities + +@internalTechnology +@released + */ +void CSecureSessionBase::ConstructSubSessionL() + { + // does nothing in the default base class + } + +/** +Nothing here. a place for extra subsession destruction functionalities + +@internalTechnology +@released + */ +void CSecureSessionBase::DestroySubSession() + { + // does nothing in the default base class + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/csecuresessionsubsessionbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/csecuresessionsubsessionbase.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,319 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include "csecuresessionsubsessionbase.h" +#include "csubsessionbase.h" +#include "lbsmessageenums.h" +#include "messageutils.h" +#include "lbsdevloggermacros.h" + +/** +constructor, call the CSecureSessionBase base class constructor + +@internalTechnology +@released + */ +CSecureSessionSubSessionBase::CSecureSessionSubSessionBase() : CSecureSessionBase() + { + LBSLOG(ELogP3, "CSecureSessionSubSessionBase::CSecureSessionSubSessionBase()"); + } + +/** +destructor, release the subsession handler container + +@internalTechnology +@released + */ +CSecureSessionSubSessionBase::~CSecureSessionSubSessionBase() + { + LBSLOG(ELogP3, "->CSecureSessionSubSessionBase::~CSecureSessionSubSessionBase()"); + + if (iObjectIx) + { + TInt count = iObjectIx->Count(); + for(TInt i=0; iAt(theObj); + // if we reach here somethingbad has happened. The server class + // (i.e. the session object) is being closed by the client, BEFORE + // the client has closes all of the open subsessions. + // So the only reasonable thingto do here is: + // delete the subsession - without closing it first. 'Cos this is + // _exactly_ what the client side has asked for (for some reason). + // The may or may not be legal, or even a good idea depending on the type of server + // that is being developeds. But the server framework should NOT + // prevent this from happening. Generating a panic is a + // server developers choice, not a framework developers choice. + // We delete by calling CObjectIdx::Remove(). This will call CObject::Close. + // This in turn calls MSubSessionImpl::MRelease::VirtualRelease + // which will destroy the sub session for us. + // CloseSubSession should not be called directly. + iObjectIx->Remove(handle); + + // + // If the array length has changed, then update count and move back one space, + // so that the same cell will be re-inspected during the next iteration of the + // loop This is because we have removed the current cell and therefore the + // next cell is actually in iObjectIx[i] (i.e. the current one). + TInt newCount = iObjectIx->Count(); + + if (newCount != count) + { + count = newCount; + i--; + } + + } + } + delete iObjectIx; + } + if (iContainerIx) + { + iContainerIx->Remove(iObjectCon); + delete iContainerIx; + } + // session decrementing handled in the parent class + LBSLOG(ELogP3, "<-CSecureSessionSubSessionBase::~CSecureSessionSubSessionBase()"); + } + +/** +called as part of the CSession2 construction. +Create subsession handler container and call the session CreateL function to increase the session count + +@internalTechnology +@released + */ +void CSecureSessionSubSessionBase::CreateL() + { + LBSLOG(ELogP3, "->CSecureSessionSubSessionBase::CreateL"); + iObjectIx = CObjectIx::NewL(); + iContainerIx = CObjectConIx::NewL(); + iObjectCon = iContainerIx->CreateL(); + CSecureSessionBase::CreateL(); // call the parent class to inc the session count + iBaseCreateCalled = ETrue; + LBSLOG(ELogP3, "<-CSecureSessionSubSessionBase::CreateL"); + } + +/** +Do the real thing for subsession construction. +Check whether the session constructL function is called or not first. If not, panic the server, +Create a subsession and push it to stack, get the implementation of subsession and invoke the +real subsession creation implementation. + +Add the subsession handler to container and write the handler to client address space through message object +Complete the creating message. + +@param aMessage A RMessage2 reference. +@internalTechnology +@released + */ +void CSecureSessionSubSessionBase::CreateSubSessionL(const RMessage2& aMessage) + { + __ASSERT_ALWAYS(iBaseCreateCalled, Server()->PanicServer(CSecureServerBase::EBaseCreateNotCalled)); + CSubSessionBase* subSession = new (ELeave) CSubSessionBase(); + // Note: Use the CObject::Close() function instead of usual destructor + // because it is needed to correctly decrement the reference count. + // Close() will destruct subSession anyway if the ref count == 0. + CleanupClosePushL(*subSession); + + MSubSessionImpl* impl = subSession->GetImplL(aMessage); + CleanupVirtualReleasePushL(*impl); // call Release() on destruction + //CleanupVirtualRelease::PushL(*impl); + subSession->SetImpl(impl); // will take ownership(!) + CleanupStack::Pop(impl); + + // We need to pass a handle to the controllign server down to the subsession object. + // Since the subsession impl object is a CBase object (NOT a CSession2 object) + // we haev to do this outherwise the subsession will not be able to referene the + // server - which seems like a useful thing to do. + const CSecureServerBase* server = reinterpret_cast(Server()); + impl->CreateSubSessionL(aMessage, server); + + iObjectCon->AddL(subSession); + TInt handle = iObjectIx->AddL(subSession); + TPckgC pH(handle); + MessageUtils::Write(aMessage, 3, pH); + aMessage.Complete(KErrNone); + CleanupStack::Pop(subSession); + } + +/** +Do the real thing for subsession destruction. +Check whether the session constructL function is called or not first. If not, panic the server, +get a subsession handler from container and complete the message if subsession is already close, +if not, close subsession and remove it from container then complete the message. + +@param aMessage A RMessage2 reference. +@internalTechnology +@released + */ +void CSecureSessionSubSessionBase::DestroySubSession(const RMessage2& aMessage) + { + __ASSERT_ALWAYS(iBaseCreateCalled, Server()->PanicServer(CSecureServerBase::EBaseCreateNotCalled)); + CSubSessionBase* subSession = reinterpret_cast(iObjectIx->At(aMessage.Int3())); + + if (subSession == NULL) + { + aMessage.Complete(KErrBadHandle); + } + else + { + // we have been asked to close a subsession by the client side so + // do just that :). c.f. CSecureSessionSubSessionBase::~CSecureSessionSubSessionBase() above. + // In this case we do need to call CloseSubSession before deleting + // the subsession object. + // We delete by calling CObjectIdx::Remove().This will call CObject::Close. + // This in turn calls MSubSessionImpl::MRelease::VirtualRelease + // which willdestroy the sub session for us. + CSubSessionBase* subSession = static_cast(iObjectIx->At(aMessage.Int3())); + iObjectIx->Remove(aMessage.Int3()); + aMessage.Complete(KErrNone); + } + } + +/** +Check whether the session constructL function is called or not first. If not, panic the server, + +Dispatch the message at session level, only two types of message are handled here: +SubSession Open and Close. +The other messages are fwd to subsession via DispatchMessage. + +@param aMessage A RMessage2 reference. +@internalTechnology +@released + */ +void CSecureSessionSubSessionBase::DispatchL(const RMessage2& aMessage) + { + __ASSERT_ALWAYS(iBaseCreateCalled, Server()->PanicServer(CSecureServerBase::EBaseCreateNotCalled)); + switch(aMessage.Function()) + { + case ESecureSubSessionBaseOpen: + CreateSubSessionL(aMessage); + break; + case ESecureSubSessionBaseClose: + DestroySubSession(aMessage); + break; + default: + // the message could be EITHER a session operation - which we have to handle here, or an operation + // handled by the subsession which we have to forward + DispatchMessageL(aMessage); + break; + } + + } + +/** +Check whether the session constructL function is called or not first. If not, panic the server, + +Check whether the message are for session or subsession +Dispatch the message at subsession level +get the subsession handler from container and dispatch the message to subsession implementation! + +@param aMessage A RMessage2 reference. +@internalTechnology +@released + */ +void CSecureSessionSubSessionBase::DispatchMessageL(const RMessage2& aMessage) + { + __ASSERT_ALWAYS(iBaseCreateCalled, Server()->PanicServer(CSecureServerBase::EBaseCreateNotCalled)); + // NB the test is intened to ignore a function enum of ELastSessionMessageId - this is not a valid command + if(aMessage.Function()ELastSessionMessageId) + { + // MUST be a message for the subsystem object - delegate + CSubSessionBase* subSession = static_cast(iObjectIx->At(aMessage.Int3())); + subSession->Impl()->DispatchL(aMessage); + } + } + +/** +Return the server + +@return Pointer to server base +@internalTechnology +@released + */ +const CSecureServerBase* CSecureSessionSubSessionBase::Server() const + { + return reinterpret_cast(CSession2::Server()); + } + +/** +Check whether the session constructL function is called or not first. If not, panic the server, + +Dispatch the message at session level, only two types of message are handled here: +SubSession Open and Close. +If error happened when open subsession, destroy the subsession. + +otherwise, pop the error messages to session or fwd to subsession via DispatchError. + +@param aMessage A RMessage2 reference. +@param aError Error code. +@internalTechnology +@released + */ +void CSecureSessionSubSessionBase::DispatchError(const RMessage2& aMessage, TInt aError) + { + __ASSERT_ALWAYS(iBaseCreateCalled, Server()->PanicServer(CSecureServerBase::EBaseCreateNotCalled)); + CSubSessionBase* subSession = NULL; + switch(aMessage.Function()) + { + case ESecureSubSessionBaseOpen: + if(aError == KErrArgument) + { + // panic the client we have NO idea what sort + // of sub session class the user was tryign to create. + // This is a client side failure!, so shoot the client + MessageUtils::PanicClient(aMessage, KServerFrameworkPanic, ESecureSubSessionBaseUnknownSubSessionType); + // NB there is NOTHING to clean up here, everything is deleted via + // the cleanup stack, and the subsession object was never added to the + // obejct containers.... See CreateSubSessionL above + } + else + { + // CreateSubSessionL() has caused a Leave, so there is + // no sub session object to clear up - just complete the + // message with an error + aMessage.Complete(aError); + } + break; + case ESecureSubSessionBaseClose: + // Panic? Non-leaving function that just left? + break; + default: + // DisplatchMessageL above has left - this could be becuase ServiceMessageL left or the subsession DisplatchL + // NB the test is intened to ignore a function enum of ELastSessionMessageId - this is not a valid command + if(aMessage.Function()ELastSessionMessageId) + { + // MUST be a message for the subsystem object - delegate + subSession = static_cast(iObjectIx->At(aMessage.Int3())); + subSession->Impl()->DispatchError(aMessage, aError); + } + break; + } + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/cserverlaunch.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/cserverlaunch.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,77 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// serverlaunch.cpp +// +// + +#include "cserverlaunch.h" +#include "tserverstartparams.h" + +/** Launch the server by specified parameters +find the process and launch it + +@param aParams A reference to TProcessStartParams object +@return Symbian error code +@see TProcessStartParams +@internalTechnology +@released + */ +TInt CServerLaunch::ServerLaunch(TServerStartParams& aParams) + { + TFindServer serverSearcher(aParams.GetServerName()); + TFileName matchingFileName; + TInt error = serverSearcher.Next(matchingFileName); // we haev asked for a exact match, so the retunred filename can be ignored + if(error==KErrNone) + { + return KErrNone; // found it, so some other kind process has just started the server for us + } + else + { + error = CreateServerProcess(aParams); + } + return error; + } + +/** create server process by specified parameters +signal the clients and start the process, wait for any request. + +@param aParams A reference to TProcessStartParams object +@return Symbian error code +@see TProcessStartParams +@internalTechnology +@released + */ +TInt CServerLaunch::CreateServerProcess(TServerStartParams& aParams) + { + RProcess server; + + TInt r=server.Create(aParams.GetServerFileName(),aParams.GetAsCommandLine()); + if (r!=KErrNone) + return r; + TRequestStatus stat; + server.Rendezvous(stat); + if (stat!=KRequestPending) + { + server.Kill(0); + } + else + { + server.Resume(); + } + User::WaitForRequest(stat); + r=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); + server.Close(); + return r; + } + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/cshutdowntimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/cshutdowntimer.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,97 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "cshutdowntimer.h" +#include +/// Lbs +#include "lbsdevloggermacros.h" +/** +Default constructor, set the timer to standard priority by default +add timer to active scheduler + +@internalTechnology +@released + */ +CShutdownTimer::CShutdownTimer() : CTimer(CActive::EPriorityStandard) + { + CActiveScheduler::Add(this); + } + +/** +Default destructor, cancel any outstanding request of timer active object + +@internalTechnology +@released + */ +CShutdownTimer::~CShutdownTimer() + { + LBSLOG(ELogP1,"CShutdownTimer::~CShutdownTimer"); + Cancel(); + } + +/** +Call CTimer base class to construct the shut down timer + +@internalTechnology +@released + */ +void CShutdownTimer::ConstructL() + { + // call the base class version + CTimer::ConstructL(); + } + +/** +start the timer by specifying the shut down delay to issue a time request + +@param aDelay Time interval in micro seconds +@internalTechnology +@released + */ +void CShutdownTimer::Start(const TTimeIntervalMicroSeconds32 aDelay) + { + LBSLOG(ELogP1,"->CShutdownTimer::Start"); + After(aDelay); + LBSLOG(ELogP1,"<-CShutdownTimer::Start"); + } + +/** +stop the timer by cancelling outstanding time request + +@internalTechnology +@released + */ +void CShutdownTimer::Stop() + { + LBSLOG(ELogP1,"->CShutdownTimer::Stop"); + Cancel(); + LBSLOG(ELogP1,"<-CShutdownTimer::Stop"); + } + +/** +inherited from CActive. Main message loop to deal with dispatched request +stop the active scheduler whenever a request is received. + this stops the AS that owns the CPolicyServer AO. So it stops the server. + +@internalTechnology +@released + */ +void CShutdownTimer::RunL() + { + LBSLOG(ELogP1,"->CShutdownTimer::RunL"); + CActiveScheduler::Stop(); + LBSLOG(ELogP1,"<-CShutdownTimer::Stop"); + + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/csubsessionbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/csubsessionbase.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,126 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "csubsessionbase.h" +#include "lbsmessageenums.h" + +/** +inline function to push the item needed to be released when destroy, via a TCleanupItem object, +which includes a MRelease function to release the resource. + +@param aRef A reference MRelease function +@internalTechnology +@released + */ +inline void CleanupVirtualRelease::PushL(MRelease& aRef) + { + CleanupStack::PushL(TCleanupItem(&Release,&aRef)); + } + +/** +release the resource by calling the defined MRelease function + +@param aPrt A reference of MRelease function +@internalTechnology +@released + */ +void CleanupVirtualRelease::Release(TAny* aPtr) + { + MRelease* ptr = reinterpret_cast(aPtr); + TReleaseFunc func = &MRelease::VirtualRelease; + (ptr->*func)(); + } + + +/** +function to push the item needed to be released by calling CleanupVirtualRelease class, +which includes a MRelease function to release the resource. + +@param aRef A reference MRelease function +@internalTechnology +@released + */ +void CleanupVirtualReleasePushL(MRelease& aRef) + { + CleanupVirtualRelease::PushL(aRef); + } + +/** +Default constructor +Nothing here + +@internalTechnology +@released + */ +CSubSessionBase::CSubSessionBase() + { + // does nothing + } + +/** +Default destructor +Nothing here + +@internalTechnology +@released + */ +CSubSessionBase::~CSubSessionBase() + { + // nuke the impl object + if(iImpl) + { + iImpl->VirtualRelease(); + iImpl=NULL; + } + } + +/** +Set the generic subsession implement pointer + +@param aImpl A generic interface pointer to MSubSessionImpl +@see MSubSessionImpl +@internalTechnology +@released + */ +void CSubSessionBase::SetImpl(MSubSessionImpl* aImpl) + { + iImpl = aImpl; + } + +/** +Get the generic subsession implement pointer + +@return the generic interface pointer to MSubSessionImpl +@see MSubSessionImpl +@internalTechnology +@released + */ +MSubSessionImpl* CSubSessionBase::Impl() + { + return iImpl; + } + +/** +Invoke user panic by setting the category as CSubSessionBase + +@param aPanic A constant panic category TSubSessionBasePanic +@internalTechnology +@released + */ +void CSubSessionBase::Panic(const TSubSessionBasePanic aPanic) + { + _LIT(KSubSessionBase, "CSubSessionBase"); + User::Panic(KSubSessionBase, aPanic); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/lbstestclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/lbstestclient.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,65 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Client side code for the LBS test server. +// +// + +#include +#include +#include "lbstestclient.h" +#include "lbstestclientimpl.h" + + +/////////////////////////////////////////////////////////////////////////////// +// CLbsTestServer +/////////////////////////////////////////////////////////////////////////////// + +CLbsTestServer::CLbsTestServer() + { + + } + +CLbsTestServer::~CLbsTestServer() + { + delete iImpl; + } + +EXPORT_C CLbsTestServer* CLbsTestServer::NewL() + { + CLbsTestServer* self = new (ELeave) CLbsTestServer; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CLbsTestServer::ConstructL() + { + iImpl = CLbsTestServerImpl::NewL(); + } + +EXPORT_C TInt CLbsTestServer::StopLbsSystem() + { + return iImpl->StopLbsSystem(); + } + +EXPORT_C TInt CLbsTestServer::StartLbsSystem() + { + return iImpl->StartLbsSystem(); + } + +EXPORT_C TInt CLbsTestServer::ResetLbsSystem() + { + return iImpl->ResetLbsSystem(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/lbstestclientimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/lbstestclientimpl.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,108 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of the client-side code +// for the Lbs test server. +// +// + +#include +#include "lbstestmessageenums.h" +#include "lbstestserverdata.h" +#include "lbstestclientimpl.h" + + +/////////////////////////////////////////////////////////////////////////////// +// RLbsTestSession +/////////////////////////////////////////////////////////////////////////////// + +/** Get the version of this object. +*/ +TVersion RLbsTestSession::Version() + { + return TVersion(KTestServerMajorVersionNumber, + KTestServerMinorVersionNumber, + KTestServerBuildVersionNumber); + } + +/** Force the LBS system to stop and shutdown. + +THIS FUNCTION SHOULD ONLY BE USED IN TEST CODE! + +This function will stop the LBS system immediately, even +if it is currently processing a location request. +*/ +TInt RLbsTestSession::StopLbsSystem() + { + return SendReceive(ELbsTestStopLbsSystem); + } + +TInt RLbsTestSession::StartLbsSystem() + { + return SendReceive(ELbsTestStartLbsSystem); + } + +TInt RLbsTestSession::ResetLbsSystem() + { + return SendReceive(ELbsTestResetLbsSystem); + } + +/////////////////////////////////////////////////////////////////////////////// +// CLbsTestServerImpl +/////////////////////////////////////////////////////////////////////////////// + +CLbsTestServerImpl::~CLbsTestServerImpl() + { + iSession.Close(); + } + +CLbsTestServerImpl::CLbsTestServerImpl() + { + } + +CLbsTestServerImpl* CLbsTestServerImpl::NewL() + { + CLbsTestServerImpl* self = new (ELeave) CLbsTestServerImpl; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CLbsTestServerImpl::ConstructL() + { + /** + * See the ServerFramework code for the meaning of these params + */ + iParams.SetServerFileName(KTestServerFileName); + iParams.SetServerName(KTestServerName); + iParams.SetNumberOfServerSlots(KServerFrameworkDefaultMessageSlots); + iParams.SetServerUids(KNullUid, KNullUid, KLbsTestServerUid); + + User::LeaveIfError(iSession.Connect(iParams)); + } + +TInt CLbsTestServerImpl::StopLbsSystem() + { + return iSession.StopLbsSystem(); + } + +TInt CLbsTestServerImpl::StartLbsSystem() + { + return iSession.StartLbsSystem(); + } + +TInt CLbsTestServerImpl::ResetLbsSystem() + { + return iSession.ResetLbsSystem(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/lbstestserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/lbstestserver.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,109 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// server side exmaple of how to use the abstract server framework +// +// + +#include +#include "lbstestserver.h" +#include "lbstestserverdata.h" +#include "lbstestmessageenums.h" +#include "lbstestsession.h" + + +/////////////////////////////////////////////////////////////////////////////// +// Security Policy information +/////////////////////////////////////////////////////////////////////////////// +const TUint myRangeCount = 4; +const TInt myRanges[myRangeCount] = + { + 0, //range is 0-1 inclusive + ESecureSubSessionBaseClose, //range is ESecureSubSessionBaseClose to (EFirstLbsTestServerMessage - 1) + EFirstLbsTestServerMessage, //range is EFirstLbsTestServerMessage to (ELastLbsTestServerMessage - 1) + ELastLbsTestServerMessage // range is ELastLbsTestServerMessage to KMaxTInt inclusive + }; + +const TUint8 myElementsIndex[myRangeCount] = + { + CPolicyServer::EAlwaysPass, + CPolicyServer::ENotSupported, + 0, + CPolicyServer::ENotSupported + }; + +const CPolicyServer::TPolicyElement myElements[] = + { + {_INIT_SECURITY_POLICY_C1(ECapabilityLocation), CPolicyServer::EFailClient} + }; + +const CPolicyServer::TPolicy myPolicy = + { + CPolicyServer::EAlwaysPass, //specifies all connect attempts should pass + myRangeCount, + myRanges, + myElementsIndex, + myElements, + }; + +/////////////////////////////////////////////////////////////////////////////// +// Implementation of Server Framework functions +/////////////////////////////////////////////////////////////////////////////// + +MCreateServerImpl* CSecureASBase::GetImplLC() + { + CLbsTestServerImpl* impl = new(ELeave) CLbsTestServerImpl(); + CleanupStack::PushL(impl); + return impl; + } + +void CLbsTestServerImpl::CreateServerLC(TServerStartParams& aParams) + { + CLbsTestServer* s = new(ELeave) CLbsTestServer(CActive::EPriorityStandard, myPolicy); + CleanupStack::PushL(s); + s->ConstructL(aParams.GetServerName()); + // leave the server object on the CS + } + +/////////////////////////////////////////////////////////////////////////////// +// CTestServer +/////////////////////////////////////////////////////////////////////////////// + +CLbsTestServer::CLbsTestServer(TInt aPriority, const CPolicyServer::TPolicy& aSecurityPolicy) : + CSecureServerBase(aPriority, aSecurityPolicy), + iVersion(KTestServerMajorVersionNumber, + KTestServerMinorVersionNumber, + KTestServerBuildVersionNumber) + { + } + +CLbsTestServer::~CLbsTestServer() + { + } + +void CLbsTestServer::ConstructL(const TDesC& aServerName) + { + StartL(aServerName); + BaseConstructL(); // MUST BE CALLED + } + +CSession2* CLbsTestServer::DoNewSessionL(const TVersion& /*aVersion*/, const RMessage2& /*aMessage*/) const + { + return new (ELeave) CLbsTestSession(); // version number already checked at this point + } + + +TVersion CLbsTestServer::GetServerVersion() const + { + return iVersion; + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/lbstestservermain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/lbstestservermain.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,37 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// servermain.cpp +// THIS FILE MUST BE RENAMED TO THE NAME OF OF YOUR SERVER MAIN ENTRY POINT +// DO NOT EDIT THE FILE CONTENTS +// +// + + +#include "e32base.h" +#include "csecureasbase.h" +#include "tserverstartparams.h" + +// sample E32Main +// all servers should use this E32main(!), but in a renamed file. +// Derived classes make use of the abstract method CSecureAsBase::CreateServerLC(const TServerStartParams& aParams) +// For an implmenter that is your "E32Main" + +TInt E32Main() + { + TServerStartParams params; + TPtr ptr(reinterpret_cast(¶ms), 0, sizeof(TServerStartParams)/sizeof(TText16)); + User::CommandLine(ptr); + TInt err = CSecureASBase::ServerMain(params); + return err; + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/lbstestsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/lbstestsession.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,197 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// serverside.cpp +// server side exmaple of how to use the abstract server framework +// +// + +#include +#include "lbstestsession.h" +#include "lbstestmessageenums.h" +#include "lbssystemcontroller.h" +#include "tprocessstartparams.h" +#include "cprocesslaunch.h" + + +/* Called by the CServer2 code to complete construction of the session +*/ +void CLbsTestSession::CreateL() + { + CSecureSessionBase::CreateL(); // MUST do this + } + +/* Service new client requests. +*/ +void CLbsTestSession::DispatchL(const RMessage2& aMessage) + { + switch (aMessage.Function()) + { + case ELbsTestStopLbsSystem: + { + StopLbsSystem(aMessage); + break; + } + case ELbsTestStartLbsSystem: + { + StartLbsSystem(aMessage); + break; + } + case ELbsTestResetLbsSystem: + { + ResetLbsSystem(aMessage); + break; + } + default: + { + aMessage.Complete(KErrNotSupported); + break; + } + } + } + +/* Handle leaves from DispatchL +*/ +void CLbsTestSession::DispatchError(const RMessage2& /*aMessage*/, const TInt /*aError*/) + { + // Do nothing; leave error handling to the default behaviour + } + +/* Force the LBS system to stop. + +THIS FUNCTION SHOULD ONLY EVER BE USED FOR TEST PURPOSES. + +This function will tell LbsRoot to stop the LBS system immediately. +It will not check to see if there are any active requests still +being processed. +*/ +void CLbsTestSession::StopLbsSystem(const RMessage2& aMessage) + { + TInt err(KErrUnknown); + RLbsSystemController systemController; + + // Open the system controller interface + RProcess process; + systemController.OpenL(process.SecureId()); + CleanupClosePushL(systemController); + + // Logon to the root process to detect when it has exited + if (FindRootProcess(process)) + { + TRequestStatus status; + process.Logon(status); + + // Force a complete close down of LBS + switch (systemController.RequestCompleteCloseDown()) + { + case ELbsCloseDownRejected: + { + err = KErrInUse; + process.LogonCancel(status); + break; + } + case ELbsCloseDownComplete: + { + err = KErrNone; + break; + } + case ELbsCloseDownRootNotFound: + { + err = KErrDied; + process.LogonCancel(status); + break; + } + } + + User::WaitForRequest(status); + process.Close(); + } + + /* Wait until the LBS Root process has definitely gone down */ + while(FindRootProcess(process)) + /* do nothing ... */; + + CleanupStack::PopAndDestroy(&systemController); + aMessage.Complete(err); + } + +/* Start the LBS system + +THIS FUNCTION SHOULD ONLY EVER BE USED FOR TEST PURPOSES. + +If LbsRoot is not running then this function will start it. +If LbsRoot is already running then this function will request +it to start the system. +*/ +void CLbsTestSession::StartLbsSystem(const RMessage2& aMessage) + { + TProcessStartParams params; + _LIT(KLbsRootFileName, "\\sys\\bin\\lbsroot.exe"); + _LIT(KLbsRootProcessName, "lbsroot.exe"); + params.SetProcessFileName(KLbsRootFileName); + params.SetProcessName(KLbsRootProcessName); + params.SetRendezvousRequired(ETrue); + TInt err = CProcessLaunch::ProcessLaunch(params); + + aMessage.Complete(err); + } + +/* Reset the internal state of the LBS system + +THIS FUNCTION SHOULD ONLY EVER BE USED FOR TEST PURPOSES. + +This function tells the LBS system to reset its internal state +and caches. Currently this means that: +- The assistance data cache between lbsnetgateway and lbsagpsmanager is cleared. +*/ +void CLbsTestSession::ResetLbsSystem(const RMessage2& aMessage) + { + RLbsSystemController systemController; + + // Open the system controller interface + RProcess process; + systemController.OpenL(process.SecureId()); + CleanupClosePushL(systemController); + + // request a reset of the LBS system + systemController.RequestSystemReset(); + + CleanupStack::PopAndDestroy(&systemController); + aMessage.Complete(KErrNone); + } + +TBool CLbsTestSession::FindRootProcess(RProcess& aProcess) + { + _LIT(KLbsRootProcessName, "lbsroot.exe*"); + TInt err(KErrNotFound); + TFullName fullName; + TFindProcess processFinder(KLbsRootProcessName); + while (err = processFinder.Next(fullName), err == KErrNone) + { + RProcess process; + TInt processOpenErr = process.Open(processFinder); + if (processOpenErr == KErrNone) + { + TExitType exitType = process.ExitType(); + if (exitType == EExitPending) + { + // Found a running instance of lbsroot.exe, + aProcess = process; + return ETrue; + } + } + process.Close(); + } + + return EFalse; + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/messageutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/messageutils.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,120 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "messageutils.h" + +_LIT(KServerMessageUtilsWrite16, "RMessageWrite16"); +_LIT(KServerMessageUtilsWrite8, "RMessageWrite8"); +_LIT(KServerMessageUtilsRead16, "RMessageRead16"); +_LIT(KServerMessageUtilsRead8, "RMessageRead8"); + +/** +write data in buffer to message by index + +@param aMessage A reference to RMessage2 object +@param aIndex Index of message object +@param aBuf 16 bits data buffer to write to message object +@return Symbian standard error code +@internalTechnology +@released + */ +TInt MessageUtils::Write(const RMessage2& aMessage, const TInt aIndex, const TDesC16& aBuf) + { + TInt err = aMessage.Write(aIndex, aBuf); // assume a zero offset in the client side buffer + if(err) + { + PanicClient(aMessage, KServerMessageUtilsWrite16, err); + } + // also return the error code so that a server can cleanup is required... + return err; + } + +/** +write data in buffer to message by index + +@param aMessage A reference to RMessage2 object +@param aIndex Index of message object +@param aBuf 8 bits data buffer to write to message object +@return Symbian standard error code +@internalTechnology +@released + */ + TInt MessageUtils::Write(const RMessage2& aMessage, const TInt aIndex, const TDesC8& aBuf) + { + TInt err = aMessage.Write(aIndex, aBuf); // assume a zero offset in the client side buffer + if(err) + { + PanicClient(aMessage, KServerMessageUtilsWrite8, err); + } + // also return the error code so that a server can cleanup is required... + return err; + } + +/** +read data to buffer from message by index + +@param aMessage A reference to RMessage2 object +@param aIndex Index of message object +@param aBuf 16 bits data buffer to store data from message object +@return Symbian standard error code +@internalTechnology +@released + */ +TInt MessageUtils::Read(const RMessage2& aMessage, const TInt aIndex, TDes16& aBuf) + { + TInt err = aMessage.Read(aIndex, aBuf); // assume a zero offset in the buffer + if(err) + { + PanicClient(aMessage, KServerMessageUtilsRead16, err); + } + // also return the error code so that a server can cleanup is required... + return err; + } + +/** +read data to buffer from message by index + +@param aMessage A reference to RMessage2 object +@param aIndex Index of message object +@param aBuf 8 bits data buffer to store data from message object +@return Symbian standard error code +@internalTechnology +@released + */ +TInt MessageUtils::Read(const RMessage2& aMessage, const TInt aIndex, TDes8& aBuf) + { + TInt err = aMessage.Read(aIndex, aBuf); // assume a zero offset in the buffer + if(err) + { + PanicClient(aMessage, KServerMessageUtilsRead8, err); + } + // also return the error code so that a server can cleanup is required... + return err; + } + +/** +Complete the message by sending a panic to client + +@param aMessage A reference to RMessage2 object +@param aCat Panic category +@param aReason Reason to panic the client +@internalTechnology +@released + */ +void MessageUtils::PanicClient(const RMessage2& aMessage, const TDesC& aCat, const TInt aReason) + { + aMessage.Panic(aCat, aReason); // will also complete the RMessage + } + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/rsecuresessionbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/rsecuresessionbase.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,96 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// rsecureasbase.cpp +// +// + +#include +#include "cserverlaunch.h" +#include "rsecuresessionbase.h" +#include "csecureasbase.h" +#include "lbsmessageenums.h" +#include "lbsdevloggermacros.h" + +/** Client side session object connects to the server by starting server with specified parameter +keep trying to kick off the server! + +@param aParams A reference to TProcessStartParams object +@return Symbian error code +@see TProcessStartParams +@internalTechnology +@released + */ +TInt RSecureSessionBase::Connect(TServerStartParams& aParams) + { + // be very cunning :) This has to slot into the existing RPositionServer::Connect + // The parameter will have to morph into a local variable but that should be the only change + TInt ret; + + TInt retry = 2; + FOREVER + { + TVersion version = Version(); + + ret = CreateSession(aParams.GetServerName(), version, aParams.GetNumberOfServerSlots()); + + if (ret != KErrNotFound && ret != KErrServerTerminated) + { + break; + } + + if (--retry == 0) + { + break; + } + + ret = StartServer(aParams); + + if (ret != KErrAlreadyExists && ret != KErrNone) + { + break; + } + } + return ret; + } + +/** Client side session object close the session handler + +@internalTechnology +@released + */ +void RSecureSessionBase::Close() + { + LBSLOG(ELogP1, "RSecureSessionBase::Close"); + RHandleBase::Close(); + } + +/** +*/ +TInt RSecureSessionBase::StartServer(TServerStartParams& aParams) + { + return (CServerLaunch::ServerLaunch(aParams)); + } + + +//------------------------------------------------------------------------------ + +/** Client side subsession object issue the subsession close request. + +@internalTechnology +@released + */ +void RSecureSubSessionBase::Close() + { + CloseSubSession(ESecureSubSessionBaseClose); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/tprocessstartparams.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/tprocessstartparams.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,116 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// tprocessstartparams.h +// +// + +#include "tprocessstartparams.h" +#include + +/** Initialise start process parameters +@internalTechnology +@released + */ +TProcessStartParams::TProcessStartParams() : iRendezvousRequired(EFalse) + { + SetType(); + } + +/** set the rendezous requirement + +@internalTechnology +@released + */ + void TProcessStartParams::SetRendezvousRequired(TBool aRendezvousRequired) + { + iRendezvousRequired = aRendezvousRequired; + } + +/** Get the rendezous requirement + +@return TBool, Rendezvous property +@internalTechnology +@released + */ + TBool TProcessStartParams::GetRendezvousRequired() const + { + return iRendezvousRequired; + } + +/** set the process file name + +@param aExeName The process file name +@internalTechnology +@released + */ + void TProcessStartParams::SetProcessFileName(const TDesC& aExeName) + { + iProcessFileName = aExeName; + } + +/** Set the process name + +@param aProcessName The process name +@internalTechnology +@released + */ + void TProcessStartParams::SetProcessName(const TDesC& aProcessName) + { + iProcessName = aProcessName; + } + +/** Get the process file name + +@return The process file name +@internalTechnology +@released + */ + const TDesC& TProcessStartParams::GetProcessFileName() const + { + return iProcessFileName; + } + +/** Get the process name + +@return The process name +@internalTechnology +@released + */ + const TDesC& TProcessStartParams::GetProcessName() const + { + return iProcessName; + } + +/** Get the command line buffer + +@return The descriptor to the commandline buffer +@internalTechnology +@released + */ + TPtrC TProcessStartParams::GetAsCommandLine() const + { + TPtrC p(reinterpret_cast(this), sizeof(TProcessStartParams)/sizeof(TText)); + return p; + } + +/** +Fix the type of these params to KProcessStartParamsTypeUid + +@internalTechnology +@released + */ +void TProcessStartParams::SetType() + { + TStartParamsBase::SetType(KProcessStartParamsTypeUid); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/tserverstartparams.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/tserverstartparams.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,143 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include "tserverstartparams.h" +#include "e32math.h" + +/** +Initailise Server start parameters with default message slots + +@internalTechnology +@released + */ +TServerStartParams::TServerStartParams() : iNumberOfSlots(KServerFrameworkDefaultMessageSlots) + { + SetType(); + } + +/** +Set server file name + +@internalTechnology +@released + */ +void TServerStartParams::SetServerFileName(const TDesC& aExeName) + { + iServerFileName = aExeName; + } + +/** +Set server name + +@internalTechnology +@released + */ + void TServerStartParams::SetServerName(const TDesC& aServerName) + { + iServerName = aServerName; + } + +/** +set number of message slots + +@internalTechnology +@released + */ + void TServerStartParams::SetNumberOfServerSlots(TInt aSlots) + { + iNumberOfSlots = aSlots; + } + +/** +set server Uids + +@internalTechnology +@released + */ +void TServerStartParams::SetServerUids(TUid aUid1, TUid aUid2, TUid aUid3) + { + TUidType uid(aUid1, aUid2, aUid3); + iUids = uid; + } + +/** +get server file name + +@internalTechnology +@released + */ +const TDesC& TServerStartParams::GetServerFileName() + { + return iServerFileName; + } + +/** +get server name + +@internalTechnology +@released + */ +const TDesC& TServerStartParams::GetServerName() + { + return iServerName; + } + +/** +get number of message slots + +@internalTechnology +@released + */ +TInt TServerStartParams::GetNumberOfServerSlots() + { + return iNumberOfSlots; + } + +/** +get server start commandline buffer + +@return descriptor to the commandline buffer +@internalTechnology +@released + */ +TPtrC TServerStartParams::GetAsCommandLine() const + { + TPtrC p(reinterpret_cast(this), sizeof(TServerStartParams)/sizeof(TText)); + TInt l = p.Length(); + return p; + } + +/** +get server uids + +@internalTechnology +@released + */ +TUidType& TServerStartParams::GetServerUids() + { + return iUids; + } + + +/** +Fix the type of these params to KServerStartParamsTypeUid + +@internalTechnology +@released + */ +void TServerStartParams::SetType() + { + TStartParamsBase::SetType(KServerStartParamsTypeUid); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/internal/lbstestserver/src/tstartparamsbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/internal/lbstestserver/src/tstartparamsbase.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,40 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of class used to define server start parameters +// +// + + + +/** + @file + @internalTechnology +*/ + +#include "tstartparamsbase.h" + +TStartParamsBase::~TStartParamsBase() + { + // nothing to do - virtual placeholder + } + +const TUid TStartParamsBase::GetType() const + { + return iType; + } + +void TStartParamsBase::SetType(const TUid& aType) + { + iType = aType; + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/group/bld.inf Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,27 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This is the build file for the LBS client Tests +// +// + +#include "../lbsexeclient/group/bld.inf" + +PRJ_TESTEXPORTS +../scripts/smoketest_lbs.script z:/smoketest/smoketest_lbs.script +../scripts/setup_smoketest_lbs.script z:/smoketest/setup_smoketest_lbs.script + +../testdata/smoketest_lbs.ini z:/smoketest/smoketest_lbs.ini + +PRJ_TESTMMPFILES +ctlbsclientserver.mmp diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/group/ctlbsclientserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/group/ctlbsclientserver.mmp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,71 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientserver.mmp +// This is the make file for the LBS Client Tests +// TODO: Ensure we update below: +// CAPABILITY ALL -TCB +// CAPABILITY WriteDeviceData ReadDeviceData +// +// + +CAPABILITY WriteDeviceData ReadDeviceData Location + +TARGET lbsclienttestserver.exe +TARGETTYPE exe +UID 0x1000007A 0x10282258 +VENDORID 0x70000001 + +#include "../../common/group/ctlbscommon.mmp" + +USERINCLUDE ../inc +//USERINCLUDE ../../lbsassdata/inc + +// Lbs Client framework code. +SOURCEPATH ../src +SOURCE ctlbsclientserver.cpp +SOURCE ctlbsclientstep.cpp + +// Lbs Client test step code. +SOURCE ctlbsclientstepsrvconnectclose.cpp +SOURCE ctlbsclientstepnotifyposupdate.cpp +SOURCE ctlbsclientstepopenclose.cpp +SOURCE ctlbsclientstepsrvversion.cpp +SOURCE ctlbsclientstepmodselect.cpp +SOURCE ctlbsclientstepmodinfo.cpp +SOURCE ctlbsclientsteplastknownpos.cpp +SOURCE ctlbsclientstepmultireq.cpp +SOURCE ctlbsclientgetlkpao.cpp +SOURCE ctlbsclientnotifyposupdao.cpp +SOURCE ctlbsclientstepmodstatus.cpp +SOURCE ctlbsclientstepupdateoptions.cpp +SOURCE ctlbsclientstepassistance.cpp +SOURCE ctlbsclientstepcellbasednpud.cpp +SOURCE ctlbsclientsteppartialupdate.cpp +SOURCE ctlbsclientsteptracking.cpp +SOURCE ctlbsclientstepignoreaccurracysetting.cpp +SOURCE ctlbsclientstepignoreaccurracysettingtracking.cpp +SOURCE ctlbsclientstep_reset_assistance.cpp + +// LBS libraries. +LIBRARY lbsselflocate.lib +LIBRARY lbsloccommon.lib +LIBRARY lbsadmin.lib +LIBRARY lbslocdatasource.lib +LIBRARY lbsnetprotocol.lib +LIBRARY lbsassistancedata.lib + +// LBS test libraries. +LIBRARY lbstestutils.lib +LIBRARY lbsnetsim.lib +LIBRARY lbstestclient.lib diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclienteventtimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclienteventtimer.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_EVENT_TIMER_H__ +#define __CT_LBS_CLIENT_EVENT_TIMER_H__ + +// INCLUDES +#include +#include + +// CONSTANTS + +// FORWARD DECLARATIONS +class MCT_LbsRequestObserver; + +// CLASS DECLARATION + +/** +* This class is used to time the notification dialog +* +*/ +class CT_LbsClientEventTimer : public CActive + { + private: // Constructors + + /** + * C++ default constructor. + */ + CT_LbsClientEventTimer(); + + /** + * By default EPOC constructor is private. + */ + void ConstructL(CTestExecuteLogger& aLogger); + + // By default, prohibit copy constructor + CT_LbsClientEventTimer( const CT_LbsClientEventTimer& ); + // Prohibit assigment operator + CT_LbsClientEventTimer& operator= ( const CT_LbsClientEventTimer& ); + // Logger interface used for constructing result strings to be fed for the logger instance + inline CTestExecuteLogger& Logger() {return iLogger;}; + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CT_LbsClientEventTimer* NewL(CTestExecuteLogger& aLogger); + + /** + * Two-phased constructor. + */ + static CT_LbsClientEventTimer* NewLC(CTestExecuteLogger& aLogger); + + /** + * Destructor. + */ + ~CT_LbsClientEventTimer(); + + public: // New functions + + /** + * Start the timer + */ + void Start(TInt aTimeout); + + TInt CompletionCode() const; + + void ResetCompletionCode(); + + /** + * Set who is observing timeouts + * @param aObserver the observing object + */ + void SetObserver( + /* IN */ MCT_LbsRequestObserver* aObserver + ); + + protected: // Functions from base classes + + /** + * From CActive + */ + void RunL(); + + /** + * From CActive + */ + TInt RunError(TInt aError); + + /** + * From CActive + */ + void DoCancel(); + + protected: // New functions + + void RequestComplete(); + + private: // Data + RTimer iTimer; + MCT_LbsRequestObserver* iObserver; + TInt iCompletionCode; + + CTestExecuteLogger iLogger; + }; + +#endif // __CT_LBS_CLIENT_EVENT_TIMER_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientgetlkpao.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientgetlkpao.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,69 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This contains the header file for Get last known position +* +* +*/ + + + + + +/** + @file ctlbsclientgetlastknownposao.h +*/ +#if (!defined __CT_LBS_CLIENT_LAST_KNOWN_POS_AO_H__) +#define __CT_LBS_CLIENT_LAST_KNOWN_POS_AO_H__ + +#include +#include + +class MT_GetLastKnownPosObserver + { + public: + virtual void GetLastKnownPositionCallback(TRequestStatus& aStatus) = 0; + }; + + +class CT_LbsClientGetLastKnownPosAO: public CActive + { +public: + ~CT_LbsClientGetLastKnownPosAO(); + static CT_LbsClientGetLastKnownPosAO* NewL(MT_GetLastKnownPosObserver& aUser); + // wrapper for async positioner function GetLastKnownPosition() + void GetLastKnownPosL(RPositioner& aPositioner, TPositionInfo& aPosInfo); + +protected: +// CActive: + // Redeclares the base class CActive::DoCancel(). + virtual void DoCancel(); + // Redeclares the base class CActive::RunL(). + virtual void RunL(); + // Redeclares the base class CActive::RunError(). + virtual TInt RunError(TInt aError); + +private: + // our status, so we know when request completes: + // positioner currently in use: + RPositioner iPositioner; + // type of request outstanding: + TInt iRequestId; + // caller + MT_GetLastKnownPosObserver& iCaller; + + CT_LbsClientGetLastKnownPosAO(MT_GetLastKnownPosObserver& aCaller); + }; + +#endif // _CT_LBS_CLIENT_LAST_KNOWN_POS_AO_H_ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientnotifyposupdao.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientnotifyposupdao.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,72 @@ +/** +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + + +/** + @file ctlbsclientnotifyposupdao.h +*/ +#if (!defined __CT_LBS_CLIENT_NOTIFY_POS_UPD_AO_H__) +#define __CT_LBS_CLIENT_NOTIFY_POS_UPD_AO_H__ + +#include +#include + + +class MT_NotifyPosUpdateObserver + { + public: + virtual void NotifyPositionUpdateCallback(TRequestStatus& aStatus) = 0; + }; + + +class CT_LbsClientNotifyPosUpdAO: public CActive + { +public: + // destructor + ~CT_LbsClientNotifyPosUpdAO(); + + // constructor + static CT_LbsClientNotifyPosUpdAO* NewL(MT_NotifyPosUpdateObserver& aCaller); + + // wrapper for async positioner function NotifyPositionUpdate() + void CT_LbsClientNotifyPosUpdAO::NotifyPosUpdateL(RPositioner& aPositioner, TPositionInfo& aPosInfo); + +protected: +// CActive: + // Redeclares the base class CActive::DoCancel(). + virtual void DoCancel(); + // Redeclares the base class CActive::RunL(). + virtual void RunL(); + // Redeclares the base class CActive::RunError(). + virtual TInt RunError(TInt aError); + +private: + // our status, so we know when request completes: + // positioner currently in use: + RPositioner iPositioner; + // type of request outstanding: + TInt iRequestId; + // caller + MT_NotifyPosUpdateObserver& iCaller; + + CT_LbsClientNotifyPosUpdAO(MT_NotifyPosUpdateObserver& aCaller); + }; + +#endif // __CT_LBS_CLIENT_NOTIFY_POS_UPD_AO_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientobserver.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_OBSERVER_H__ +#define __CT_LBS_CLIENT_OBSERVER_H__ + +// INCLUDES +#include + +// CONSTANTS + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +*/ +class CT_LbsClientObserver : public CBase + { + public: // New functions + + /** + * Waits for EPos server to shut down. If it is + * not running this method will return instantaneously. + */ + static void WaitForEPosShutdown(); + + /** + * Pushes WaitForEPosShutdown to the cleanup stack. It is useful when + * other cleanup items are dependent on EPos having released all its + * resources + */ + static void EPosShutdownWaitPushL(); + + /** + * Checks if EPos server is alive. + */ + static TBool EPosAliveL(); + + /** + * Waits for privacy server to shut down. If it is + * not running this method will return instantaneously. + */ + static void WaitForPrivacyServerShutdown(); + + /** + * Pushes WaitForPrivacyServerShutdown to the cleanup stack. It is useful + * when other cleanup items are dependent on EPos having released all its + * resources + */ + static void PrivacyServerShutdownWaitPushL(); + + /** + * Checks if privacy server is alive. + */ + static TBool PrivacyServerAliveL(); + + private: // New functions + + /** + * Waits for a process to die. If the process is + * not running this method will return instantaneously. + * @param aProcessName The name of the process. + */ + static void WaitForProcessDeath( + /* IN */ const TDesC& aProcessName + ); + + /** + * Checks if a process is alive. + * @param aProcessName The name of the process. + */ + static TBool ProcessAliveL( + /* IN */ const TDesC& aProcessName + ); + + }; + +#endif // __CT_LBS_CLIENT_OBSERVER_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientperiodictester.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientperiodictester.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,253 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_PERIODIC_TESTER_H__ +#define __CT_LBS_CLIENT_PERIODIC_TESTER_H__ + +// INCLUDES +#include +#include + +#include "Lbs.h" + +// CONSTANTS + +#ifdef __WINS__ +const TInt KToleratedEarliness = 400000; //0.4 s +#endif + +const TInt KTracePeriod = 10; + +// FORWARD DECLARATIONS +class CT_LbsClientLog; + +// CLASS DECLARATION + +/** +* Helper class for periodic update tests +* +*/ +class CT_LbsClientPeriodicTester : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CT_LbsClientPeriodicTester* NewL( + /* IN */ TTimeIntervalMicroSeconds aInterval, + /* IN */ const TDesC& aSericeName, + /* IN */ CT_LbsClientLog* aLog, + /* IN */ TUid aUid, + /* IN */ TInt aNumberOfRuns + ); + + /** + * Destructor. + */ + virtual ~CT_LbsClientPeriodicTester(); + + public: // New functions + + /** + * Requests notification from positioner and set the active flag true. + */ + void RequestNotification(); + + /** + * Changes current test parameters. Can only be called when previous test is completed + */ + void ChangeTestParametersL( + /* IN */ TTimeIntervalMicroSeconds aInterval, + /* IN */ TInt aNumberOfRuns + ); + + /** + * Changes name in requestor information. + */ + void ChangeRequestorInformation( + /* IN */ const TDesC& aServiceName + ); + + /** + * Closes the positioner + */ + void ClosePositioner(); + + /** + * Opens the positioner + */ + void OpenPositionerL( + /* IN */ const TDesC& aServiceName + ); + + /** + * Sets the maxage parameter in position update options + */ + void SetMaxAgeL( + /* IN */ TTimeIntervalMicroSeconds aInterval + ); + + /** + * Sets the partial update parameter in position update options + */ + void SetPartialUpdateL( + /* IN */ TBool aUpdateOption + ); + + /** + * Sets the timeout parameter in position update options + */ + void SetTimeOutL( + /* IN */ TTimeIntervalMicroSeconds aInterval + ); + + /** + * Changes the update interval before the previous interval has completed one time + */ + void SetChangeParametersPrematurely( + /* IN */ TBool aCondition + ); + + /** + * A way to determine if any error has happened. + */ + TBool IsCompletedOK(); + + /** + * Get errorcode if error has occurred. + */ + TInt GetError(); + + /** + * Cancels periodic requests from EPos Server + */ + void CancelRequest(); + + /** + * Returns the position from the latest notift position request + */ + void GetPosition(TPositionInfo& aPosInfo); + + + public: // Functions from CActive + + /** + * From CActive Service completed request. + * Defined as pure virtual by CActive; + * implementation provided by this class, + */ + void RunL(); + + /** + * From CActive Cancel request. + * Defined as pure virtual by CActive; + * implementation provided by this class. + */ + TInt RunError(TInt aError); + + /** + * From CActive Cancel request. + * Defined as pure virtual by CActive; + * implementation provided by this class. + */ + void DoCancel(); + + private: + + /** + * C++ default constructor. + */ + CT_LbsClientPeriodicTester(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL( + /* IN */ TTimeIntervalMicroSeconds aInterval, + /* IN */ const TDesC& aServiceName, + /* IN */ CT_LbsClientLog* aLog, + /* IN */ TUid aUid, + /* IN */ TInt aNumberOfRuns + ); + + /** + * Evaluates condition, logs and leaves if false. + */ + void AssertTrueL( + /* IN */ TBool aCondition, + /* IN */ const TDesC& aErrorMsg, + /* IN */ TInt aErrorCode + ); + + + private: // Data + // EPos server instance + RPositionServer iPosServer; + + // Positioner instance + RPositioner iPositioner; + + // Position information to be sent with NotifyPositionUpdate + TPositionInfo iPositionInfo; + + // Number of periodic updates to request + TInt iNumberOfUpdates; + + // Number of periodic updates received + TInt iNumberOfRuns; + + // Tells if the test is going to end prematurely with a chage of update interval + TBool iPrematureChangeOfParameters; + + // Tells if the outstanding request is going to be canceled + TBool iCancelRequest; + + // Tells if the outstanding request has been canceled + TBool iCanceledRequest; + + // Tells if to write messages to log + TBool iWriteToLog; + + // The time for when the most recent position update was received + TTime iRecentTime; + + // The interval to request position updates between + TTimeIntervalMicroSeconds iInterval; + + // Test log + CT_LbsClientLog* iLog; + + // The name of the positioner + TBuf<100> iName; + + // The uid of the positioner + TUid iUid; + + //Error indication + TBool iError; + + //Error indication + TInt iErrorCode; + + }; + +#endif // __CT_LBS_CLIENT_PERIODIC_TESTER_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientportedsuiteserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientportedsuiteserver.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,91 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ctlbsclientportedserver.h +// Test server for ported client tests +// +// + +#ifndef __CT_LBS_CLIENT_PORTED_SERVER_H__ +#define __CT_LBS_CLIENT_PORTED_SERVER_H__ + +#include + +#include "ctlbsserver.h" + +// CONSTANTS +_LIT(KTestProcedure1, "TP1"); +_LIT(KTestProcedure2, "TP2"); +_LIT(KTestProcedure11, "TP11"); +_LIT(KTestProcedure17, "TP17"); +_LIT(KTestProcedure21, "TP21"); +_LIT(KTestProcedure22, "TP22"); +_LIT(KTestProcedure25, "TP25"); +_LIT(KTestProcedure27, "TP27"); +_LIT(KTestProcedure76, "TP76"); +_LIT(KTestProcedure93, "TP93"); +_LIT(KTestProcedure169, "TP169"); +_LIT(KTestProcedure173, "TP173"); +_LIT(KTestProcedure176, "TP176"); +_LIT(KTestProcedure178, "TP178"); +_LIT(KTestProcedure179, "TP179"); +_LIT(KTestProcedure188, "TP188"); +_LIT(KTestProcedure189, "TP189"); +_LIT(KTestProcedure193, "TP193"); +_LIT(KTestProcedure194, "TP194"); +_LIT(KTestProcedure195, "TP195"); +_LIT(KTestProcedure201, "TP201"); +_LIT(KTestProcedure203, "TP203"); +_LIT(KTestProcedure204, "TP204"); +_LIT(KTestProcedure208, "TP208"); +_LIT(KTestProcedure213, "TP213"); +_LIT(KTestProcedure217, "TP217"); +_LIT(KTestProcedure218, "TP218"); +_LIT(KTestProcedure222, "TP222"); +_LIT(KTestProcedure223, "TP223"); +_LIT(KTestProcedure224, "TP224"); +_LIT(KTestProcedure227, "TP227"); +_LIT(KTestProcedure254, "TP254"); +_LIT(KTestProcedure256, "TP256"); +_LIT(KTestProcedure257, "TP257"); +_LIT(KTestProcedure259, "TP259"); +_LIT(KTestProcedure261, "TP261"); +_LIT(KTestProcedure269, "TP269"); +_LIT(KTestProcedure271, "TP271"); +_LIT(KTestProcedure272, "TP272"); +_LIT(KTestProcedure274, "TP274"); +_LIT(KTestProcedure275, "TP275"); +_LIT(KTestProcedure4701, "TP4701"); +_LIT(KTestProcedure4702, "TP4702"); +_LIT(KTestProcedure4703, "TP4703"); +_LIT(KTestProcedure4704, "TP4704"); +_LIT(KTestProcedure4705, "TP4705"); +_LIT(KTestProcedure4706, "TP4706"); +_LIT(KTestProcedure4707, "TP4707"); +_LIT(KTestProcedure4708, "TP4708"); +_LIT(KTestProcedure4709, "TP4709"); +_LIT(KTestProcedure4722, "TP4722"); +_LIT(KTestProcedure4723, "TP4723"); + +class CT_LbsClientPortedSuite : public CT_LbsServer + { +public: + static CT_LbsClientPortedSuite* NewL(); + // Base class pure virtual override + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + +// Please Add/modify your class members +private: + }; + +#endif // __CT_LBS_CLIENT_PORTED_SERVER_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpositionconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpositionconstants.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POSITION_CONSTANTS_H__ +#define __CT_LBS_CLIENT_POSITION_CONSTANTS_H__ + + +// CONSTANTS +const TReal32 KHorizontalAcc = 40; +const TReal32 KVerticalAcc = 40; + +const TReal64 KLatitude = 2; +const TReal64 KLongitude = 3; +const TReal32 KAltitude = 200; + +_LIT(KPositionTime, "20801027:161600");//YYYYMMDD:HHMMSS.MMMMMM + +const TReal32 KSpeed = 20; +const TReal32 KHeading = 30; +const TReal32 KSpeedAcc = 2; +const TReal32 KHeadingAcc = 3; + +const TInt KSatelliteId = 30; +const TReal32 KAzimuth = 30; +const TReal32 KElevation = 30; +const TBool KIsUsed = ETrue; +const TInt KSignalStrength = 10; + +const TReal32 KAzimuthOdd = 35; +const TReal32 KElevationOdd = 35; +const TBool KIsUsedOdd = EFalse; +const TInt KSignalStrengthOdd = 5; + +const TUint KNumberOfSatellitesInView = 12; +const TUint KNumberOfSatellitesUsed = 6; +_LIT(KSatelliteTime, "20021027:161600"); +const TReal32 KHorizontalDoPValue = 1; +const TReal32 KVerticalDoPValue = 2; +const TReal32 KTimeDoPValue = 20; + +_LIT(KModuleName, "Multi PSY"); + + +#endif // __CT_LBS_CLIENT_POSITION_CONSTANTS_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp1.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp1.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP1_H__ +#define __CT_LBS_CLIENT_POS_TP1_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION +/** +* Test procedure 1 +* +*/ +class CT_LbsClientPosTp1 :public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp1(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp1(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Deinitializes the test. + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: // New functions + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode); + + }; + +#endif // __CT_LBS_CLIENT_POS_TP1_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp11.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp11.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP11_H__ +#define __CT_LBS_CLIENT_POS_TP11_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 11 +*/ +class CT_LbsClientPosTp11 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp11(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp11(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: // New functions + + /** + * Checks that EPos is alive, or that it is not alive + */ + void CheckEPosActivityL( + TBool aExpectEPosLiveness + ); + + /** + * Checks if the server with name aServerName is alive + */ + TBool ServerAliveL(const TDesC& aServerName); + + TFileName SearchAndReturnCompleteFileName(const TDesC& aFileName); + + }; + +#endif // __CT_LBS_CLIENT_POS_TP11_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp169.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp169.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP169_H__ +#define __CT_LBS_CLIENT_POS_TP169_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 169 +* +*/ +class CT_LbsClientPosTp169 :public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp169(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp169(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: // New functions + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueL(TBool aCondition, const TDesC& errorMsg); + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode); + + /** + * This testpart tests error report "ESLI-5W9D7M Poison4 - Sort order after full reset" + * verifies that the Horizontal/Vertical accuracy 0 value is returned as NaN when reading + * the value from the modulesdb, uses the panic psy which has values 0 for + * horizontal and vertical accuracy + */ + void TestNaNFromPSY(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP169_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp17.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp17.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP17_H__ +#define __CT_LBS_CLIENT_POS_TP17_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 17 +* +*/ +class CT_LbsClientPosTp17 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp17(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp17(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: // New functions + + }; + +#endif // __CT_LBS_CLIENT_POS_TP17_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp173.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp173.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP173_H__ +#define __CT_LBS_CLIENT_POS_TP173_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" +#include "EPos_MPosModulesObserver.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 173 +* +*/ +class CT_LbsClientPosTp173 : public CT_LbsPortedStepBase, public MPosModulesObserver + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp173(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp173(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + public: // New Functions + + /** + * Timeout request if the no notification has been sent + * by the server. + */ + void NotifyTimeout(); + + void HandleSettingsChangeL(TPosModulesEvent); + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueL(TBool aCondition, const TDesC& errorMsg); + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode); + + void CheckErrorL(); + + void DoEventHandlingL(); + + protected: + + TBool iNoEvents; + TBool iError; + TBuf<200> iErrorText; + + private: + + TInt iEvent; + + }; + +//// CLASS DECLARATION + +/** + * + */ +class CMyNotificationTimer : public CTimer + { + public: + + /** + * Destructor. + */ + virtual ~CMyNotificationTimer(); + + public: + + /** + * Two-phased constructor. + */ + static CMyNotificationTimer* NewLC(CT_LbsClientPosTp173* aMainControl); + + /** + * Two-phased constructor. + */ + static CMyNotificationTimer* NewL(CT_LbsClientPosTp173* aMainControl); + + public: + + /** + * Starts the power checking timer + */ + void StartNotificationTimer(); + + /** + * Cancel the power checking timer. + */ + void DoCancel(); + + private: + + /** + * EPOC constructor. + */ + void ConstructL(); + + /** + * C++ default constructor. + */ + CMyNotificationTimer(CT_LbsClientPosTp173* aMainControl); + + /** + * From CActive. Handles an active object’s request completion + * event. + */ + void RunL(); + + //Prohibit copy constructor + CMyNotificationTimer( const CMyNotificationTimer& ); + // Prohibit assigment operator + CMyNotificationTimer& operator= ( const CMyNotificationTimer& ); + + private: + // a handler to the communicator + CT_LbsClientPosTp173* iMainControl; + TInt iNotificationTimout; + }; + +#endif // __CT_LBS_CLIENT_POS_TP173_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp176.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp176.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP176_H__ +#define __CT_LBS_CLIENT_POS_TP176_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CONSTANTS + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 176 +* +*/ +class CT_LbsClientPosTp176 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp176(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp176(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Called after the tests + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + * Called after the tests + */ + void InitTestL(); + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + + private: + + TBool IsQualityUpdatedL(TUid aUid); + + private: // Data + TPositionQuality iQuality; + TPositionQuality iQualityTestPsy1; + + }; + +#endif // __CT_LBS_CLIENT_POS_TP176_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp178.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp178.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP178_H__ +#define __CT_LBS_CLIENT_POS_TP178_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CONSTANTS + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 178 +* +*/ +class CT_LbsClientPosTp178 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp178(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp178(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called after the test, even if the test leaves + */ + void CloseTest(); + + private: // New functions + + /** + * Test that the positioner does a timeout + * after the set update interval and that the request is not logged + * in the request log + */ + void TestTimeoutL(); + + /** + * Test that it is possible to cancel + * an outstanding request, and that the request is not logged + * in the request log + */ + void TestCancelL(); + + void TestOptionL(); + + private: + }; + +#endif // __CT_LBS_CLIENT_POS_TP178_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp179.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp179.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP179_H__ +#define __CT_LBS_CLIENT_POS_TP179_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CONSTANTS + +// CLASS DECLARATION + +/** +* Test procedure 179 +* +*/ +class CT_LbsClientPosTp179 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp179(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp179(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Called after the tests + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + }; + +#endif // __CT_LBS_CLIENT_POS_TP179_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp188.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp188.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP188_H__ +#define __CT_LBS_CLIENT_POS_TP188_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CONSTANTS + +// CLASS DECLARATION + +/** +* Test procedure 188 +* +*/ +class CT_LbsClientPosTp188 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp188(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp188(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: // New functions + + /** + * Prints the current Module status to log and compare it + * to iModuleStatus + * + * @param aStatus The current status reported to write to log + */ + void CheckModuleStatusL( + /* IN */ const TPositionModuleStatus& aStatus + ); + + private: + TPositionModuleStatus iModuleStatus; + + }; + +#endif // __CT_LBS_CLIENT_POS_TP188_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp189.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp189.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP189_H__ +#define __CT_LBS_CLIENT_POS_TP189_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CONSTANTS + +// CLASS DECLARATION + +/** +* Test procedure 189 +* +*/ +class CT_LbsClientPosTp189 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp189(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp189(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: // New functions + + /** + * Prints the current Module status to log + * @param aStatus The current status reported to write to log + */ + void CheckModuleStatusL( + /* IN */ const TPositionModuleStatus& aStatus, + /* IN */ const TBool aCheckStatus = EFalse + ); + + /** + * Requests to be notified about certain events, wait for that event + * and log the event + * @param aEventToListenFor The event to listen for (EEventDataQualityStatus/EEventDeviceStatus) + */ + void RequestWaitAndLogEventL( + /* IN */ const TInt aEventToListenFor + ); + + private: // Data + + RPositioner iPositioner2; + TPositionModuleStatus iExpectedStatus; + }; + +#endif // __CT_LBS_CLIENT_POS_TP189_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp193.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp193.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP193_H__ +#define __CT_LBS_CLIENT_POS_TP193_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CONSTANTS + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 193 +* +*/ +class CT_LbsClientPosTp193 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp193(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp193(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Called after the tests + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP193_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp194.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp194.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP194_H__ +#define __CT_LBS_CLIENT_POS_TP194_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATION + +// CLASS DECLARATION + +/** +* Test procedure 194 +* +*/ +class CT_LbsClientPosTp194 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp194(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp194(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + */ + void StartL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP194_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp195.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp195.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP195_H__ +#define __CT_LBS_CLIENT_POS_TP195_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATION + +// CLASS DECLARATION + +/** +* Test procedure 195 +* +*/ +class CT_LbsClientPosTp195 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp195(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp195(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + */ + void StartL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP195_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp2.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP2_H__ +#define __CT_LBS_CLIENT_POS_TP2_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATIONS +class TPositionSatelliteInfo; + +// CLASS DECLARATION + +/** +* Test procedure 2 +* +*/ +class CT_LbsClientPosTp2 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp2(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp2(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: // New functions + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueL(TBool aCondition, const TDesC& aErrorMsg); + + void RequestL(TPositionInfoBase& aInfoBase); + + void CheckPositionL(TPosition& aPosition); + + void CheckPositionInfoL(TPositionInfo& aInfo); + void CheckPositionCourseInfoL(TPositionCourseInfo& aInfo); + void CheckPositionSatelliteInfoL(TPositionSatelliteInfo& aInfo); + void CheckGenericInfoL(HPositionGenericInfo& aInfo); + + }; + +#endif // __CT_LBS_CLIENT_POS_TP2_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp201.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp201.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP201_H__ +#define __CT_LBS_CLIENT_POS_TP201_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATION + +// CLASS DECLARATION + +/** +* Test procedure 201 +* +*/ +class CT_LbsClientPosTp201 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp201(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp201(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + */ + void StartL(); + + private: + void CheckRequestResultL(TInt aExpectedErrorCode, TRequestStatus& aStatus); + }; + +#endif // __CT_LBS_CLIENT_POS_TP201_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp203.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp203.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP203_H__ +#define __CT_LBS_CLIENT_POS_TP203_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" +#include "mctlbsrequestobserver.h" + +// CLASS DECLARATION + +/** +* Test procedure 203 +* +*/ +class CT_LbsClientPosTp203 : public CT_LbsPortedStepBase, public MCT_LbsRequestObserver + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp203(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp203(); + + public: // Functions from base classes + + static TInt DisablePsyL(TAny* aSelf); + + /** + * From CT_LbsPortedStepBase + * Deinitializes the test. + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + */ + void StartL(); + + /** + * From MCT_LbsRequestObserver + * Called when a CRequester request has completed. + */ + void RequestCompleteL(); + + private: // Data + + CPeriodic* iPeriodicTimer; + }; + +#endif // __CT_LBS_CLIENT_POS_TP203_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp204.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp204.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP204_H__ +#define __CT_LBS_CLIENT_POS_TP204_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" +#include "mctlbsrequestobserver.h" + +// FORWARD DECLARATIONS +class CBaBackupSessionWrapper; + +// CLASS DECLARATION + +/** +* Test procedure 204 +* +*/ +class CT_LbsClientPosTp204 : public CT_LbsPortedStepBase, public MCT_LbsRequestObserver + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp204(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp204(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From MCT_LbsRequestObserver + * Called when a CT_LbsRequester request has completed. + */ + void RequestCompleteL(); + + /** + * From CT_LbsPortedStepBase + * Called after the tests + */ + void CloseTest(); + + private: // New functions + + private: + RPositionServer iPosServer1; + RPositioner iPositioner1; + CPeriodic* iPeriodicTimer; + CBaBackupSessionWrapper* iBackupWrapper; + TInt iCompletedRequests; + }; + +#endif // __CT_LBS_CLIENT_POS_TP204_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp208.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp208.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP208_H__ +#define __CT_LBS_CLIENT_POS_TP208_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CONSTANTS + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 208 +* +*/ +class CT_LbsClientPosTp208 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp208(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp208(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Called after the tests + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + protected: // New functions + + /** + * + * Starts nr of threads all connecting to the + * Epos server. If aFullTest also does + * a number of position requests + */ + TInt StartThreads(TBool aFullTest); + + /** + *Fast connection only connects to epos no + *tracing no nothing. Verification of EJSH-5WJG82 + */ + TInt DoFastConnectionL(); + + private: + + TInt iThreadCount; + + }; + +#endif // __CT_LBS_CLIENT_POS_TP208_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp21.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp21.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP21_H__ +#define __CT_LBS_CLIENT_POS_TP21_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CONSTANTS + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 21 +* +*/ +class CT_LbsClientPosTp21 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp21(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp21(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Called after the tests + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: + + /** + * Setup privacy and notification override settings + * @param aPsyUid the uid of the psy + * @param aDirective how to setup the PSY:s + * Enum def in this file. + */ + void SetupPsyL(const TUid aPsyUid, + TBool aChoice); + + }; + +#endif // __CT_LBS_CLIENT_POS_TP21_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp213.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp213.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP213_H__ +#define __CT_LBS_CLIENT_POS_TP213_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" +#include "mctlbsrequestobserver.h" + +// CONSTANTS + +// FORWARD DECLARATION +class CT_LbsClientRequestor; +class CT_LbsClientEventTimer; +class CPosModules; + +// CLASS DECLARATION + +/** +* Test procedure 213 +* +*/ +class CT_LbsClientPosTp213 : public CT_LbsPortedStepBase, public MCT_LbsRequestObserver + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp213(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp213(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Called after the tests + */ + void CloseTest(); + + /** + * From MCT_LbsRequestObserver + * Called when a CRequester request has completed. + */ + void RequestCompleteL(); + + private: + + void EnablePsyL( + CPosModules& aDb, + TUid aPsy); + + + void DisablePsyL( + CPosModules& aDb, + TUid aPsy); + + private: + + void CheckRequestResultL(TInt aExpectedErrorCode, TRequestStatus& aStatus); + + CT_LbsClientRequestor* iclient1; + CT_LbsClientRequestor* iclient2; + CT_LbsClientRequestor* iclient3; + CT_LbsClientEventTimer* ieventtimer; + TInt iCompletedRequests; + TBool iNoFurtherEvents; + TBool iErrorDuringExecution; + }; + +#endif // __CT_LBS_CLIENT_POS_TP213_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp217.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp217.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP217_H__ +#define __CT_LBS_CLIENT_POS_TP217_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 217 +* +*/ +class CT_LbsClientPosTp217 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp217(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp217(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Deinitializes the test. + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: // New functions + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode); + + /** + * Compares two TPositionInfoBase objects + * @return returns true if equal, otherwise false + */ + TBool ComparePositionL(TPositionInfo aPosInfo1, TPositionInfo aPosInfo2); + + /** + * Test that it is not possible to set erroneous maxage and updateInterval values + */ + void ExtendedTesting1(); + + /** + * Check that it is possible to change MaxAge + * when the positioner already has a value + */ + void ExtendedTesting2(); + + private: + + }; + +#endif // __CT_LBS_CLIENT_POS_TP217_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp218.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp218.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP218_H__ +#define __CT_LBS_CLIENT_POS_TP218_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 218 +* +*/ +class CT_LbsClientPosTp218 :public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp218(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp218(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Deinitializes the test. + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: // New functions + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode); + + /** + * Compares two TPositionInfoBase objects + * @return returns true if equal, otherwise false + */ + TBool ComparePositionL(TPositionInfo aPosInfo1, TPositionInfo aPosInfo2); + + /* + * Setup the choosen default Psy + */ + void SetupDefaultPsyL(const TUid aPsyUid); + + private: + + RPositioner iPositioner1; + RPositioner iPositioner2; + + }; + +#endif // __CT_LBS_CLIENT_POS_TP218_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp22.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp22.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP22_H__ +#define __CT_LBS_CLIENT_POS_TP22_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATION +class CT_LbsClientPeriodicTester; + +// CLASS DECLARATION + +/** +* Test procedure 22 +* +*/ +class CT_LbsClientPosTp22 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp22(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp22(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Called at close down of test + */ + void CloseTest(); + + private: // Data + RArray iRequestArray; + CT_LbsClientPeriodicTester* iPeriodicTester1; + CT_LbsClientPeriodicTester* iPeriodicTester2; + + }; + +#endif // __CT_LBS_CLIENT_POS_TP22_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp222.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp222.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP222_H__ +#define __CT_LBS_CLIENT_POS_TP222_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 222 +* +*/ +class CT_LbsClientPosTp222 :public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp222(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp222(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Deinitializes the test. + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: // New functions + + }; + +#endif // __CT_LBS_CLIENT_POS_TP222_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp223.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp223.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP223_H__ +#define __CT_LBS_CLIENT_POS_TP223_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 223 +* +*/ +class CT_LbsClientPosTp223 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp223(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp223(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: // New functions + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode); + }; + +#endif // __CT_LBS_CLIENT_POS_TP223_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp224.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp224.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP224_H__ +#define __CT_LBS_CLIENT_POS_TP224_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 224 +* +*/ +class CT_LbsClientPosTp224 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp224(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp224(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Deinitializes the test. + */ + void CloseTest(); + + private: // New functions + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode); + + RPositionServer iServer; + RPositioner iPositioner; + RPositioner iPositioner2; + + }; + +#endif // __CT_LBS_CLIENT_POS_TP224_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp227.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp227.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP227_H__ +#define __CT_LBS_CLIENT_POS_TP227_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 227 +* +*/ +class CT_LbsClientPosTp227 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp227(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp227(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Deinitializes the test. + */ + void CloseTest(); + + private: // New functions + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueL(TBool aCondition, const TDesC& aErrorMsg); + + }; + +#endif // __CT_LBS_CLIENT_POS_TP227_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp25.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp25.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP25_H__ +#define __CT_LBS_CLIENT_POS_TP25_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" +#include "mctlbsrequestobserver.h" + +// FORWARD DECLARATIONS +class CT_LbsRequester; + +// CLASS DECLARATION + +/** +* Test procedure 25 +* +*/ +class CT_LbsClientPosTp25 : public CT_LbsPortedStepBase, public MCT_LbsRequestObserver + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp25(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp25(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From MCT_LbsRequestObserver + * Called when a CT_LbsRequester request has completed. + */ + void RequestCompleteL(); + + private: // New functions + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueL(TBool aCondition, const TDesC& aErrorMsg); + + private: // Data + + CT_LbsRequester* iFastPsy; + CT_LbsRequester* iMediumPsy; + CT_LbsRequester* iSlowPsy; + TInt iCompletedRequests; + }; + +#endif // __CT_LBS_CLIENT_POS_TP25_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp254.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp254.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP254_H__ +#define __CT_LBS_CLIENT_POS_TP254_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATION +class CPosRequestLog; + +// CLASS DECLARATION + +/** +* Test procedure 254 +* +*/ +class CT_LbsClientPosTp254 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp254(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp254(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Deinitializes the test. + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + */ + void StartL(); + + private: // New functions + + /** + * Deletes a file from the file system + * @param aFile the file name + */ + void DeleteFileL(const TDesC& aFile); + + /** + * Check if the specified file exists + * @param aFile the file name + */ + TBool FileExistsL(const TDesC& aFile); + + void CheckPositionL(TPosition& aPosition, TPosition& aLastPosition); + + void CheckPositionInfoL(TPositionInfo& aInfo, TPositionInfo& aLastInfo); + }; + +#endif // __CT_LBS_CLIENT_POS_TP254_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp256.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp256.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP256_H__ +#define __CT_LBS_CLIENT_POS_TP256_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 256 +*/ +class CT_LbsClientPosTp256 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp256(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp256(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void CreateThreadsL(); + void RequestL(TPositionInfoBase& aInfoBase); + + private: // data + + RArray iThreads; + RPointerArray iNames; + }; + +#endif // __CT_LBS_CLIENT_POS_TP256_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp257.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp257.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP257_H__ +#define __CT_LBS_CLIENT_POS_TP257_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 257 +* +*/ +class CT_LbsClientPosTp257 :public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp257(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp257(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Deinitializes the test. + * Always called even if test leaves. + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + */ + void StartL(); + + private: // New functions + + /** + * Compares two TPositionInfoBase objects + * @return returns true if equal, otherwise false + */ + TBool ComparePositionL(TPositionInfo aPosInfo1, TPositionInfo aPosInfo2); + + /** + * Deletes a file from the file system + * @param aFile the file name + */ + void DeleteFileL(const TDesC& aFile); + + /** + * Check if the specified file exists + * @param aFile the file name + */ + TBool FileExistsL(const TDesC& aFile); + + }; + +#endif // __CT_LBS_CLIENT_POS_TP257_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp259.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp259.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP259_H__ +#define __CT_LBS_CLIENT_POS_TP259_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 259 +* +*/ +class CT_LbsClientPosTp259 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp259(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp259(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Deinitializes the test. + * Always called even if test leaves. + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + */ + void StartL(); + + private: // New functions + + /** + * First call the RPosServer::CancelRequest method with inparameter + * EPositionerNotifyPositionUpdate and then call the RPositioner::CancelRequest + * method with EPositionServerNotifyModuleStatusEvent + */ + void TestPart1L(); + + /** + * Test some cases not included in TestPart1L + */ + void TestPart2L(); + + }; + +#endif // __CT_LBS_CLIENT_POS_TP259_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp261.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp261.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP261_H__ +#define __CT_LBS_CLIENT_POS_TP261_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATIONS +class RRequestorStack; + +// CLASS DECLARATION + +/** +* Test procedure 261 +* +*/ +class CT_LbsClientPosTp261 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp261(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp261(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Deinitializes the test. + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: // New functions + + void VerifyRequestorStackL(RRequestorStack& aStack); + + }; + +#endif // __CT_LBS_CLIENT_POS_TP261_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp269.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp269.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP269_H__ +#define __CT_LBS_CLIENT_POS_TP269_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 269 +*/ +class CT_LbsClientPosTp269 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp269(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp269(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void SetupProxyPSYsL(); + + void AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode=KErrGeneral); + + private: // data + + }; + +#endif // __CT_LBS_CLIENT_POS_TP269_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp27.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp27.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP27_H__ +#define __CT_LBS_CLIENT_POS_TP27_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CONSTANTS + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 27 +* +*/ +class CT_LbsClientPosTp27 :public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp27(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp27(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Called after the tests + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: + + /** + * Cancel a position request using the dialog plugin + * (The request does not reach the PSY since the dialog plugin waits for a cancell call + */ + void MakeCancelRequestL(TTimeIntervalMicroSeconds32 aCancelTime, TTimeIntervalMicroSeconds aTimeLimit); + + /** + * Perform a position request while cancelling two other + * notification requests and make sure that Epos does not hang! + * Using a "slow" psy assures that the position request has reached the Psy + */ + void MakeCancelRequest2L(TTimeIntervalMicroSeconds32 aCancelTime, TTimeIntervalMicroSeconds aTimeLimit); + + /** + * Check that a request that is cancelled when + * the request has reached the PSY is logged in the requestlog. + */ + void CheckCancelRequestL(); + + /** + * Enables the specified PSY, does NOT disable any + */ + void EnablePsyL(const TUid aPsyUid); + + /** + * Disables all Psys + */ + void DisableAllPsyL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP27_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp271.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp271.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP271_H__ +#define __CT_LBS_CLIENT_POS_TP271_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 271 +*/ +class CT_LbsClientPosTp271 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp271(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp271(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void SetupProxyPSYsL(); + + void AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode=KErrGeneral); + + void VerifyPsyStartedTrackingL(TPositionModuleId& aUid); + + void VerifyPsyStoppedTrackingL(TPositionModuleId& aUid, TRequestStatus& aStatus); + + void VerifyPsyStoppedTrackingL(TPositionModuleId& aUid); + + private: // data + + TPositionModuleStatusEvent iModuleEvent; + + TRequestStatus iEventStatus; + }; + +#endif // __CT_LBS_CLIENT_POS_TP271_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp272.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp272.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP272_H__ +#define __CT_LBS_CLIENT_POS_TP272_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 272 +*/ +class CT_LbsClientPosTp272 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp272(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp272(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void RequestL(const TInt& aRequestIndex, + const TInt64& aMinTimeLimit, + const TInt64& aMaxTimeLimit, + const TInt& aPeriodicUpdateInterval=0); + + void SetPeriodicUpdateL(const TInt& aUpdateInterval); + + void AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode=KErrGeneral); + + private: // data + + }; + +#endif // __CT_LBS_CLIENT_POS_TP272_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp274.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp274.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP274_H__ +#define __CT_LBS_CLIENT_POS_TP274_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 274 +*/ +class CT_LbsClientPosTp274 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp274(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp274(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + }; + +#endif // __CT_LBS_CLIENT_POS_TP274_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp275.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp275.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP275_H__ +#define __CT_LBS_CLIENT_POS_TP275_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 275 +* +*/ +class CT_LbsClientPosTp275 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp275(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp275(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Deinitializes the test. + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + }; + +#endif // __CT_LBS_CLIENT_POS_TP275_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4701.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4701.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP4701_H__ +#define __CT_LBS_CLIENT_POS_TP4701_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 4701 +*/ +class CT_LbsClientPosTp4701 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + CT_LbsClientPosTp4701(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp4701(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void SetupProxyPSYsL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP4701_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4702.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4702.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP4702_H__ +#define __CT_LBS_CLIENT_POS_TP4702_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 4702 +*/ +class CT_LbsClientPosTp4702 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp4702(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp4702(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void SetupProxyPSYsL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP4702_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4703.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4703.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP4703_H__ +#define __CT_LBS_CLIENT_POS_TP4703_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 4703 +*/ +class CT_LbsClientPosTp4703 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp4703(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp4703(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void SetupProxyPSYsL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP4703_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4704.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4704.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP4704_H__ +#define __CT_LBS_CLIENT_POS_TP4704_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 4704 +*/ +class CT_LbsClientPosTp4704 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp4704(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp4704(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void SetupProxyPSYsL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP4704_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4705.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4705.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP4705_H__ +#define __CT_LBS_CLIENT_POS_TP4705_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 4705 +*/ +class CT_LbsClientPosTp4705 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp4705(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp4705(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void SetupProxyPSYsL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP4705_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4706.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4706.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP4706_H__ +#define __CT_LBS_CLIENT_POS_TP4706_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 4706 +*/ +class CT_LbsClientPosTp4706 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp4706(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp4706(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void SetupProxyPSYsL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP4706_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4707.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4707.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP4707_H__ +#define __CT_LBS_CLIENT_POS_TP4707_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 4707 +*/ +class CT_LbsClientPosTp4707 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp4707(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp4707(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void SetupProxyPSYsL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP4707_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4708.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4708.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP4708_H__ +#define __CT_LBS_CLIENT_POS_TP4708_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 4708 +*/ +class CT_LbsClientPosTp4708 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp4708(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp4708(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void SetupProxyPSYsL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP4708_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4709.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4709.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP4709_H__ +#define __CT_LBS_CLIENT_POS_TP4709_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 4709 +*/ +class CT_LbsClientPosTp4709 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp4709(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp4709(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void SetupProxyPSYsL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP4709_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4722.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4722.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP4722_H__ +#define __CT_LBS_CLIENT_POS_TP4722_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 4722 +*/ +class CT_LbsClientPosTp4722 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + CT_LbsClientPosTp4722(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp4722(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void SetupProxyPSYsL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP4722_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4723.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp4723.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP4723_H__ +#define __CT_LBS_CLIENT_POS_TP4723_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// CLASS DECLARATION + +/** +* Test procedure 4723 +*/ +class CT_LbsClientPosTp4723 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp4723(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp4723(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + /** + * From CT_LbsPortedStepBase + * Always called, even if the test leaves + */ + void CloseTest(); + + private: // Functions + + void SetupProxyPSYsL(); + }; + +#endif // __CT_LBS_CLIENT_POS_TP4723_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp76.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp76.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + +#ifndef __CT_LBS_CLIENT_POS_TP76_H__ +#define __CT_LBS_CLIENT_POS_TP76_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Test procedure 76 +* +*/ +class CT_LbsClientPosTp76 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp76(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp76(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Runs the test in the module + */ + void StartL(); + + private: // New functions + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueL(TBool aCondition, const TDesC& errorMsg); + + /** + * Leaves if aCondition is false. + * @param aCondition something that should be true + */ + void AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode); + + void CheckModuleInfoL(const TPositionModuleInfo& dbInfo, + const TPositionModuleInfo& clientInfo); + + }; + +#endif // __CT_LBS_CLIENT_POS_TP76_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp93.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientpostp93.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CT_LBS_CLIENT_POS_TP93_H__ +#define __CT_LBS_CLIENT_POS_TP93_H__ + +// INCLUDES +#include "ctlbsportedstepbase.h" + + +// CLASS DECLARATION + +/** +* Test procedure 93 +* +*/ +class CT_LbsClientPosTp93 : public CT_LbsPortedStepBase + { + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + CT_LbsClientPosTp93(CT_LbsServer& aParent); + + /** + * Destructor. + */ + ~CT_LbsClientPosTp93(); + + public: // Functions from base classes + + /** + * From CT_LbsPortedStepBase + * Deinitializes the test. Always called, even if test leaves. + */ + void CloseTest(); + + /** + * From CT_LbsPortedStepBase + */ + void StartL(); + + private: + RArray iRequestArray; + RArray iNameArray; + }; + +#endif // __CT_LBS_CLIENT_POS_TP93_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientserver.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,46 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsClientServer.h +// This contains the header file for LBS Client Test server +// +// + +#ifndef __CT_LBS_CLIENT_SERVER_H__ +#define __CT_LBS_CLIENT_SERVER_H__ + +// System includes + +// User includes +#include "ctlbsserver.h" +#include "ctlbsshareddata.h" + + +_LIT(KLbsClientTestServer,"LbsClientTestServer"); + + +// Implements the LBS Client Test server +class CT_LbsClientServer : public CT_LbsServer + { +public : + static CT_LbsClientServer* NewL(); + // Creates the test steps based on the test step name + virtual CTestStep* CreateTestStep(const TDesC& aStepName); + ~CT_LbsClientServer(); + CT_LbsClientServer(); + +protected: + void ConstructL(const TDesC& aName); + }; + +#endif //__CT_LBS_CLIENT_SERVER_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientshareddata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientshareddata.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,58 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsClientSharedData.h +// This contains the header file for CT_LbsClientSharedData +// +// + + +#ifndef __CT_LBS_CLIENT_SHARED_DATA_H__ +#define __CT_LBS_CLIENT_SHARED_DATA_H__ + +// system includes +#include + +// Lbs includes +#include +#include + + +class CT_LbsClientSharedData : public CBase +{ +public: + static CT_LbsClientSharedData* NewL(); + CT_LbsClientSharedData(); + ~CT_LbsClientSharedData(); + +private: + void ConstructL(); + +public: + RPointerArray iVerifyPosInfoArr; + RPointerArray iCurrentPosInfoArr; + + TPositionModuleInfo iVerifyModuleInfo; + TPositionModuleInfo iCurrentModuleInfo; + + TPositionModuleStatus iVerifyModuleStatus; + TPositionModuleStatus iCurrentModuleStatus; + + TPositionModuleStatusEvent iVerifyModuleStatusEvent; + TPositionModuleStatusEvent iCurrentModuleStatusEvent; + + TPositionUpdateOptions iVerifyUpdateOpts; + TPositionUpdateOptions iCurrentUpdateOpts; +}; + +#endif // __CT_LBS_CLIENT_SHARED_DATA_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstep.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstep.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,85 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsClientStep.h +// This contains the header file for LBS Client Test Step Base +// +// + +#ifndef __CT_LBS_CLIENT_STEP_H__ +#define __CT_LBS_CLIENT_STEP_H__ + +#include +#include +#include + +#include "ctlbsclientserver.h" + +//todo: is this a sensible place to put this as it's used by many teststeps? +const TTimeIntervalMicroSeconds32 delay10Seconds = 10000000; + + +class CT_LbsClientStep : public CTestStep +{ + +public: + virtual ~CT_LbsClientStep(); + + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepPostambleL(); + +protected: + CT_LbsClientStep(CT_LbsClientServer& aParent); + + + // Carryout a notify position update. + // Must have a connect server, and a open positioner + // also the pos info array is appened to + TInt DoNotifyUpdateL(TPositionInfoBase& aPosInfo); + + TInt DoLastKnownPosL(TPositionInfoBase& aPosInfo); + + TInt OpenNetSim(); + void SendResetAssistanceData(TLbsAssistanceDataGroup aMask); + void CloseNetSim(); + + CT_LbsClientServer& iParent; + + RPositionServer iServer; + RPositioner iPositioner; + + /** Net sim required for tests which invoke assistance data via AGPS module. */ + RLbsNetSimTest iNetSim; + + /** Reference position used to setup Net sim and later verification. */ + TPosition iRefPos; + + +private: + /** + Position call types - used by GetLocation() to determine which position update function to call + + */ + enum _TPositionUpdateType + { + /** EDoNotifyPosUpdate - call NotifyPositionUpdate */ + EDoNotifyPosUpdate = 0, + /** EDoLastKnownPos - call GetLastKnownPosition */ + EDoLastKnownPos = 0x01 + }; + + TInt GetLocationL(TPositionInfoBase& aPosInfo, TUint32 aNotifyCallType); + +}; + +#endif // __CT_LBS_CLIENT_STEP_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstep_reset_assistance.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstep_reset_assistance.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,60 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstep_reset_assistance.h +// +// + +#ifndef __CT_LBS_CLIENT_STEP_RESET_ASSISTANCE_H__ +#define __CT_LBS_CLIENT_STEP_RESET_ASSISTANCE_H__ + +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" +#include "ctlbsclientnotifyposupdao.h" +#include + +// Literals used +_LIT(KLbsClientStep_ResetAssistance, "LbsClientStep_ResetAssistance"); + + + +class CT_LbsClientStep_ResetAssistance : public CT_LbsClientStep, MT_NotifyPosUpdateObserver + { +public: + ~CT_LbsClientStep_ResetAssistance(); + + static CT_LbsClientStep_ResetAssistance* New(CT_LbsClientServer& aParent); + virtual TVerdict doTestStepL(); + + void NotifyPositionUpdateCallback(TRequestStatus& aStatus); + + +private: + CT_LbsClientStep_ResetAssistance(CT_LbsClientServer& aParent); + + void ConstructL(); + void TempSetRequestorL(); + TInt64 DoRequests(TBool aCold, TBool aReset); + + +private: + + // To allow changing admin settings. + CLbsAdmin* iLbsAdmin; + + TBool iRequestedAssData; + TBool iReceivedAssData; + + }; + +#endif //__CT_LBS_CLIENT_STEP_RESET_ASSISTANCE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepassistance.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepassistance.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,89 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepassistance.h +// This contains the header file for assistance data Tests +// +// + +#ifndef __CT_LBS_CLIENT_STEP_ASSISTANCE_H__ +#define __CT_LBS_CLIENT_STEP_ASSISTANCE_H__ + +#include +//Lbs test include +#include "ctlbsnetsimstep.h" +#include "ctlbsdoposupdate.h" +#include "ctlbsclientserver.h" + +// Literals used +_LIT(KLbsClientStep_Assistance, "LbsClientStep_Assistance"); + +// Callbacks flags. +const TLbsCallbackFlags KLbsCallback_Got_NotifyUpdate = 0x1000; + +class CT_LbsClientStep_Assistance : public CT_LbsNetSimStep, + MT_LbsDoPosUpdateObserver + + { + +public: + ~CT_LbsClientStep_Assistance(); + + static CT_LbsClientStep_Assistance* New(CT_LbsClientServer& aParent); + virtual TVerdict doTestStepL(); + + // From CT_LbsNetSimStep via CT_LbsAssDataStep + void Connected(); + void Disconnected(); + void NotifyRegisterLcsMoLr(const TDesC& aData); + void NotifyReleaseLcsMoLr(TInt aReason); + void NotifyMeasurementControlLocation(const TPositionInfo& aPosition, const RLbsAssistanceDataBuilderSet& aData, const TLbsNetPosRequestQuality& aQuality); + //void NotifyReleaseLcsLocationNotification(const CLbsNetworkProtocolBase::TLbsPrivacyResponse& aResult); + void NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition); + void NotifyMeasurementReportLocation(const TPositionInfo& aPosition); + void NotifyMeasurementReportRequestMoreAssistanceData(const TLbsAssistanceDataGroup& aFilter); + void NotifyMeasurementReportControlFailure(TInt aReason); + + // From MT_LbsDoPosUpdateObserver - Position notify update callback. + void MT_LbsDoPosUpdateCallback(TRequestStatus& aStatus); + +private: + + CT_LbsClientStep_Assistance(CT_LbsClientServer& aParent); + void ConstructL(); + + + enum { EStartMTLRPrivReq = CT_LbsNetSimStep::ELast, + EStartMTLRLocReq}; + + + CT_LbsClientServer& iParent; + + /** Current test case being executed. + */ + TInt iTestCaseId; + + // to allow changing admin settings: + CLbsAdmin* iLbsAdmin; + + /** Active object wrapper to allow MO-LRs. + */ + CT_LbsDoPosUpdate* iDoPosUpdate; + + /** Used to monitor the number of assistance data events we receviced during a test. + */ + TUint iAssEventCount; + + }; + +#endif //__CT_LBS_CLIENT_STEP_ASSISTANCE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepcellbasednpud.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepcellbasednpud.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,92 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepcellbasednpud.h +// This contains the header file for Notify Position Update Tests +// +// + +#ifndef __CT_LBS_CLIENT_STEP_CELLBASED_NOTIFY_POS_UPDATE_H__ +#define __CT_LBS_CLIENT_STEP_CELLBASED_NOTIFY_POS_UPDATE_H__ + +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" +#include "ctlbsclientnotifyposupdao.h" +#include "ctlbsnetsimstep.h" +#include "ctlbsdoposupdate.h" + +#include +#include + +// Literals used +_LIT(KLbsClientStep_CellBasedNotifyPosUpdate, "LbsClientStep_CellBasedNotifyPosUpdate"); + +const TLbsCallbackFlags KLbsCallback_Got_NotifyPositionUpdate = 0x1000; + +class CT_LbsClientStep_CellBasedNotifyPosUpdate : public CT_LbsNetSimStep, + public MT_LbsDoPosUpdateObserver + { +public: + ~CT_LbsClientStep_CellBasedNotifyPosUpdate(); + + static CT_LbsClientStep_CellBasedNotifyPosUpdate* New(CT_LbsClientServer& aParent); + virtual TVerdict doTestStepL(); + + // From CT_LbsNetSimStep: + void Connected(); + void Disconnected(); + void NotifyRegisterLcsMoLr(const TDesC& aData); + void NotifyReleaseLcsMoLr(TInt aReason); + void NotifyMeasurementControlLocation(const TPositionInfo& aPosition, const RLbsAssistanceDataBuilderSet& aData, const TLbsNetPosRequestQuality& aQuality); + void NotifyReleaseLcsLocationNotification(const CLbsNetworkProtocolBase::TLbsPrivacyResponse& aResult); + void NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition); + void NotifyMeasurementReportLocation(const TPositionInfo& aPosition); + void NotifyMeasurementReportRequestMoreAssistanceData(const TLbsAssistanceDataGroup& aFilter); + void NotifyMeasurementReportControlFailure(TInt aReason); + void NotifyError(MLbsNetSimTestObserver::EFunction aFunction, int aError); + void ProcessMeasurementControlLocationError(TInt aError); + + + // From MT_LbsDoPosUpdateObserver: + void MT_LbsDoPosUpdateCallback(TRequestStatus& aStatus); + + +private: + CT_LbsClientStep_CellBasedNotifyPosUpdate(CT_LbsClientServer& aParent); + + void ConstructL(); + +private: + + // whether the network should be available + TBool iNetworkUnavailable; + + // whether (and when) the request should be cancelled + TBool iCancel; + TBool iCancelBeforePosUpdate; + TBool iCancelOnPosUpdate; + TBool iIsCancelTest; + TBool iMultiReq; + + // to allow us to set a ref location in NetSim for network-based updates and monitor network: + RLbsNetSimTest iNetSim; + + CT_LbsClientServer& iParent; + + CT_LbsDoPosUpdate* iDoPosUpdate; + + // Number of NotifyPositionUpdates the test case should do + TUint iNumNPUDs; + }; + +#endif //__CT_LBS_CLIENT_STEP_CELLBASED_NOTIFY_POS_UPDATE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepignoreaccurracysetting.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepignoreaccurracysetting.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,47 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepignoreaccurracysetting.h +// +// + +#ifndef __CT_LBS_CLIENT_STEP_IGNORE_ACCURACY_SETTING_H__ +#define __CT_LBS_CLIENT_STEP_IGNORE_ACCURACY_SETTING_H__ + +#include +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" + +#include + +// Literals used +_LIT(KLbsClientStep_IgnoreAccuracySetting, "LbsClientStep_IgnoreAccuracySetting"); + +class CT_LbsClientStep_IgnoreAccuracySetting : public CT_LbsClientStep + { +public: + ~CT_LbsClientStep_IgnoreAccuracySetting(); + + static CT_LbsClientStep_IgnoreAccuracySetting* New(CT_LbsClientServer& aParent); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + +private: + CT_LbsClientStep_IgnoreAccuracySetting(CT_LbsClientServer& aParent); + void ConstructL(); + +private: + TInt iTestCaseId; + }; + +#endif //__CT_LBS_CLIENT_STEP_IGNORE_ACCURACY_SETTING_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepignoreaccurracysettingtracking.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepignoreaccurracysettingtracking.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,48 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepignoreaccurracysettingtracking.h +// +// + +#ifndef __CT_LBS_CLIENT_STEP_IGNORE_ACCURACY_SETTING_TRACKING_H__ +#define __CT_LBS_CLIENT_STEP_IGNORE_ACCURACY_SETTING_TRACKING_H__ + +#include +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" + +#include + +// Literals used +_LIT(KLbsClientStep_IgnoreAccuracySettingTracking, "LbsClientStep_IgnoreAccuracySettingTracking"); + +class CT_LbsClientStep_IgnoreAccuracySettingTracking : public CT_LbsClientStep + { +public: + ~CT_LbsClientStep_IgnoreAccuracySettingTracking(); + + static CT_LbsClientStep_IgnoreAccuracySettingTracking* New(CT_LbsClientServer& aParent); + virtual TVerdict doTestStepPreambleL(); + virtual TVerdict doTestStepL(); + +private: + CT_LbsClientStep_IgnoreAccuracySettingTracking(CT_LbsClientServer& aParent); + void ConstructL(); + +private: + TInt iTestCaseId; + RPointerArray iExpectedUpdateArray; + }; + +#endif //__CT_LBS_CLIENT_STEP_IGNORE_ACCURACY_SETTING_TRACKING_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientsteplastknownpos.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientsteplastknownpos.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,41 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientsteplastknownpos.h +// This contains the header file for Last Known Position Tests +// +// + +#ifndef __CT_LBS_CLIENT_STEP_LAST_KNOWN_POS_H__ +#define __CT_LBS_CLIENT_STEP_LAST_KNOWN_POS_H__ + +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" + +// Literals used +_LIT(KLbsClientStep_LastKnownPos, "LbsClientStep_LastKnownPos"); + +class CT_LbsClientStep_LastKnownPos : public CT_LbsClientStep + { +public: + ~CT_LbsClientStep_LastKnownPos(); + + static CT_LbsClientStep_LastKnownPos* New(CT_LbsClientServer& aParent); + virtual TVerdict doTestStepL(); + void SwitchOnselfLocateAPIL(); + +private: + CT_LbsClientStep_LastKnownPos(CT_LbsClientServer& aParent); + }; + +#endif //__CT_LBS_CLIENT_STEP_LAST_KNOWN_POS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepmodinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepmodinfo.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,40 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepmodinfo.h +// This contains the header file for Module Information Tests +// +// + +#ifndef __CT_LBS_CLIENT_STEP_MOD_INFO_H__ +#define __CT_LBS_CLIENT_STEP_MOD_INFO_H__ + +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" + +// Literals used +_LIT(KLbsClientStep_ModInfo, "LbsClientStep_ModInfo"); + +class CT_LbsClientStep_ModInfo : public CT_LbsClientStep + { +public: + ~CT_LbsClientStep_ModInfo(); + + static CT_LbsClientStep_ModInfo* New(CT_LbsClientServer& aParent); + virtual TVerdict doTestStepL(); + +private: + CT_LbsClientStep_ModInfo(CT_LbsClientServer& aParent); + }; + +#endif //__CT_LBS_CLIENT_STEP_MOD_INFO_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepmodselect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepmodselect.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,73 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepmodselect.h +// This contains the header file for Capability Tests +// +// + +#ifndef __CT_LBS_CLIENT_STEP_MODSELECT_H__ +#define __CT_LBS_CLIENT_STEP_MODSELECT_H__ + +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" +#include + +// Literals used +_LIT(KLbsClientStep_ModSelect, "LbsClientStep_ModSelect"); + +class CT_LbsClientStep_ModSelect : public CT_LbsClientStep + { +public: + ~CT_LbsClientStep_ModSelect(); + + static CT_LbsClientStep_ModSelect* New(CT_LbsClientServer& aParent); + + virtual TVerdict doTestStepL(); + +private: + CT_LbsClientStep_ModSelect(CT_LbsClientServer& aParent); + + enum TModuleType + { + ERandomModule, + EAGPSModule, + ENetworkModule + }; + enum TOpenSesstionMethod + { + ENone, + EWithCriteria, + EWithModuleId + }; + + void DoModuleSelectionL(TOpenSesstionMethod aMethod, TModuleType aModuleType); + TInt SetupNetSimL(); + + TInt Blocking_NotifyUpdateL(); + TInt Blocking_NofifyUpdateWithCriteriaL(TPositionCriteria aCriteria); + TInt Blocking_NotifyUpdateWithModuleIdL(TPositionModuleId aModuleId); + TInt Blocking_NotifyUpdateCommonL(); + + TBool VerifyLastModuleIdWasAGpsL(); + TBool VerifyLastModuleIdWasNetworkL(); + + RLbsNetSimTest iNetSim; + + TPositionCriteria iCriteria; // default capability is ECapabilityHorizontal + TPositionQuality iQuality; + TPositionSelectionOrder iSelectOrder; + TPositionModuleId iModuleId; + }; + +#endif //__CT_LBS_CLIENT_STEP_MODSELECT_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepmodstatus.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepmodstatus.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,49 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepmodstatus.h +// This contains the header file for Module Status Tests +// +// + +#ifndef __CT_LBS_CLIENT_STEP_MOD_STAT_H__ +#define __CT_LBS_CLIENT_STEP_MOD_STAT_H__ + +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" + +#include + +// Literals used +_LIT(KLbsClientStep_ModStatus, "LbsClientStep_ModStatus"); + +class CT_LbsClientStep_ModStat : public CT_LbsClientStep + { +public: + ~CT_LbsClientStep_ModStat(); + + static CT_LbsClientStep_ModStat* New(CT_LbsClientServer& aParent); + virtual TVerdict doTestStepL(); + +private: + + TBool DoRequestAndVerifyModStatusEventsL(TPositionModuleStatusEvent::TModuleEvent aReqEventsMask, TPositionModuleStatus& aModStatus, TPositionModuleId aModId /*= KPositionNullModuleId*/); + TBool DoRequestAndVerifyAGPSModStatusEventsL(TPositionModuleStatusEvent::TModuleEvent aReqEventsMask, TPositionModuleStatus& aModStatus); + TInt DoRequestModStatusEventsWithError(TPositionModuleStatusEvent::TModuleEvent aReqEventsMask, TPositionModuleId aModId); + + TBool DoVerifyModStatus(TPositionModuleStatusEvent::TModuleEvent aExpectedModStatus,TPositionModuleId aModId); + + CT_LbsClientStep_ModStat(CT_LbsClientServer& aParent); + }; + +#endif //__CT_LBS_CLIENT_STEP_MOD_STAT_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepmultireq.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepmultireq.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,77 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepmultireq.h +// This contains the header file for multi requests Tests +// +// + +#ifndef __CT_LBS_CLIENT_STEP_MULTIREQ_H__ +#define __CT_LBS_CLIENT_STEP_MULTIREQ_H__ + +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" +#include "ctlbsclientgetlkpao.h" +#include "ctlbsclientnotifyposupdao.h" + + +// Literals used +_LIT(KLbsClientStep_MultiReq, "LbsClientStep_MultiReq"); + +_LIT(KLbsMultiReqTestSuitePanic,"Lbs Multi Requests Test Suite Panic"); + + +class CT_LbsClientStep_MultiReq : public CT_LbsClientStep, public MT_GetLastKnownPosObserver, public MT_NotifyPosUpdateObserver + { +public: + ~CT_LbsClientStep_MultiReq(); + + static CT_LbsClientStep_MultiReq* NewL(CT_LbsClientServer& aParent); + static CT_LbsClientStep_MultiReq* New(CT_LbsClientServer& aParent); + + virtual TVerdict doTestStepL(); + +//from MT_GetLastKnownPosObserver: + virtual void GetLastKnownPositionCallback(TRequestStatus& aStatus); +//from MT_NotifyPosUpdateObserver: + virtual void NotifyPositionUpdateCallback(TRequestStatus& aStatus); +// tidy up (must be public to allow calling through timer callback function) + void CT_LbsClientStep_MultiReq::AsyncTidyUp(); + +private: + + enum TMultiReqState + /** + * states + */ + { + EStateUnknown, /*!< state unknown. */ + EStateLastKnownPositionComplete, /*!< Last Known Position request has completed */ + EStateLastNotifyPositionUpdateComplete, /*!< Notify Position Update request has completed */ + EStateDone /*!< Last Known Position and Position Update requests have both completed */ + }; + TMultiReqState iState; + + CT_LbsClientStep_MultiReq(CT_LbsClientServer& aParent); + + // timer for requests timeouts + CPeriodic* iTimer; + + CT_LbsClientGetLastKnownPosAO* iGetLastKnownPosAO; + CT_LbsClientNotifyPosUpdAO* iNotifyPosUpdateAO; + + TPositionInfo* iTempPosInfo; + + }; + +#endif //__CT_LBS_CLIENT_STEP_MULTIREQ_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepnotifyposupdate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepnotifyposupdate.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,62 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsClientStep_NotifyPosUpdate.h +// This contains the header file for Notify Position Update Tests +// +// + +#ifndef __CT_LBS_CLIENT_STEP_NOTIFY_POS_UPDATE_H__ +#define __CT_LBS_CLIENT_STEP_NOTIFY_POS_UPDATE_H__ + +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" +#include "ctlbsclientnotifyposupdao.h" +#include + +_LIT(KNumPositions, "num_positions"); + +// Literals used +_LIT(KLbsClientStep_NotifyPosUpdate, "LbsClientStep_NotifyPosUpdate"); + + + +class CT_LbsClientStep_NotifyPosUpdate : public CT_LbsClientStep, MT_NotifyPosUpdateObserver + { +public: + ~CT_LbsClientStep_NotifyPosUpdate(); + + static CT_LbsClientStep_NotifyPosUpdate* New(CT_LbsClientServer& aParent); + virtual TVerdict doTestStepL(); + + void NotifyPositionUpdateCallback(TRequestStatus& aStatus); + + +private: + CT_LbsClientStep_NotifyPosUpdate(CT_LbsClientServer& aParent); + + void ConstructL(); + void TempSetRequestorL(); + + +private: + + // To allow changing admin settings. + CLbsAdmin* iLbsAdmin; + + TBool iRequestedAssData; + TBool iReceivedAssData; + + }; + +#endif //__CT_LBS_CLIENT_STEP_NOTIFY_POS_UPDATE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepopenclose.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepopenclose.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,43 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsClientStep_OpenClose.h +// This contains the header file for Server Open Close Tests +// +// + +#ifndef __CT_LBS_CLIENT_STEP_OPEN_CLOSE_H__ +#define __CT_LBS_CLIENT_STEP_OPEN_CLOSE_H__ + +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" + +// Literals used +_LIT(KLbsClientStep_OpenClose, "LbsClientStep_SrvOpenClose"); + +class CT_LbsClientStep_OpenClose : public CT_LbsClientStep + { +public: + ~CT_LbsClientStep_OpenClose(); + + static CT_LbsClientStep_OpenClose* NewL(CT_LbsClientServer& aParent); + static CT_LbsClientStep_OpenClose* New(CT_LbsClientServer& aParent); + + virtual TVerdict doTestStepL(); + +private: + CT_LbsClientStep_OpenClose(CT_LbsClientServer& aParent); + + }; + +#endif //__CT_LBS_CLIENT_STEP_OPEN_CLOSE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientsteppartialupdate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientsteppartialupdate.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,78 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientsteppartialupdate.h +// This contains the header file for Update Options Tests +// +// + +#ifndef __CT_LBS_CLIENT_PARTIALUPDATE_H__ +#define __CT_LBS_CLIENT_PARTIALUPDATE_H__ + +#include "ctlbsclientserver.h" +#include "ctlbsnetsimstep.h" +#include "ctlbsdoposupdate.h" + + +// Literals used +_LIT(KLbsClientStep_PartialUpdate, "LbsClientStep_PartialUpdate"); + +class CT_LbsClientStep_PartialUpdate : public CT_LbsNetSimStep, MT_LbsDoPosUpdateObserver + { +public: + ~CT_LbsClientStep_PartialUpdate(); + + static CT_LbsClientStep_PartialUpdate* New(CT_LbsClientServer& aParent); + virtual TVerdict doTestStepL(); + + // From MLbsNetSimTestObserver. + virtual void Connected(); + virtual void NotifyRegisterLcsMoLr(const TDesC& aData); + virtual void NotifyReleaseLcsMoLr(TInt aReason); + virtual void NotifyMeasurementControlLocation(const TPositionInfo& aPosition, const RLbsAssistanceDataBuilderSet& aData, const TLbsNetPosRequestQuality& aQuality); + virtual void NotifyMeasurementReportLocation(const TPositionInfo& aPosition); + virtual void NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition); + + void MT_LbsDoPosUpdateCallback(TRequestStatus& aStatus); + +private: + CT_LbsClientStep_PartialUpdate(CT_LbsClientServer& aParent); + void ConstructL(); + + TInt OpenNetSim(); + void CloseNetSim(); + void VerifyPosInfos(); + +private: + + enum TPosUpdateStatus + { + EPositionUpdateStart, + EPositionUpdateContinue, + EPositionUpdateComplete + }; + + + TInt iTestCaseId; + TPosUpdateStatus iPosUpdateStatus; + + CT_LbsDoPosUpdate* iDoPosUpdatePtr; + CT_LbsClientServer& iParent; + + TPositionInfo* iPosInfoPtr1; + TPositionInfo* iPosInfoPtr2; + TPosition iRefPos; + + }; + +#endif //__CT_LBS_CLIENT_PARTIALUPDATE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepsrvconnectclose.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepsrvconnectclose.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,40 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsClientStep_SrvConnectClose.h +// This contains the header file for Server Connect Close Tests +// +// + +#ifndef __CT_LBS_CLIENT_STEP_SRV_CONNECT_CLOSE_H__ +#define __CT_LBS_CLIENT_STEP_SRV_CONNECT_CLOSE_H__ + +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" + +// Literals used +_LIT(KLbsClientStep_SrvConnectClose, "LbsClientStep_SrvConnectClose"); + +class CT_LbsClientStep_SrvConnectClose : public CT_LbsClientStep + { +public: + ~CT_LbsClientStep_SrvConnectClose(); + + static CT_LbsClientStep_SrvConnectClose* New(CT_LbsClientServer& aParent); + virtual TVerdict doTestStepL(); + +private: + CT_LbsClientStep_SrvConnectClose(CT_LbsClientServer& aParent); + }; + +#endif //__CT_LBS_CLIENT_STEP_SRV_CONNECT_CLOSE_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepsrvversion.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepsrvversion.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,43 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsClientStep_SrvVersion.h +// This contains the header file for Server Version Tests +// +// + +#ifndef __CT_LBS_CLIENT_STEP_SRV_VERSION_H__ +#define __CT_LBS_CLIENT_STEP_SRV_VERSION_H__ + +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" + +// Literals used +_LIT(KLbsClientStep_SrvVersion, "LbsClientStep_SrvVersion"); + +class CT_LbsClientStep_SrvVersion : public CT_LbsClientStep + { +public: + ~CT_LbsClientStep_SrvVersion(); + + static CT_LbsClientStep_SrvVersion* NewL(CT_LbsClientServer& aParent); + static CT_LbsClientStep_SrvVersion* New(CT_LbsClientServer& aParent); + + virtual TVerdict doTestStepL(); + +private: + CT_LbsClientStep_SrvVersion(CT_LbsClientServer& aParent); + + }; + +#endif //__CT_LBS_CLIENT_STEP_SRV_VERSION_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientsteptracking.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientsteptracking.h Tue Nov 10 13:50:58 2009 +0000 @@ -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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsClientTracking.h +// This contains the header file for Tracking Tests +// +// + +#ifndef __CT_LBS_CLIENT_TRACKING_H__ +#define __CT_LBS_CLIENT_TRACKING_H__ + +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" + +#include + +// Literals used +_LIT(KLbsClientStep_Tracking, "LbsClientStep_Tracking"); + +class CT_LbsClientStep_Tracking : public CT_LbsClientStep, MT_ResponseObserver + { +public: + ~CT_LbsClientStep_Tracking(); + + static CT_LbsClientStep_Tracking* New(CT_LbsClientServer& aParent); + virtual TVerdict doTestStepL(); + + // from MT_ResponseObserver + virtual void ProcessAGpsResponseMessage(const TT_LbsAGpsResponseMsg::TModuleResponseType aResponse); + +private: + CT_LbsClientStep_Tracking(CT_LbsClientServer& aParent); + void ConstructL(); + + TBool VerifyFirstPosTime(const TTime& aTimeRequested, const TPositionInfo& aPosInfo, const TPositionUpdateOptions& aUpdateOpts); + TBool VerifyPosTime(const TTime& aTimeFirstPosReceived, const TPositionUpdateOptions& aUpdateOpts, TPositionInfo& aPosInfo, TInt aPosCount); + + void DoTestCase(); + + void DoInterval_TestCaseId_01(); + void DoInterval_TestCaseId_02(); + void DoInterval_TestCaseId_03(); + void DoInterval_TestCaseId_04(); + void DoInterval_TestCaseId_05(); + void DoInterval_TestCaseId_06(); + void DoInterval_TestCaseId_07(); + void DoInterval_TestCaseId_08(); + + void ConfigureModuleTimeOut(TTimeIntervalMicroSeconds& aTimeOut); + +private: + + TInt iVerifyInterval; + TInt iExpectedErr; + TInt iUpdateIndex; + TInt iUpdateWindowIndex; + TPositionUpdateOptions iUpdateOpts; + TPositionInfo iPosInfo; + + TBool iCheckIfSameAsPreviousPosition; + TPositionInfo iPreviousPos; + TBool iSameAsPreviousPos; + }; + +#endif //__CT_LBS_CLIENT_TRACKING_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepupdateoptions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/ctlbsclientstepupdateoptions.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,58 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsClientUpdateOptions.h +// This contains the header file for Update Options Tests +// +// + +#ifndef __CT_LBS_CLIENT_UPDATEOPTIONS_H__ +#define __CT_LBS_CLIENT_UPDATEOPTIONS_H__ + +#include "ctlbsclientstep.h" +#include "ctlbsclientserver.h" +#include + + +// Literals used +_LIT(KLbsClientStep_UpdateOptions, "LbsClientStep_UpdateOptions"); + +class CT_LbsClientStep_UpdateOptions : public CT_LbsClientStep + { +public: + ~CT_LbsClientStep_UpdateOptions(); + + static CT_LbsClientStep_UpdateOptions* New(CT_LbsClientServer& aParent); + virtual TVerdict doTestStepL(); + +private: + CT_LbsClientStep_UpdateOptions(CT_LbsClientServer& aParent); + + void CT_LbsClientStep_UpdateOptions::TempSetRequestorL(); + TBool CT_LbsClientStep_UpdateOptions::CompareUpdateOptions(TPositionUpdateOptions aPosA, TPositionUpdateOptions aPosB); + + TBool VerifyFirstPosTime(const TTime& aTimeRequested, const TPositionInfo& aPosInfo, const TPositionUpdateOptions& aUpdateOpts); + TBool VerifyPosTime(const TTime& aTimeFirstPosReceived, const TPositionUpdateOptions& aUpdateOpts, TPositionInfo& aPosInfo, TInt aPosCount); + + +private: + + // to allow changing admin settings: + CLbsAdmin* iLbsAdmin; + + TBool iRequestedAssData; + TBool iReceivedAssData; + + }; + +#endif //__CT_LBS_CLIENT_UPDATEOPTIONS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/inc/tctlbsclientmodulesobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/inc/tctlbsclientmodulesobserver.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Symbian Foundation License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __TCT_LBS_CLIENT_MODULES_OBSERVER_H__ +#define __TCT_LBS_CLIENT_MODULES_OBSERVER_H__ + +// INCLUDES +#include "EPos_MPosModulesObserver.h" + +// CLASS DECLARATION + +/** +* ?one_line_short_description. +* ?other_description_lines +*/ +class TCT_LbsClientModulesObserver :public MPosModulesObserver + { + public: // Functions from base classes + + /** + * From MPosModulesDbObserver + */ + inline void HandleSettingsChangeL( + /* IN */ TPosModulesEvent /*aEvent*/ + ){CActiveScheduler::Stop();}; + + + }; + +#endif // __TCT_LBS_CLIENT_MODULES_OBSERVER_H__ + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/lbsexeclient/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/lbsexeclient/group/bld.inf Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,20 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTMMPFILES +ctlbsexeclient.mmp diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/lbsexeclient/group/ctlbsexeclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/lbsexeclient/group/ctlbsexeclient.mmp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,37 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +TARGET ctlbsexeclient.exe +TARGETTYPE exe +UID 0 0x03a157b5 +CAPABILITY ALL -TCB +VENDORID 0x70000001 + +EPOCSTACKSIZE 0x5000 + +MACRO __LBS_VARIANT2 + +SOURCEPATH ../src + +SOURCE ctlbsexeclient.cpp + +SYSTEMINCLUDE /epoc32/include +SYSTEMINCLUDE /epoc32/include/lbs +SYSTEMINCLUDE /epoc32/include/lbs/test + +LIBRARY euser.lib +LIBRARY lbs.lib +LIBRARY efsrv.lib +LIBRARY eposmodset.lib diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/lbsexeclient/src/ctlbsexeclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/lbsexeclient/src/ctlbsexeclient.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,254 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +TInt DoTestL(); + +TInt TestMainL() + { + // Create and install the active scheduler + CActiveScheduler* exampleScheduler=new (ELeave) CActiveScheduler; + CleanupStack::PushL(exampleScheduler); + CActiveScheduler::Install(exampleScheduler); + // Call function + TInt result = DoTestL(); + CleanupStack::PopAndDestroy(exampleScheduler); + return result; + } + +void TraceL(const TDesC& aMsg, RFile& aFile) + { + const TInt KBufSize = 200; + TBuf8 tmp; + tmp.Copy(aMsg); + _LIT(KEnd,";\r\n"); + tmp.Append(KEnd); + aFile.Write(tmp); + } + +/** +* Setup PSY +*/ +void SetupPsyL(const TUid aPsyUid) + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* enable = CPosModuleUpdate::NewLC(); + CPosModuleUpdate* disable = CPosModuleUpdate::NewLC(); + + disable->SetUpdateAvailability(EFalse); + enable->SetUpdateAvailability(ETrue); + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != aPsyUid) + { + // Disable all PSYs except one given as parameter + db->UpdateModuleL((*prioList)[i], *disable); + } + else + { + // Enable the PSY that came as an in parameter + db->UpdateModuleL((*prioList)[i], *enable); + } + } + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(disable); + CleanupStack::PopAndDestroy(enable); + CleanupStack::PopAndDestroy(db); + } + +/** +* Method used to generate a file name for trace. +* If a trace file exist an index number i counted +* one step until a trace file can be created. +* Maximun number of exe client are currently hard +* coded to 10; +*/ +TBuf<40> GenerateFileNameForTraceL() + { + _LIT(KFileTrace, "c:\\logs\\execlientresult%d.txt"); + RFs fileserver; + RFile file; + User::LeaveIfError(fileserver.Connect()); + TBuf<40> ff; + ff.Append(KFileTrace); + + for (TInt i = 1; i<10;i++) + { + ff.Format(KFileTrace,i); + TInt err = file.Open(fileserver,ff, EFileWrite); + if (err == KErrNotFound) + { + User::LeaveIfError(file.Create(fileserver,ff, EFileWrite)); + break; + } + } + file.Close(); + fileserver.Close(); + return ff; +} + +/** +* Error checking and output error to Trace File. +*/ +void AssertTrueL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode, RFile& aFile) + { + if (!aCondition) + { + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + TraceL(buf, aFile); + //User::Leave(aErrorCode); + } + } + +/** +* Performes the test by connecting to MLFW and makes 50 Location request +*/ +TInt DoTestL() + { + TBuf<40> traceFile = GenerateFileNameForTraceL(); + + RFs fileserver; + RFile file; + User::LeaveIfError(fileserver.Connect()); + CleanupClosePushL(fileserver); + User::LeaveIfError(file.Open(fileserver, traceFile, EFileWrite)); + CleanupClosePushL(file); + _LIT(KClientStarted, "Client Started"); + TraceL(KClientStarted, file); + + const TInt32 KUidMultiPsy = 0x01010176; + TUid uidMultiPsy; + uidMultiPsy.iUid = KUidMultiPsy; + SetupPsyL(uidMultiPsy); + + _LIT(KMultiPsySetup, "MultiPsy set up"); + TraceL(KMultiPsySetup, file); + + TInt numberOfRuns = 50; + + RPositionServer posServer; + CleanupClosePushL(posServer); + RPositioner positioner; + CleanupClosePushL(positioner); + TPositionInfo positionInfo = TPositionInfo(); + + _LIT(KConnectErr, "ERROR: Error when connecing to EPos server, %d"); + TInt err = posServer.Connect(); + AssertTrueL(err == KErrNone, KConnectErr, err, file); + + _LIT(KOpenErr, "ERROR: Error when opening positioner, %d"); + err = positioner.Open(posServer, uidMultiPsy); + AssertTrueL(err == KErrNone, KOpenErr, err, file); + + _LIT(KService ,"Service"); + err = positioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KService); + _LIT(KRequestor, "ERROR: Not possible to set requestor"); + AssertTrueL(err == KErrNone, KRequestor, err, file); + + TTime now, startTime; + TTimeIntervalMicroSeconds requestTime; + TRequestStatus status; + TInt64 reqTime; + TCoordinate corr(0,0,0); + TLocality loca(corr,0); + TPosition pos(loca, TTime(0)); + TBool success = ETrue; + _LIT(KStartingRequests, "Starting requests"); + TraceL(KStartingRequests, file); + + for (TInt i = 0; i < numberOfRuns; i++) + { + startTime.UniversalTime(); + positionInfo.SetPosition(pos); + positioner.NotifyPositionUpdate(positionInfo, status); + User::WaitForRequest(status); + err = status.Int(); + if (err != KErrNone) + { + success=EFalse; + } + now.UniversalTime(); + requestTime = now.MicroSecondsFrom(startTime); + _LIT(KError, "Request time, %d µs. Error code from Notify = %d"); + TBuf<100> buf; + reqTime = requestTime.Int64(); + buf.Format(KError, reqTime, err); + TraceL(buf, file); + TPosition result; + positionInfo.GetPosition(result); + // Sanity check + if (result.Latitude() == pos.Latitude() || + result.Longitude() == pos.Longitude() || + result.Altitude() == pos.Altitude()) + { + success = EFalse; + _LIT(KErrorPositon, "ERROR:: The postion was not updated"); + TraceL(KErrorPositon, file); + } + } + + CleanupStack::PopAndDestroy(&positioner); + CleanupStack::PopAndDestroy(&posServer); + + if (success) + { + _LIT(KOk, "SUCCESS"); + TraceL(KOk, file); + } + else + { + _LIT(KErr, "FAILED"); + TraceL(KErr, file); + } + + CleanupStack::PopAndDestroy(&file); + CleanupStack::PopAndDestroy(&fileserver); + + return (success) ? 0 : 1; + } + +// Cleanup stack harness +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanupStack = CTrapCleanup::New(); + TInt result = 1; + TRAPD(error, result = TestMainL()); + _LIT(KLbsExeClient, "CT Lbs Exe Client"); + __ASSERT_ALWAYS(!error, User::Panic(KLbsExeClient, error)); + delete cleanupStack; + __UHEAP_MARKEND; + return result; + } + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/scripts/setup_smoketest_lbs.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/scripts/setup_smoketest_lbs.script Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,22 @@ +// +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +RUN_UTILS MkDir c:\smoketest\ + +RUN_UTILS CopyFile z:\smoketest\smoketest_lbs.ini c:\smoketest\smoketest_lbs.ini +RUN_UTILS MakeReadWrite c:\smoketest\smoketest_lbs.ini +RUN_UTILS CopyFile z:\smoketest\smoketest_lbs.script c:\smoketest\smoketest_lbs.script +RUN_UTILS MakeReadWrite c:\smoketest\smoketest_lbs.script diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/scripts/smoketest_lbs.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/scripts/smoketest_lbs.script Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,37 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRINT Run LBS smoketest + +LOAD_SUITE LbsClientTestServer -SharedData +WAIT 1000 + +START_TESTCASE SMOKE_LBS_0001 +//! @SYMTestCaseID SMOKE_LBS_0001 +//! @SYMTestCaseDesc Request module count (use GetNumModules) +//! and ensure a count of 2 is returned to indicate the correct +//! number of modules is installed (Network and A-GPS modules). + +PRINT Run LbsClientTestServer + +RUN_TEST_STEP 010 LbsClientTestServer LbsStep_ResetDefaultAdmin +RUN_TEST_STEP 030 LbsClientTestServer LbsStep_StartLbs + +RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler +RUN_TEST_STEP 20 LbsClientTestServer LbsClientStep_ModInfo c:\smoketest\smoketest_lbs.ini LBS-Mod-Cnt-0001 + +RUN_TEST_STEP 030 LbsClientTestServer LbsStep_StopLbs + +END_TESTCASE SMOKE_LBS_0001 diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclienteventtimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclienteventtimer.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,168 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDE FILES +#include "ctlbsclienteventtimer.h" +#include "mctlbsrequestobserver.h" +#include +#include "ctlbsclientrequestor.h" + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CT_LbsClientEventTimer::CT_LbsClientEventTimer() + : CActive(EActivePriorityDefault), + iTimer(), + iObserver(NULL), + iCompletionCode(KNoEvent) + { + } + +// EPOC default constructor can leave. +void CT_LbsClientEventTimer::ConstructL(CTestExecuteLogger& aLogger) + { + iLogger = aLogger; + User::LeaveIfError(iTimer.CreateLocal()); + CActiveScheduler::Add(this); + } + +// Two-phased constructor. +CT_LbsClientEventTimer* CT_LbsClientEventTimer::NewL(CTestExecuteLogger& aLogger) + { + CT_LbsClientEventTimer* self = NewLC(aLogger); + CleanupStack::Pop(); + return self; + } + +// Two-phased constructor. +CT_LbsClientEventTimer* CT_LbsClientEventTimer::NewLC(CTestExecuteLogger& aLogger) + { + CT_LbsClientEventTimer* self = + new (ELeave) CT_LbsClientEventTimer(); + CleanupStack::PushL(self); // push to clean-up stack + self->ConstructL(aLogger); // construct + return self; // return new object + } + +// Destructor +CT_LbsClientEventTimer::~CT_LbsClientEventTimer() + { + iObserver = NULL; + Cancel(); + iTimer.Close(); + } + +// --------------------------------------------------------- +// CT_LbsClientEventTimer::SetObserver +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientEventTimer::SetObserver(MCT_LbsRequestObserver* aObserver) + { + iObserver = aObserver; + } + +// --------------------------------------------------------- +// CT_LbsClientEventTimer::CompletionCode +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CT_LbsClientEventTimer::CompletionCode() const + { + return iCompletionCode; + } + +// --------------------------------------------------------- +// CT_LbsClientEventTimer::ResetCompletionCode +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientEventTimer::ResetCompletionCode() + { + iCompletionCode = KNoEvent; + } + +// --------------------------------------------------------- +// CT_LbsClientEventTimer::Start +// starts the RTimer +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientEventTimer::Start(TInt aTimeout) + { + iTimer.After(iStatus, aTimeout); + SetActive(); + } + +// --------------------------------------------------------- +// CT_LbsClientEventTimer::DoCancel +// cancels the RTimer +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientEventTimer::DoCancel() + { + iTimer.Cancel(); + } + +// --------------------------------------------------------- +// CPosNotifierTimer::RunL +// report a timeout to the observer +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientEventTimer::RunL() + { + iCompletionCode = iStatus.Int(); + RequestComplete(); + } + +// --------------------------------------------------------- +// CT_LbsClientEventTimer::RunError +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CT_LbsClientEventTimer::RunError(TInt /*aError*/) + { + return KErrNone; + } + +// --------------------------------------------------------- +// CT_LbsClientEventTimer::RequestComplete +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientEventTimer::RequestComplete() + { + if (iObserver) + { + TRAPD(err, iObserver->RequestCompleteL()); + if(KErrNone != err) + { + _LIT(KRequestCompleteError, "Error in LbsRequester: %d"); + ERR_PRINTF2(KRequestCompleteError, err); + } + } + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientgetlkpao.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientgetlkpao.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,99 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// TODO - should this be moved somewhere more central (testutils, say)? +// +// + + + +/** + @file ctlbsclientgetlkpao.cpp +*/ + +#include "ctlbsclientgetlkpao.h" +#include + +_LIT(KGetLastKnownPosAO, "GetLastKnownPosAO"); + +CT_LbsClientGetLastKnownPosAO::~CT_LbsClientGetLastKnownPosAO() +/** + * Destructor + */ + { + Cancel(); + } + + + +CT_LbsClientGetLastKnownPosAO::CT_LbsClientGetLastKnownPosAO(MT_GetLastKnownPosObserver& aCaller) : CActive(EPriorityIdle), iCaller(aCaller) +/** + * Constructor - will not leave + */ + { + CActiveScheduler::Add(this); + } + + +CT_LbsClientGetLastKnownPosAO* CT_LbsClientGetLastKnownPosAO::NewL(MT_GetLastKnownPosObserver& aUser) +/** + * 'public constructor' may leave + */ + { + CT_LbsClientGetLastKnownPosAO* self = new(ELeave)CT_LbsClientGetLastKnownPosAO(aUser); + + return self; + } + + +void CT_LbsClientGetLastKnownPosAO::GetLastKnownPosL(RPositioner& aPositioner, TPositionInfo& aPosInfo) +/** + * wrapper for async positioner function GetLastKnownPosition(). + * Will panic if there's another outstanding request. + */ + { + __ASSERT_ALWAYS(!IsActive(), User::Panic(KGetLastKnownPosAO, KErrInUse)); + + iPositioner = aPositioner; + + // TO DO: this requestor stuff will be removed when we're using the real Location Server: + User::LeaveIfError(iPositioner.SetRequestor( CRequestor::ERequestorService, + CRequestor::EFormatApplication, + _L("Tom Tom"))); + + iRequestId = EPositionerGetLastKnownPosition; // required for cancel + + // Make async call + aPositioner.GetLastKnownPosition(aPosInfo, iStatus); + + // Let the active scheduler know we're waiting (active) + SetActive(); + } + +void CT_LbsClientGetLastKnownPosAO::DoCancel() + { + iPositioner.CancelRequest(iRequestId); + } + +void CT_LbsClientGetLastKnownPosAO::RunL() + { + // iStatus will contain error code eg KErrUnknown if no position cached + // async request completed. Notify caller via callback: + iCaller.GetLastKnownPositionCallback(iStatus); + } + +TInt CT_LbsClientGetLastKnownPosAO::RunError(TInt aError) + { // called if RunL leaves. aError contains the error code + return aError; + } +// EOF diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientnotifyposupdao.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientnotifyposupdao.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,102 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This is the class implementation for the Notify position update tests +// TODO - should this be moved somewhere more central (testutils, say)? +// +// + + + +/** + @file ctlbsclientnotifyposupdao.cpp +*/ + +#include "ctlbsclientnotifyposupdao.h" +#include +#include + +_LIT(KNotifyPosUpdAO, "NotifyPosUpdAO"); + +CT_LbsClientNotifyPosUpdAO::~CT_LbsClientNotifyPosUpdAO() +/** + * Destructor + */ + { + Cancel(); + } + + + +CT_LbsClientNotifyPosUpdAO::CT_LbsClientNotifyPosUpdAO(MT_NotifyPosUpdateObserver& aCaller) : CActive(EPriorityIdle), iCaller(aCaller) +/** + * Constructor - will not leave + */ + { + CActiveScheduler::Add(this); + } + + +CT_LbsClientNotifyPosUpdAO* CT_LbsClientNotifyPosUpdAO::NewL(MT_NotifyPosUpdateObserver& aCaller) +/** + * 'public constructor' may leave + */ + { + CT_LbsClientNotifyPosUpdAO* me = new(ELeave)CT_LbsClientNotifyPosUpdAO(aCaller); + + return me; + } + + +void CT_LbsClientNotifyPosUpdAO::NotifyPosUpdateL(RPositioner& aPositioner, TPositionInfo& aPosInfo) +/** + * wrapper for async positioner function NotifyPositionUpdate(). + * Will panic if there's another outstanding request. + */ + { + __ASSERT_ALWAYS(!IsActive(), User::Panic(KNotifyPosUpdAO, KErrInUse)); + + iPositioner = aPositioner; + iRequestId = EPositionerNotifyPositionUpdate; // required for cancel + + // TO DO: this requestor stuff will be removed when we're using the real Location Server: + User::LeaveIfError(iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, + _L("Tom Tom"))); + + + // Make async call + aPositioner.NotifyPositionUpdate(aPosInfo, iStatus); + + // Let the active scheduler know we're waiting (active) + SetActive(); + } + +void CT_LbsClientNotifyPosUpdAO::DoCancel() + { + TInt err = iPositioner.CancelRequest(iRequestId); + } + + +void CT_LbsClientNotifyPosUpdAO::RunL() + { + // iStatus will contain error code eg KErrUnknown if no position cached + // async request completed. Notify caller via callback: + iCaller.NotifyPositionUpdateCallback(iStatus); + } + +TInt CT_LbsClientNotifyPosUpdAO::RunError(TInt aError) + { // called if RunL leaves. aError contains the error code + return aError; + } +// EOF diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientobserver.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,153 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDE FILES +#include "ctlbsclientobserver.h" + + +// CONSTANTS +// Apparently the EposServer name is same on WINS and ARMI +_LIT(KEPosServerName, "!PosServer"); + +_LIT(KPrivacyServerName, "eposprivsrv"); // TBD: Is this name OK? + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------- +// CT_LbsClientObserver::WaitForEPosShutdown +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientObserver::WaitForEPosShutdown() + { + WaitForProcessDeath(KEPosServerName); + } + +void EPosShutdownWaitCleanupItem(TAny*) + { + CT_LbsClientObserver::WaitForEPosShutdown(); + } + +// --------------------------------------------------------- +// CT_LbsClientObserver::EPosShutdownWaitPushL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientObserver::EPosShutdownWaitPushL() + { + CleanupStack::PushL(TCleanupItem(EPosShutdownWaitCleanupItem)); + } + +// --------------------------------------------------------- +// CT_LbsClientObserver::EPosAliveL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CT_LbsClientObserver::EPosAliveL() + { + return ProcessAliveL(KEPosServerName); + } + +// --------------------------------------------------------- +// CT_LbsClientObserver::WaitForPrivacyServerShutdown +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientObserver::WaitForPrivacyServerShutdown() + { + WaitForProcessDeath(KPrivacyServerName); + } + +void PrivacyServerShutdownWaitCleanupItem(TAny*) + { + CT_LbsClientObserver::WaitForPrivacyServerShutdown(); + } + +// --------------------------------------------------------- +// CT_LbsClientObserver::PrivacyServerShutdownWaitPushL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientObserver::PrivacyServerShutdownWaitPushL() + { + CleanupStack::PushL(TCleanupItem(PrivacyServerShutdownWaitCleanupItem)); + } + +// --------------------------------------------------------- +// CT_LbsClientObserver::PrivacyServerAliveL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CT_LbsClientObserver::PrivacyServerAliveL() + { + return ProcessAliveL(KPrivacyServerName); + } + +// --------------------------------------------------------- +// CT_LbsClientObserver::WaitForProcessDeath +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientObserver::WaitForProcessDeath(const TDesC& aProcessName) + { +#ifdef __WINS__ + RThread process; +#else + RProcess process; +#endif + + if (process.Open(aProcessName)) + { + return; + } + + TRequestStatus status; + process.Logon(status); + User::WaitForRequest(status); + + process.Close(); + } + +// --------------------------------------------------------- +// CT_LbsClientObserver::ProcessAliveL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CT_LbsClientObserver::ProcessAliveL(const TDesC& aProcessName) + { + TFindServer find(aProcessName); + TFullName name; + if (find.Next(name) == KErrNone) // server found + { + return ETrue; + } + else + { + return EFalse; + } + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientperiodictester.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientperiodictester.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,457 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDE FILES +#include "ctlbsclientperiodictester.h" +#include "ctlbsclientlog.h" + +// CONSTANTS +const TInt KSmallestUpdateIntervalToLog = 4000000; //2000000 +const TInt KMilliSecondTolerance = 2500000; //One second + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CPeriodicTester::CPeriodicTester +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CT_LbsClientPeriodicTester::CT_LbsClientPeriodicTester() : CActive(CActive::EPriorityHigh), iError(EFalse), iErrorCode(KErrNone) + { + } + +// ----------------------------------------------------------------------------- +// CPeriodicTester::ConstructL +// +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::ConstructL( + TTimeIntervalMicroSeconds aInterval, + const TDesC& aServiceName, + CT_LbsClientLog* aLog, + TUid aUid, + TInt aNumberOfRuns) + { + iLog = aLog; + iName = aServiceName; + iNumberOfRuns = aNumberOfRuns; + iInterval = aInterval; + iUid = aUid; + iNumberOfUpdates = 0; + iPrematureChangeOfParameters = EFalse; + iCanceledRequest = EFalse; + iCancelRequest = EFalse; + iWriteToLog = ETrue; //EFalse + iRecentTime = TTime(0); + iPositionInfo = TPositionInfo(); + + _LIT(KConnectErr, "Error when connecing to EPos server, %d"); + TInt err = iPosServer.Connect(); + AssertTrueL(err == KErrNone, KConnectErr, err); + + _LIT(KOpenErr, "Error when opening positioner, %d"); + err = iPositioner.Open(iPosServer, aUid); + AssertTrueL(err == KErrNone, KOpenErr, err); + + TPositionUpdateOptions posOption; + posOption.SetUpdateInterval(aInterval); + + _LIT(KUpdateErr, "Error when setting update interval, %d"); + err = iPositioner.SetUpdateOptions(posOption); + AssertTrueL(err == KErrNone, KUpdateErr, err); + + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, aServiceName); + + CActiveScheduler::Add(this); + } + +// ----------------------------------------------------------------------------- +// CPeriodicTester::NewL +// +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CT_LbsClientPeriodicTester* CT_LbsClientPeriodicTester::NewL( + TTimeIntervalMicroSeconds aInterval, + const TDesC& aServiceName, + CT_LbsClientLog* aLog, + TUid aUid, + TInt aNumberOfRuns) + { + CT_LbsClientPeriodicTester* self = new( ELeave ) CT_LbsClientPeriodicTester; + + CleanupStack::PushL(self); + self->ConstructL(aInterval, aServiceName, aLog, aUid, aNumberOfRuns); + CleanupStack::Pop(); + + return self; + } + + +// Destructor +CT_LbsClientPeriodicTester::~CT_LbsClientPeriodicTester() + { + iPositioner.Close(); + iPosServer.Close(); + + iLog = NULL; + } + +// ----------------------------------------------------------------------------- +// CPeriodicTester::RunL +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::RunL() + { + iNumberOfUpdates++; + //User::Leave(-10); //used for testing the test code + TBuf<175> buf; + _LIT(KStatus,"Status invalid in RunL, status = %d"); + buf.Format(KStatus, iStatus.Int()); + AssertTrueL((iStatus == KErrNone || iStatus == KPositionQualityLoss || + iStatus == KErrCancel), buf, iStatus.Int()); + if(iNumberOfUpdates <= iNumberOfRuns) + { + _LIT(KTime, "%F%H:%F%T:%F%S:%F%*C3"); + TBuf<100> time; + TTime now; + now.UniversalTime(); + TInt difference; + TInt smallestIntervalToLog = KSmallestUpdateIntervalToLog; + if(iNumberOfUpdates == 1) + { + difference = I64LOW(now.MicroSecondsFrom(iRecentTime).Int64()); + } + else + { + difference = I64LOW(now.MicroSecondsFrom(iRecentTime).Int64()); + } + + _LIT(KInterval, "The interval is %d, and the difference is %d"); + TBuf<150> buf; + buf.Format(KInterval,iInterval.Int64(), difference); + iLog->Put (buf); + if((iInterval.Int64() > smallestIntervalToLog) && (I64LOW(iRecentTime.Int64()) != 0)) + { + _LIT(KTimeErr, "ERROR: Time difference greater than tolerated interval, time difference = %d"); + AssertTrueL(difference < (iInterval.Int64() + KMilliSecondTolerance), KTimeErr, I64LOW(now.MicroSecondsFrom(iRecentTime).Int64())); + + if(difference < 0) + { + #ifdef __WINS__ + _LIT(KEarlyErr, "ERROR: Negative time difference on WINS greater than 0.4s"); + AssertTrueL((KToleratedEarliness > -(difference)), KEarlyErr, KErrTotalLossOfPrecision); + #else + _LIT(KEarlyErr, "ERROR: Time difference negative on target"); + iLog->Put(KEarlyErr); + User::LeaveIfError(KErrTotalLossOfPrecision); + #endif + + } + } + + if(iWriteToLog && ((iNumberOfUpdates % KTracePeriod) == 0)) + { + now.UniversalTime(); + now.FormatL(time, KTime); + _LIT(KLog, "Client got update no. %d at %S, Time-diff = %d, Status = "); + TBuf<175> buf; + buf.Format(KLog, iNumberOfUpdates, &time, difference); + buf.AppendNum(iStatus.Int()); + buf.Append(iName); + _LIT(KNrOfRuns, "Nr of runs = "); + buf.Append(KNrOfRuns); + buf.AppendNum(iNumberOfRuns); + iLog->Put(buf); + } + + if(iPrematureChangeOfParameters) + { + iInterval = TTimeIntervalMicroSeconds(2000000); + User::After(I64LOW(iInterval.Int64())); + + TPositionUpdateOptions posOption; + posOption.SetUpdateInterval(iInterval); + + TInt err = iPositioner.SetUpdateOptions(posOption); + _LIT(KChange, "ERROR: Got error code when setting update options prematurely in ChangeTestParameters"); + AssertTrueL(err == KErrNone, KChange, err); + iPrematureChangeOfParameters = EFalse; + } + + RequestNotification(); + + if(iCancelRequest) + { + User::After(3000000); + iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); + iCancelRequest = EFalse; + iCanceledRequest = ETrue; + } + + if(iCanceledRequest) + { + iCanceledRequest = EFalse; + _LIT(KCancelErr, "ERROR: Status was not KErrCancel after CancelRequest"); + AssertTrueL(iStatus.Int() == KErrCancel, KCancelErr, KErrCancel); + } + } + else + { + CActiveScheduler::Stop(); + } + + } + + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::RunError +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CT_LbsClientPeriodicTester::RunError(TInt aError) + { + iError = ETrue; + iErrorCode = aError; + CActiveScheduler::Stop(); + _LIT(KErrorInRunL, "Error code in RunError is, %d"); + TBuf<100> buf; + buf.Format(KErrorInRunL, aError); + iLog -> Put(buf); + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::IsCompletedOK +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TBool CT_LbsClientPeriodicTester::IsCompletedOK() + { + return !iError; + } + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::GetError +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CT_LbsClientPeriodicTester::GetError() + { + return iErrorCode; + } + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::ChangeTestParametersL +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::ChangeTestParametersL(TTimeIntervalMicroSeconds aInterval, TInt aNumberOfRuns) + { + iNumberOfRuns = aNumberOfRuns; + iNumberOfUpdates = 0; + iInterval = aInterval; + iRecentTime = TTime(0); + iError = EFalse; + iErrorCode = KErrNone; + + TPositionUpdateOptions posOption; + posOption.SetUpdateInterval(aInterval); + + TInt err = iPositioner.SetUpdateOptions(posOption); + _LIT(KChange, "ERROR: When setting update options in ChangeTestParameters, err: %d"); + AssertTrueL(err == KErrNone, KChange, err); + } + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::ChangeRequestorInformation +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::ChangeRequestorInformation(const TDesC& aServiceName) + { + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, aServiceName); + } + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::ClosePositioner +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::ClosePositioner() + { + iPositioner.Close(); + } + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::OpenPositionerL +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::OpenPositionerL(const TDesC& aServiceName) + { + _LIT(KOpenErr, "Error when opening positioner, %d"); + TInt err = iPositioner.Open(iPosServer, iUid); + AssertTrueL(err == KErrNone, KOpenErr, err); + + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, aServiceName); + } + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::SetMaxAgeL +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::SetMaxAgeL(TTimeIntervalMicroSeconds aInterval) + { + TPositionUpdateOptions posOption; + posOption.SetUpdateInterval(iInterval); + posOption.SetMaxUpdateAge(aInterval); + + TInt err = iPositioner.SetUpdateOptions(posOption); + _LIT(KChange, "ERROR: When setting max age in SetMaxAge, err: %d"); + AssertTrueL(err == KErrNone, KChange, err); + } + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::SetPartialUpdateL +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::SetPartialUpdateL(TBool aUpdateOption) + { + TPositionUpdateOptions posOption; + posOption.SetUpdateInterval(iInterval); + posOption.SetAcceptPartialUpdates(aUpdateOption); + + TInt err = iPositioner.SetUpdateOptions(posOption); + _LIT(KChange, "ERROR: When setting partial update in SetPartialUpdate, err: %d"); + AssertTrueL(err == KErrNone, KChange, err); + } + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::SetTimeOutL +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::SetTimeOutL(TTimeIntervalMicroSeconds aInterval) + { + TPositionUpdateOptions posOption; + posOption.SetUpdateInterval(iInterval); + posOption.SetUpdateTimeOut(aInterval); + + TInt err = iPositioner.SetUpdateOptions(posOption); + _LIT(KChange, "ERROR: When setting timeout in SetTimeOut"); + AssertTrueL(err == KErrNone, KChange, err); + } + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::SetChangeParametersPrematurely +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::SetChangeParametersPrematurely(TBool aCondition) + { + iPrematureChangeOfParameters = aCondition; + } + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::CancelRequest +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::CancelRequest() + { + iCancelRequest= ETrue; + iCanceledRequest = EFalse; + } + + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::RequestNotification +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::RequestNotification() + { + TTime now; + now.UniversalTime(); + iRecentTime = now; + iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::RequestNotification +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::GetPosition(TPositionInfo& aPosInfo) + { + aPosInfo = iPositionInfo; + } + +// ----------------------------------------------------------------------------- +// CT_LbsClientPeriodicTester::DoCancel +// +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::DoCancel() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPeriodicTester::AssertTrueL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPeriodicTester::AssertTrueL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode) + { + if (!aCondition) + { + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + iLog->Put(buf); + User::Leave(aErrorCode); + } + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientportedsuiteserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientportedsuiteserver.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,360 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ctlbsclientportedserver.cpp +// Test server for ported client tests +// +// + +#include "ctlbsclientportedsuiteserver.h" +#include "ctlbsclientpostp1.h" +#include "ctlbsclientpostp2.h" +#include "ctlbsclientpostp11.h" +#include "ctlbsclientpostp17.h" +#include "ctlbsclientpostp21.h" +#include "ctlbsclientpostp22.h" +#include "ctlbsclientpostp25.h" +#include "ctlbsclientpostp27.h" +#include "ctlbsclientpostp76.h" +#include "ctlbsclientpostp93.h" +#include "ctlbsclientpostp169.h" +#include "ctlbsclientpostp173.h" +#include "ctlbsclientpostp176.h" +#include "ctlbsclientpostp178.h" +#include "ctlbsclientpostp179.h" +#include "ctlbsclientpostp188.h" +#include "ctlbsclientpostp189.h" +#include "ctlbsclientpostp193.h" +#include "ctlbsclientpostp194.h" +#include "ctlbsclientpostp195.h" +#include "ctlbsclientpostp201.h" +#include "ctlbsclientpostp203.h" +#include "ctlbsclientpostp204.h" +#include "ctlbsclientpostp208.h" +#include "ctlbsclientpostp213.h" +#include "ctlbsclientpostp217.h" +#include "ctlbsclientpostp218.h" +#include "ctlbsclientpostp222.h" +#include "ctlbsclientpostp223.h" +#include "ctlbsclientpostp224.h" +#include "ctlbsclientpostp227.h" +#include "ctlbsclientpostp254.h" +#include "ctlbsclientpostp256.h" +#include "ctlbsclientpostp257.h" +#include "ctlbsclientpostp259.h" +#include "ctlbsclientpostp261.h" +#include "ctlbsclientpostp269.h" +#include "ctlbsclientpostp271.h" +#include "ctlbsclientpostp272.h" +#include "ctlbsclientpostp274.h" +#include "ctlbsclientpostp275.h" +#include "ctlbsclientpostp4701.h" +#include "ctlbsclientpostp4702.h" +#include "ctlbsclientpostp4703.h" +#include "ctlbsclientpostp4704.h" +#include "ctlbsclientpostp4705.h" +#include "ctlbsclientpostp4706.h" +#include "ctlbsclientpostp4707.h" +#include "ctlbsclientpostp4708.h" +#include "ctlbsclientpostp4709.h" +#include "ctlbsclientpostp4722.h" +#include "ctlbsclientpostp4723.h" + +_LIT(KServerName,"te_LbsPortedSuite"); +CT_LbsClientPortedSuite* CT_LbsClientPortedSuite::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. + */ + { + CT_LbsClientPortedSuite * server = new (ELeave) CT_LbsClientPortedSuite(); + 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); + CT_LbsClientPortedSuite* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CT_LbsClientPortedSuite::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* CT_LbsClientPortedSuite::CreateTestStep(const TDesC& aStepName) +/** + * @return - A CTestStep derived instance + * Secure and non-secure variants + * Implementation of CTestServer pure virtual + */ + { + CTestStep* testStep = NULL; + + if(aStepName == KTestProcedure1) + { + testStep = new CT_LbsClientPosTp1(*this); + } + if(aStepName == KTestProcedure2) + { + testStep = new CT_LbsClientPosTp2(*this); + } + if(aStepName == KTestProcedure11) + { + testStep = new CT_LbsClientPosTp11(*this); + } + if(aStepName == KTestProcedure17) + { + testStep = new CT_LbsClientPosTp17(*this); + } + if(aStepName == KTestProcedure21) + { + testStep = new CT_LbsClientPosTp21(*this); + } + if(aStepName ==KTestProcedure22) + { + testStep = new CT_LbsClientPosTp22(*this); + } + if(aStepName == KTestProcedure25) + { + testStep = new CT_LbsClientPosTp25(*this); + } + if(aStepName == KTestProcedure27) + { + testStep = new CT_LbsClientPosTp27(*this); + } + if(aStepName == KTestProcedure76) + { + testStep = new CT_LbsClientPosTp76(*this); + } + if(aStepName == KTestProcedure93) + { + testStep = new CT_LbsClientPosTp93(*this); + } + if(aStepName == KTestProcedure169) + { + testStep = new CT_LbsClientPosTp169(*this); + } + if(aStepName == KTestProcedure173) + { + testStep = new CT_LbsClientPosTp173(*this); + } + if(aStepName == KTestProcedure176) + { + testStep = new CT_LbsClientPosTp176(*this); + } + if(aStepName == KTestProcedure178) + { + testStep = new CT_LbsClientPosTp178(*this); + } + if(aStepName == KTestProcedure179) + { + testStep = new CT_LbsClientPosTp179(*this); + } + if(aStepName == KTestProcedure188) + { + testStep = new CT_LbsClientPosTp188(*this); + } + if(aStepName == KTestProcedure189) + { + testStep = new CT_LbsClientPosTp189(*this); + } + if(aStepName == KTestProcedure193) + { + testStep = new CT_LbsClientPosTp193(*this); + } + if(aStepName == KTestProcedure194) + { + testStep = new CT_LbsClientPosTp194(*this); + } + if(aStepName == KTestProcedure195) + { + testStep = new CT_LbsClientPosTp195(*this); + } + if(aStepName == KTestProcedure201) + { + testStep = new CT_LbsClientPosTp201(*this); + } + if(aStepName == KTestProcedure203) + { + testStep = new CT_LbsClientPosTp203(*this); + } + if(aStepName == KTestProcedure204) + { + testStep = new CT_LbsClientPosTp204(*this); + } + if(aStepName == KTestProcedure208) + { + testStep = new CT_LbsClientPosTp208(*this); + } + if(aStepName == KTestProcedure213) + { + testStep = new CT_LbsClientPosTp213(*this); + } + if(aStepName == KTestProcedure217) + { + testStep = new CT_LbsClientPosTp217(*this); + } + if(aStepName == KTestProcedure218) + { + testStep = new CT_LbsClientPosTp218(*this); + } + if(aStepName == KTestProcedure222) + { + testStep = new CT_LbsClientPosTp222(*this); + } + if(aStepName == KTestProcedure223) + { + testStep = new CT_LbsClientPosTp223(*this); + } + if(aStepName == KTestProcedure224) + { + testStep = new CT_LbsClientPosTp224(*this); + } + if(aStepName == KTestProcedure227) + { + testStep = new CT_LbsClientPosTp227(*this); + } + if(aStepName == KTestProcedure254) + { + testStep = new CT_LbsClientPosTp254(*this); + } + if(aStepName == KTestProcedure256) + { + testStep = new CT_LbsClientPosTp256(*this); + } + if(aStepName == KTestProcedure257) + { + testStep = new CT_LbsClientPosTp257(*this); + } + if(aStepName == KTestProcedure259) + { + testStep = new CT_LbsClientPosTp259(*this); + } + if(aStepName == KTestProcedure261) + { + testStep = new CT_LbsClientPosTp261(*this); + } + if(aStepName == KTestProcedure269) + { + testStep = new CT_LbsClientPosTp269(*this); + } + if(aStepName == KTestProcedure271) + { + testStep = new CT_LbsClientPosTp271(*this); + } + if(aStepName == KTestProcedure272) + { + testStep = new CT_LbsClientPosTp272(*this); + } + if(aStepName == KTestProcedure274) + { + testStep = new CT_LbsClientPosTp274(*this); + } + if(aStepName == KTestProcedure275) + { + testStep = new CT_LbsClientPosTp275(*this); + } + if(aStepName == KTestProcedure4701) + { + testStep = new CT_LbsClientPosTp4701(*this); + } + if(aStepName == KTestProcedure4702) + { + testStep = new CT_LbsClientPosTp4702(*this); + } + if(aStepName == KTestProcedure4703) + { + testStep = new CT_LbsClientPosTp4703(*this); + } + if(aStepName == KTestProcedure4704) + { + testStep = new CT_LbsClientPosTp4704(*this); + } + if(aStepName == KTestProcedure4705) + { + testStep = new CT_LbsClientPosTp4705(*this); + } + if(aStepName == KTestProcedure4706) + { + testStep = new CT_LbsClientPosTp4706(*this); + } + if(aStepName == KTestProcedure4707) + { + testStep = new CT_LbsClientPosTp4707(*this); + } + if(aStepName == KTestProcedure4708) + { + testStep = new CT_LbsClientPosTp4708(*this); + } + if(aStepName == KTestProcedure4709) + { + testStep = new CT_LbsClientPosTp4709(*this); + } + if(aStepName == KTestProcedure4722) + { + testStep = new CT_LbsClientPosTp4722(*this); + } + if(aStepName == KTestProcedure4723) + { + testStep = new CT_LbsClientPosTp4723(*this); + } + return testStep; + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp1.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp1.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,265 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp1.h" +#include +#include +#include +#include + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp1::CT_LbsClientPosTp1(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP1 - Request location from default PSY"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp1::~CT_LbsClientPosTp1() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp1::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp1::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp1::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp1::StartL() + { + ConnectL(); + + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + SetupPsyL(iUidMultiPsy); + + _LIT(KSetupPSY, "TP1: Has Setup Multi PSY"); + INFO_PRINTF1(KSetupPSY); + + //setting priority + TPositionModuleInfo moduleInfoHp;//Hp - high prio; + TPositionModuleInfo moduleInfoLp;//Lp - low prio; + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + db->GetModuleInfoL(prioList->At(0), moduleInfoHp); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + moduleUpdate->SetUpdateAvailability(ETrue); + + if (iUidMultiPsy.iUid == moduleInfoHp.ModuleId().iUid) + { + // Case when Multi PSY has highest prio: + // Ensuring it is enabled + _LIT(KMultiHighest, "TP1: Case when Multi PSY has highest prio"); + INFO_PRINTF1(KMultiHighest); + db->UpdateModuleL((*prioList)[0], *moduleUpdate); + } + else + { + // Case when Multi PSY has not highest prio: + // + _LIT(KMultiNotHighest, "TP1: Case when Multi PSY has NOT highest prio"); + INFO_PRINTF1(KMultiNotHighest); + db->GetModuleInfoL(iUidMultiPsy, moduleInfoLp); + // Ensuring it is enabled + db->UpdateModuleL(iUidMultiPsy, *moduleUpdate); + + TUint hp = db->PriorityL(moduleInfoHp.ModuleId()); + TUint lp = db->PriorityL(moduleInfoLp.ModuleId()); + + // Changing prio of highest prio PSY and Multi PSY. + // Setting Multi PSY to highest prio + db->SetModulePriorityL(iUidMultiPsy, hp); + db->SetModulePriorityL((*prioList)[0], lp); + } + + _LIT(KTestPSY1On, "TP1: Enabling Test PSY 1"); + INFO_PRINTF1(KTestPSY1On); + db -> UpdateModuleL(iUidTestPsy1, *moduleUpdate); + _LIT(KTestPSY2On, "TP1: Enabling Test PSY 2"); + INFO_PRINTF1(KTestPSY2On); + db -> UpdateModuleL(iUidTestPsy2, *moduleUpdate); + + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(2, db); // db, prioList + + User::LeaveIfError(OpenPositioner()); + + // Request data from default psy should be Multi psy + _LIT(KService, "service"); + TPositionInfo posInfo = TPositionInfo(); + TInt err = PerformSyncRequest(KService, &posInfo); + if (err != KErrNone) + { + _LIT(KErrorRequest, "The request was not completed with KErrNone"); + LogErrorAndLeaveL(KErrorRequest, err); + } + + if (iUidMultiPsy.iUid != posInfo.ModuleId().iUid) + { + _LIT(KIncorrectPsyError, "TP1. Position from wrong PSY received"); + LogErrorAndLeaveL(KIncorrectPsyError); + } + + HPositionGenericInfo* genericInfo = HPositionGenericInfo::NewLC(); + err = PerformSyncRequest(KService, &(*genericInfo)); + if (err != KErrNone) + { + _LIT(KErrorRequest, "The request was not completed with KErrNone"); + LogErrorAndLeaveL(KErrorRequest); + } + + if (iUidMultiPsy.iUid != (genericInfo -> ModuleId()).iUid) + { + _LIT(KIncorrectPsyError, + "TP1. Position from wrong PSY received"); + LogErrorAndLeaveL(KIncorrectPsyError); + } + + TPositionCourseInfo courseInfo = TPositionCourseInfo(); + err = PerformSyncRequest(KService, &courseInfo); + if (err != KErrNone) + { + _LIT(KErrorRequest, "Course info supported by default, but request failed"); + LogErrorAndLeaveL(KErrorRequest); + } + + TPositionSatelliteInfo satelliteInfo = TPositionSatelliteInfo(); + err = PerformSyncRequest(KService, &satelliteInfo); + if (err != KErrNone) + { + _LIT(KErrorRequest, "Satellite info supported by default, but request failed"); + LogErrorAndLeaveL(KErrorRequest); + } + + //Changing the priority and verifiy that it still possilbe + //to request updated from a psy if basic position information + //is used and that it is not possilbe to request sat or cource + //any more. + SetupPsyL(iUidTestPsy2); + User::After(3000000); + + // Request data from default psy should be test psy 2 now + err = PerformSyncRequest(KService, &posInfo); + if (err != KErrNone) + { + _LIT(KErrorRequest, "The request was not completed with KErrNone"); + LogErrorAndLeaveL(KErrorRequest); + } + + if (iUidTestPsy2.iUid != posInfo.ModuleId().iUid) + { + _LIT(KIncorrectPsyError, + "TP1. Position from wrong PSY received"); + LogErrorAndLeaveL(KIncorrectPsyError); + } + + err = PerformSyncRequest(KService, &(*genericInfo)); + if (err != KErrNone) + { + _LIT(KErrorRequest, "The request was not completed with KErrNone"); + LogErrorAndLeaveL(KErrorRequest); + } + + if (iUidTestPsy2.iUid != (genericInfo -> ModuleId()).iUid) + { + _LIT(KIncorrectPsyError, + "TP1. Position from wrong PSY received"); + LogErrorAndLeaveL(KIncorrectPsyError); + } + + err = PerformSyncRequest(KService, &courseInfo); + if (err != KErrArgument) + { + _LIT(KErrorRequest, "Course info not supported by default, KErrArgument not returned"); + LogErrorAndLeaveL(KErrorRequest); + } + + + err = PerformSyncRequest(KService, &satelliteInfo); + if (err != KErrArgument) + { + _LIT(KErrorRequest, "Satellite info not supported by default, KErrArgument not returned"); + LogErrorAndLeaveL(KErrorRequest); + } + + //check that it is possilbe to change the different + //type of class info during periodic request and + //that the periodic update will fail if the class + //type is incorrect. + TTimeIntervalMicroSeconds interval = TTimeIntervalMicroSeconds(1000000); + TPositionUpdateOptions posOption; + posOption.SetUpdateInterval(interval); + _LIT(KUpdateErr, "Error when setting update interval, %d"); + err = iPositioner.SetUpdateOptions(posOption); + AssertTrueL(err == KErrNone, KUpdateErr, err); + + _LIT(KErrPeriodic, "The periodic request did not return KErrNone, %d"); + err = PerformSyncRequest(KService, &posInfo); + AssertTrueL(err == KErrNone , KErrPeriodic, err); + + _LIT(KErrPeriodicArr, "The periodic request did not return KErrArgument, %d"); + err = PerformSyncRequest(KService, &satelliteInfo); + AssertTrueL(err == KErrArgument , KErrPeriodicArr, err); + SetupPsyL(iUidMultiPsy); + User::After(3000000); + err = PerformSyncRequest(KService, &satelliteInfo); + AssertTrueL(err == KErrNone , KErrPeriodic, err); + + CleanupStack::PopAndDestroy(genericInfo); + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp1::AssertTrueSecL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp1::AssertTrueL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode) + { + if (!aCondition) + { + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + LogErrorAndLeaveL(buf); + } + } + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp11.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp11.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,133 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp11.h" +#include "ctlbsclientobserver.h" +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp11::CT_LbsClientPosTp11(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP11 - EPos start and termination"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp11::~CT_LbsClientPosTp11() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp11::CheckEPosActivityL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp11::CheckEPosActivityL(TBool aExpectEPosLiveness) + { + if (aExpectEPosLiveness && !CT_LbsClientObserver::EPosAliveL()) + { + _LIT(KError, "Expected EPos server to be alive but it wasn't"); + LogErrorAndLeaveL(KError); + } + if (!aExpectEPosLiveness && CT_LbsClientObserver::EPosAliveL()) + { + _LIT(KError, "Expected EPos server to be dead but it wasn't"); + LogErrorAndLeaveL(KError); + } + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp11::ServerAliveL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CT_LbsClientPosTp11::ServerAliveL(const TDesC& aServerName) + { + TFindServer find(aServerName); + TFullName name; + if (find.Next(name) == KErrNone) // server found + { + TBuf<100> buf; + _LIT(KFoundServer, "Found server: "); + buf.Append(KFoundServer); + buf.Append(name); + INFO_PRINTF1(buf); + return ETrue; + } + else + { + return EFalse; + } + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp11::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp11::StartL() + { + const TInt KTimeEPosIsStillActive = 1000000; + const TInt KTimeEPosHasShutDown = 4000000; + + User::After(2000000); + + CT_LbsClientObserver::WaitForEPosShutdown(); + + RPositionServer client1; + RPositionServer client2; + RPositionServer client3; + + CheckEPosActivityL(EFalse); + + User::LeaveIfError(client1.Connect()); + CleanupClosePushL(client1); + CheckEPosActivityL(ETrue); + + User::LeaveIfError(client2.Connect()); + CleanupClosePushL(client2); + CheckEPosActivityL(ETrue); + + User::LeaveIfError(client3.Connect()); + CleanupClosePushL(client3); + CheckEPosActivityL(ETrue); + + client1.Close(); + CheckEPosActivityL(ETrue); + client2.Close(); + CheckEPosActivityL(ETrue); + client3.Close(); + + User::After(TTimeIntervalMicroSeconds32(KTimeEPosIsStillActive)); + CheckEPosActivityL(ETrue); + User::After(TTimeIntervalMicroSeconds32( + KTimeEPosHasShutDown - KTimeEPosIsStillActive)); + CheckEPosActivityL(EFalse); + + CleanupStack::Pop(3); // client1-3 + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp169.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp169.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,496 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp169.h" +#include +#include +#include +#include +#include +#include + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp169::CT_LbsClientPosTp169(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP169 - Modules Db Tests"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp169::~CT_LbsClientPosTp169() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp169::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp169::StartL() + { + _LIT(KErrorMsg1, "Wrong priority order in module list"); + + + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + +//////////////////// TC194 //////////////////// List Modules + + _LIT(KErrorMsg4, "Mismatch between list by settings & aquisition API"); + _LIT(KErrorMsg2, "Installed module in list is returned as uninstalled by IsModuleInstalled"); + TUid moduleUid; + TUid moduleid1; + TUint lastPrio = 0; + TUint thisPrio = 0; + TInt count = 0; + TPositionModuleInfo moduleInfo; + for (count = 0 ; count < prioList->Count() ; count++) + { + moduleUid = (*prioList)[count]; + //////////////////////////////////// + + + TBool IsInstalled=db->IsModuleInstalled(moduleUid); + AssertTrueL(IsInstalled,KErrorMsg2); + + db->GetModuleInfoL((*prioList)[count], moduleInfo); + moduleid1=moduleInfo.ModuleId(); + AssertTrueL(moduleid1==moduleUid,KErrorMsg4); + //////////////////////////////////// + + thisPrio = db->PriorityL(moduleUid); + + if (count > 0) + { + AssertTrueL(thisPrio > lastPrio, + KErrorMsg1); + } + + lastPrio = thisPrio; + } + + CleanupStack::PopAndDestroy(prioList); // prioList + +//////////////////// TC195 //////////////////// Get Module Properties + + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); // destroy! + moduleUpdate->SetUpdateAvailability(ETrue); + moduleUpdate->SetUpdateCost(TPositionQuality::ECostCharge); // EEPosHigh + ////////////////////////////////////////////////// + moduleUpdate->SetUpdateVisibility(ETrue); + db->UpdateModuleL(iUidTestPsy2, *moduleUpdate); + + + db->SetModulePriorityL(iUidTestPsy2, 3); + + db->GetModuleInfoL(iUidTestPsy2, + moduleInfo); + + + + TPositionQuality quality; + moduleInfo.GetPositionQuality(quality); + + _LIT(KModName, "Test PSY 2"); + _LIT(KStatusErrorText, "Wrong status data in module info"); + _LIT(KVersionErrorText, "Wrong version data in module info"); + _LIT(KUidErrorText, "Wrong uid data in module info"); + _LIT(KNameErrorText, "Wrong name data in module info"); + _LIT(KPosTechErrorText, "Wrong pos tech data in module info"); + _LIT(KTTFFErrorText, "Wrong TTFF data in module info"); + _LIT(KTTFErrorText, "Wrong TTF data in module info"); + _LIT(KHAccErrorText, "Wrong HAcc data in module info"); + _LIT(KVAccErrorText, "Wrong VAcc data in module info"); + _LIT(KCostErrorText, "Wrong cost data in module info"); + _LIT(KPowerCostErrorText, "Wrong power cost data in module info"); + _LIT(KClassesErrorText, "Wrong class info in module info"); + + + AssertTrueL(moduleInfo.IsAvailable(), KStatusErrorText); + TVersion version = moduleInfo.Version(); + AssertTrueL(version.iMajor == 1, KVersionErrorText); + AssertTrueL(version.iMinor == 0, KVersionErrorText); + AssertTrueL(version.iBuild == 0, KVersionErrorText); + + AssertTrueL(moduleInfo.ModuleId() == iUidTestPsy2, KUidErrorText); + TBuf<100> moduleName; + moduleInfo.GetModuleName(moduleName); + AssertTrueL(moduleName == KModName, KNameErrorText); + AssertTrueL(moduleInfo.TechnologyType() == TPositionModuleInfo::ETechnologyTerminal, + KPosTechErrorText); + + AssertTrueL(moduleInfo.ClassesSupported(EPositionInfoFamily) == + (EPositionGenericInfoClass | EPositionInfoClass), + KClassesErrorText); + + AssertTrueL(quality.TimeToFirstFix() == TTimeIntervalMicroSeconds(3000000), + KTTFFErrorText); + AssertTrueL(quality.TimeToNextFix() == TTimeIntervalMicroSeconds(3000000), + KTTFErrorText); + AssertTrueL(quality.HorizontalAccuracy() == 2, KHAccErrorText); + AssertTrueL(quality.VerticalAccuracy() == 3, KVAccErrorText); + AssertTrueL(quality.CostIndicator() == TPositionQuality::ECostCharge, + KCostErrorText); // Updated cost value + AssertTrueL(quality.PowerConsumption() == TPositionQuality::EPowerZero, + KPowerCostErrorText); + +//////////////////// TC196 //////////////////// Set Module Properties + + _LIT(KErrorTp196b, "Cost not updated correctly"); + _LIT(KErrorMsg3, "Wrong Visibility"); + _LIT(KErrorMsgPrio, "Changing priority of an invisible module"); + + // Make sure test psy 2 is enabled. + CPosModuleUpdate* moduleUpdate196 = CPosModuleUpdate::NewLC(); // destroy! + moduleUpdate196->SetUpdateAvailability(ETrue); + moduleUpdate->SetUpdateCost(TPositionQuality::ECostZero); + db->UpdateModuleL(iUidTestPsy2, *moduleUpdate196); + + // Disable psy + moduleUpdate196->SetUpdateAvailability(EFalse); + db->UpdateModuleL(iUidTestPsy2, *moduleUpdate196); + + // Update cost variable to ECostZero + moduleUpdate196->SetUpdateCost(TPositionQuality::ECostZero); + db->UpdateModuleL(iUidTestPsy2, *moduleUpdate196); + db->GetModuleInfoL(iUidTestPsy2, + moduleInfo); + moduleInfo.GetPositionQuality(quality); + AssertTrueL(quality.CostIndicator() == TPositionQuality::ECostZero, KErrorTp196b); + + // Update cost variable to ECostPossible + moduleUpdate196->SetUpdateCost(TPositionQuality::ECostPossible); + db->UpdateModuleL(iUidTestPsy2, *moduleUpdate196); + db->GetModuleInfoL(iUidTestPsy2, + moduleInfo); + moduleInfo.GetPositionQuality(quality); + AssertTrueL(quality.CostIndicator() == TPositionQuality::ECostPossible, KErrorTp196b); + + // Update cost variable to high + moduleUpdate196->SetUpdateCost(TPositionQuality::ECostCharge); + db->UpdateModuleL(iUidTestPsy2, *moduleUpdate196); + db->GetModuleInfoL(iUidTestPsy2, + moduleInfo); + moduleInfo.GetPositionQuality(quality); + AssertTrueL(quality.CostIndicator() == TPositionQuality::ECostCharge, KErrorTp196b); + + + //////////////////////////////////// + moduleUpdate196->SetUpdateAvailability(ETrue); + + moduleUpdate196->SetUpdateVisibility(EFalse); + db->UpdateModuleL(iUidTestPsy2, *moduleUpdate196); + TBool IsVisble=db->IsModuleVisibleL(iUidTestPsy2); + AssertTrueL(IsVisble==EFalse, + KErrorMsg3); + + // Change priority of an invisible module + + TRAPD(err,db->SetModulePriorityL(iUidTestPsy2, 4)); + AssertTrueL(err==KErrNotFound,KErrorMsgPrio); + + + moduleUpdate196->SetUpdateVisibility(ETrue); + db->UpdateModuleL(iUidTestPsy2, *moduleUpdate196); + IsVisble=db->IsModuleVisibleL(iUidTestPsy2); + AssertTrueL(IsVisble,KErrorMsg3); + //////////////////////////////////// + +//////////////////// TC197 //////////////////// Module Priority + + // Change the priority of the external gps module, and check that the other + // modules are updated correctly + // Change from 6 to 3 + + _LIT(KErrorTextPrio, "Priority test failed after change of priority"); + _LIT(KErrorVisibility1, "Invisible module is in list"); + _LIT(KErrorVisibility2, "visible module is not in list after changing it from invisible"); + db->SetModulePriorityL(iUidTestPsy2, 6); + prioList = db->ModuleIdListLC(); + lastPrio = 0; + thisPrio = 0; + for (count = 0 ; count < prioList->Count() ; count++) + { + moduleUid = (*prioList)[count]; + thisPrio = db->PriorityL(moduleUid); + + if (count > 0) + { + AssertTrueL(thisPrio > lastPrio, + KErrorMsg1); + } + + lastPrio = thisPrio; + } + + // Remember the uid:s of the modules close to iUidTestPsy2: + TUid uid2a = (*prioList)[2]; + TUid uid3a = (*prioList)[3]; + TUid uid4a = (*prioList)[4]; + TUid uid5a = (*prioList)[5]; + TUid uid6a = (*prioList)[6]; + TUid uid7a = (*prioList)[7]; + TUid uid8a = (*prioList)[8]; + TUid uid0a = (*prioList)[0]; + + db->SetModulePriorityL(iUidTestPsy2, 3); + + CleanupStack::PopAndDestroy(prioList); // prioList + prioList = db->ModuleIdListLC(); + + TUid uid2b = (*prioList)[2]; + TUid uid3b = (*prioList)[3]; + TUid uid4b = (*prioList)[4]; + TUid uid5b = (*prioList)[5]; + TUid uid6b = (*prioList)[6]; + TUid uid7b = (*prioList)[7]; + TUid uid8b = (*prioList)[8]; + TUid uid0b = (*prioList)[0]; + + AssertTrueL(uid2a == uid2b, KErrorTextPrio); + AssertTrueL(uid3a == uid4b, KErrorTextPrio); + AssertTrueL(uid4a == uid5b, KErrorTextPrio); + AssertTrueL(uid5a == uid6b, KErrorTextPrio); + AssertTrueL(uid6a == uid3b, KErrorTextPrio); + AssertTrueL(uid7a == uid7b, KErrorTextPrio); + AssertTrueL(uid8a == uid8b, KErrorTextPrio); + AssertTrueL(uid0a == uid0b, KErrorTextPrio); + + db->SetModulePriorityL(iUidTestPsy2, 7); + + CleanupStack::PopAndDestroy(prioList); // prioList + prioList = db->ModuleIdListLC(); + + uid2a = (*prioList)[2]; + uid3a = (*prioList)[3]; + uid4a = (*prioList)[4]; + uid5a = (*prioList)[5]; + uid6a = (*prioList)[6]; + uid7a = (*prioList)[7]; + uid8a = (*prioList)[8]; + uid0a = (*prioList)[0]; + TUid uid1a = (*prioList)[1]; + + AssertTrueL(uid2b == uid2a, KErrorTextPrio); + AssertTrueL(uid3b == uid7a, KErrorTextPrio); + AssertTrueL(uid4b == uid3a, KErrorTextPrio); + AssertTrueL(uid5b == uid4a, KErrorTextPrio); + AssertTrueL(uid6b == uid5a, KErrorTextPrio); + AssertTrueL(uid7b == uid6a, KErrorTextPrio); + AssertTrueL(uid8b == uid8a, KErrorTextPrio); + AssertTrueL(uid0b == uid0a, KErrorTextPrio); + + + TInt bottomPrio = prioList->Count() - 1; + + // Change top priority to bottom priority + + db->SetModulePriorityL(uid0a, bottomPrio); + CleanupStack::PopAndDestroy(prioList); // prioList + prioList = db->ModuleIdListLC(); + + AssertTrueL((*prioList)[0] == uid1a, KErrorTextPrio); + AssertTrueL(uid0a == (*prioList)[bottomPrio], KErrorTextPrio); + AssertTrueL(uid7a == (*prioList)[6], KErrorTextPrio); + + + // Change bottom priority to top priority + TUid topPrioUid = (*prioList)[0]; + TUid bottomPrioUid = (*prioList)[bottomPrio]; + TUid nextBottomPrioUid = (*prioList)[bottomPrio - 1]; + + db->SetModulePriorityL(bottomPrioUid, 0); + CleanupStack::PopAndDestroy(prioList); // prioList + prioList = db->ModuleIdListLC(); + + AssertTrueL((*prioList)[0] == bottomPrioUid, KErrorTextPrio); + AssertTrueL((*prioList)[1] == topPrioUid, KErrorTextPrio); + AssertTrueL((*prioList)[bottomPrio] == nextBottomPrioUid, KErrorTextPrio); + + CleanupStack::PopAndDestroy(prioList); // prioList + + //////////////////////////////////// + + db->SetModulePriorityL(iUidTestPsy2, 0); + + prioList = db->ModuleIdListLC(); + + uid0a = (*prioList)[0]; + uid1a = (*prioList)[1]; + uid2a = (*prioList)[2]; + uid3a = (*prioList)[3]; + uid4a = (*prioList)[4]; + uid5a = (*prioList)[5]; + uid6a = (*prioList)[6]; + uid7a = (*prioList)[7]; + uid8a = (*prioList)[8]; + + moduleUpdate196->SetUpdateVisibility(EFalse); + db->UpdateModuleL(iUidTestPsy2, *moduleUpdate196); + + CleanupStack::PopAndDestroy(prioList); // prioList + prioList = db->ModuleIdListLC(); + + TInt IsInList=prioList->Find(iUidTestPsy2); + AssertTrueL(IsInList==KErrNotFound, KErrorVisibility1); + + + uid0b = (*prioList)[0]; + TUid uid1b = (*prioList)[1]; + uid2b = (*prioList)[2]; + uid3b = (*prioList)[3]; + uid4b = (*prioList)[4]; + uid5b = (*prioList)[5]; + uid6b = (*prioList)[6]; + uid7b = (*prioList)[7]; + + + AssertTrueL(uid1a == uid0b, KErrorTextPrio); + AssertTrueL(uid2a == uid1b, KErrorTextPrio); + AssertTrueL(uid3a == uid2b, KErrorTextPrio); + AssertTrueL(uid4a == uid3b, KErrorTextPrio); + AssertTrueL(uid5a == uid4b, KErrorTextPrio); + AssertTrueL(uid6a == uid5b, KErrorTextPrio); + AssertTrueL(uid7a == uid6b, KErrorTextPrio); + AssertTrueL(uid8a == uid7b, KErrorTextPrio); + + moduleUpdate196->SetUpdateVisibility(ETrue); + db->UpdateModuleL(iUidTestPsy2, *moduleUpdate196); + + CleanupStack::PopAndDestroy(prioList); // prioList + prioList = db->ModuleIdListLC(); + + IsInList=prioList->Find(iUidTestPsy2); + + TInt priority=db->PriorityL(iUidTestPsy2); + + + AssertTrueL(IsInList==priority, KErrorVisibility2); + + CleanupStack::PopAndDestroy(prioList); // prioList + CleanupStack::PopAndDestroy(2, moduleUpdate); + + //////////////////////////////////// + + CleanupStack::PopAndDestroy(db); // db + + } + + +// --------------------------------------------------------- +// CT_LbsClientPosTp169::TestNaNFromPSY +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp169::TestNaNFromPSY() + { + _LIT(KFunctionName, "We are inside TestNaNFromPSY()"); + INFO_PRINTF1(KFunctionName); + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + TPositionModuleInfo moduleInfo; + TBuf<100> moduleName; + + // Use Panic Psy in this test, should have Horizontal accuracy defined to 0 + // and vertical accuracy not defined at all in resource file (should default to 0) + // and when reading these attributes using the modulesdb they should be of type NaN (Not A Number) + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidPanicPsy, *moduleUpdate); + + db->GetModuleInfoL(iUidPanicPsy, + moduleInfo); + + moduleInfo.GetModuleName(moduleName); + + TPositionQuality quality; + moduleInfo.GetPositionQuality(quality); + + if (!Math::IsNaN(quality.HorizontalAccuracy())) + { + _LIT(KErrorAndLeave, "HorizontalAccuracy should be NaN"); + LogErrorAndLeaveL(KErrorAndLeave); + } + else + { + _LIT(KHorizontalAccuracy, "HorizontalAccuracy NaN"); + INFO_PRINTF1(KHorizontalAccuracy); + } + + if (!Math::IsNaN(quality.VerticalAccuracy())) + { + _LIT(KErrorAndLeave, "VerticalAccuracy should be NaN"); + LogErrorAndLeaveL(KErrorAndLeave); + } + else + { + _LIT(KVerticalAccuracy, "VerticalAccuracy NaN"); + INFO_PRINTF1(KVerticalAccuracy); + } + + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp169::AssertTrueL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp169::AssertTrueL(TBool aCondition, const TDesC& aErrorMsg) + { + if (!aCondition) + { + LogErrorAndLeaveL(aErrorMsg); + } + } + + +// --------------------------------------------------------- +// CT_LbsClientPosTp169::AssertTrueSecL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp169::AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode) + { + if (!aCondition) + { + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + LogErrorAndLeaveL(buf); + } + } + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp17.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp17.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,63 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp17.h" + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp17::CT_LbsClientPosTp17(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP17 - Open nonexisting PSY"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp17::~CT_LbsClientPosTp17() + { + } +// --------------------------------------------------------- +// CT_LbsClientPosTp17::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp17::StartL() + { + TUid nonExistent; + nonExistent.iUid = 0x01234DCBD; + + TBuf<100> output; + + ConnectL(); + TInt err = OpenPositionerByName(nonExistent); + if (err != KErrNotFound ) + { + output.Format(output, KErrNotFound , err); + LogErrorAndLeaveL(output); + } + Disconnect(); + } + +//End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp173.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp173.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,358 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + + +// INCLUDES +#include "ctlbsclientpostp173.h" +#include +#include +#include +#include +#include +#include +#include "tctlbsclientmodulesobserver.h" + + +void MyStopActive(TAny* /*aAny*/) + { + CActiveScheduler::Stop(); + } + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp173::CT_LbsClientPosTp173(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP173 - Notify Module Events"); + SetTestStepName(KTestName); + } + + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp173::~CT_LbsClientPosTp173() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp173::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp173::StartL() + { + iNoEvents = EFalse; + iError = EFalse; + // This test listens for events. + // There is no data in the event, so all that is needed to be done is + // to see that an event is generated. This test doesn't fail if unsuccessful, + // it hangs. + + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + db->SetObserverL(*this); + + TInt prio = db->PriorityL(iUidTestPsy2); + if (prio > 0) + { + prio = 0; + } + else + { + prio = 1; // this assumes that more that one PSY is installed + } + + CPosModuleUpdate* visibileUpdate = CPosModuleUpdate::NewLC(); + visibileUpdate->SetUpdateVisibility(ETrue); + db->UpdateModuleL(iUidTestPsy2, *visibileUpdate); + + db->SetModulePriorityL(iUidTestPsy2, prio); + CleanupStack::PopAndDestroy(visibileUpdate); + + + // Wait for event + DoEventHandlingL(); + + CPosModuleUpdate* availUpdate = CPosModuleUpdate::NewLC(); + + + TPositionModuleInfo info; + db -> GetModuleInfoL(iUidTestPsy2, info); + TBool available = info.IsAvailable(); + + availUpdate->SetUpdateAvailability(/*ETrue*/ !available); + db->UpdateModuleL(iUidTestPsy2, *availUpdate); + + CleanupStack::PopAndDestroy(availUpdate); + + // Wait for event + DoEventHandlingL(); + + CPosModuleUpdate* costUpdate = CPosModuleUpdate::NewLC(); + + TPositionQuality quality; + info.GetPositionQuality(quality); + TPositionQuality::TCostIndicator indicator = quality.CostIndicator(); + switch (indicator) + { + case TPositionQuality::ECostUnknown: + indicator = TPositionQuality::ECostZero; + break; + case TPositionQuality::ECostZero: + indicator = TPositionQuality::ECostPossible; + break; + case TPositionQuality::ECostPossible: + indicator = TPositionQuality::ECostCharge; + break; + case TPositionQuality::ECostCharge: + indicator = TPositionQuality::ECostPossible; + break; + default: + _LIT(KErrorAndLeave, "quality indicator does not exist"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + costUpdate->SetUpdateCost(/*TPositionQuality::ECostCharge*/ indicator); + db->UpdateModuleL(iUidTestPsy2, *costUpdate); + + CleanupStack::PopAndDestroy(costUpdate); + + // Wait for event + DoEventHandlingL(); + + //////////////////////////////////// + + CPosModuleUpdate* visibilityUpdate = CPosModuleUpdate::NewLC(); + visibilityUpdate->SetUpdateVisibility(EFalse); + db->UpdateModuleL(iUidTestPsy2, *visibilityUpdate); + CleanupStack::PopAndDestroy(visibilityUpdate); + + DoEventHandlingL(); + + //////////////////////////////////// + + CMyNotificationTimer* timer = CMyNotificationTimer::NewLC(this); + + TTimeIntervalMicroSeconds ttfUpdate(1000000); + TPositionQuality dynQualityUpdate; + dynQualityUpdate.SetHorizontalAccuracy(30.0); + dynQualityUpdate.SetTimeToNextFix(ttfUpdate); + + timer->StartNotificationTimer(); + iNoEvents = ETrue; + // Wait for event + DoEventHandlingL(); + +//////////////////////////////////// + + + + + db->RemoveObserver(); + CleanupStack::PopAndDestroy(2, db); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp173::DoEventHandlingL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp173::DoEventHandlingL() + { + //User::After(20); + CActiveScheduler::Start(); + CheckErrorL(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp173::CheckErrorL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp173::CheckErrorL() + { + if (iError) + { + LogErrorAndLeaveL(iErrorText); + } + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp173::HandleDatabaseChangeL +// +// (other items were commented in a header). +// --------------------------------------------------------- +void CT_LbsClientPosTp173::HandleSettingsChangeL(TPosModulesEvent /*aModuleEvent*/) + { + + CleanupStack::PushL(TCleanupItem(MyStopActive)); + if (iNoEvents) + { + _LIT(KErrorText, "Event received when no event should have been received"); + iErrorText = KErrorText; + iError = ETrue; + } + + CleanupStack::PopAndDestroy(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp173::AssertTrueSecL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp173::AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode) + { + if (!aCondition) + { + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + LogErrorAndLeaveL(buf); + } + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp173::NotifyTimeout +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp173::NotifyTimeout() + { + CleanupStack::PushL(TCleanupItem(MyStopActive)); + if (!iNoEvents) + { + _LIT(KErrorText, "No event received when event should have been received"); + iErrorText = KErrorText; + iError = ETrue; + } + + CleanupStack::PopAndDestroy(); + } + +// --------------------------------------------------------- +// CNotificationTimer::~CNotificationTimer +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +//Implementation of a CNotificationTimer + +// destructor +CMyNotificationTimer::~CMyNotificationTimer() + { + Cancel(); + iMainControl = NULL; + } + +// --------------------------------------------------------- +// CNotificationTimer::NewLC +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +// Two-phased constructor. +CMyNotificationTimer* CMyNotificationTimer::NewLC(CT_LbsClientPosTp173* aMainControl) + { + CMyNotificationTimer* self=new (ELeave) CMyNotificationTimer(aMainControl); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------- +// CNotificationTimer::NewL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +// Two-phased constructor. +CMyNotificationTimer* CMyNotificationTimer::NewL(CT_LbsClientPosTp173* aMainControl) + { + CMyNotificationTimer* self = NewLC(aMainControl); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------- +// CNotificationTimer::StartNotificationTimer +// +// (other items were commented in a header). +// --------------------------------------------------------- +void CMyNotificationTimer::StartNotificationTimer() + { + CTimer::After(iNotificationTimout); + } + +// --------------------------------------------------------- +// CNotificationTimer::DoCancel +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CMyNotificationTimer::DoCancel() + { + CTimer::DoCancel(); + } + +// --------------------------------------------------------- +// CNotificationTimer::ConstructL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CMyNotificationTimer::ConstructL() + { + CTimer::ConstructL(); + iNotificationTimout = 5000000; + //add this object to the active scheduler + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------- +// CNotificationTimer::CNotificationTimer +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +//c++ default constructor +CMyNotificationTimer::CMyNotificationTimer(CT_LbsClientPosTp173* aMainControl) +:CTimer(CActive::EPriorityStandard) + { + iMainControl = aMainControl; + } + +// --------------------------------------------------------- +// CNotificationTimer::RunL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CMyNotificationTimer::RunL() + { + iMainControl->NotifyTimeout(); + } + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp176.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp176.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,203 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp176.h" +#include +#include +#include +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp176::CT_LbsClientPosTp176(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP176 - Basic PSY test"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp176::~CT_LbsClientPosTp176() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp176::CloseTest +// Always called after the test, even if the test leaves +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp176::CloseTest() + { + + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp176::CloseTest +// Always called after the test, even if the test leaves +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp176::InitTestL() + { + + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp176::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp176::StartL() + { + _LIT(KService, "service"); + CPosModules *modDb = CPosModules::OpenL(); + CleanupStack::PushL(modDb); + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(ETrue); + modDb->UpdateModuleL(iUidTestPsyTp176, *moduleUpdate); + modDb->UpdateModuleL(iUidTestPsy1, *moduleUpdate); + + CleanupStack::PopAndDestroy(2); + + ConnectL(); + + User::LeaveIfError(OpenPositionerByName(iUidTestPsyTp176)); + TPositionInfo info = TPositionInfo(); + + // Request data from test psy 176 psy + TInt err = PerformSyncRequest(KService, &info); + + if (err != KErrNone) + { + _LIT(KErrorRequest, "The request was not completed with KErrorNone"); + LogErrorAndLeaveL(KErrorRequest); + } + + // just to make sure that dynamic quality is updated + err = PerformSyncRequest(KService, &info); + + if (err != KErrNone) + { + _LIT(KErrorRequest, "The request was not completed with KErrorNone"); + LogErrorAndLeaveL(KErrorRequest); + } + + + HPositionGenericInfo* genericInfo = HPositionGenericInfo::NewLC(); + + // Request a genericInfo from test psy 176 should fail. + err = PerformSyncRequest(KService, genericInfo); + + + //Magic number KErrHardwareNotAvailable is used to check that the psy is + //not responsible for determine if the class is supported. + if (err == KErrHardwareNotAvailable) + { + _LIT(KErrorRequest, "The type checking was done in the PSY"); + LogErrorAndLeaveL(KErrorRequest); + } + else if (err != KErrArgument) + { + _LIT(KErrWrongType, "Wrong error type returned"); + LogErrorAndLeaveL(KErrWrongType); + } + + + // not set uid + err = PerformSyncRequest(KService, &info); + + if (err != KErrGeneral) + { + _LIT(KErrorRequest, "The request was not completed with KErrGeneral"); + LogErrorAndLeaveL(KErrorRequest); + } + + + // incorrect uid, but existing + err = PerformSyncRequest(KService, &info); + if (err != KErrGeneral) + { + _LIT(KErrorRequest, "The request was not completed with KErrGeneral"); + LogErrorAndLeaveL(KErrorRequest); + } + + //incorrect uid + err = PerformSyncRequest(KService, &info); + if (err != KErrGeneral) + { + _LIT(KErrorRequest, "The request was not completed with KErrGeneral"); + LogErrorAndLeaveL(KErrorRequest); + } + + + ClosePositioner(); + Disconnect(); + + CleanupStack::PopAndDestroy(); //genericInfo + + } + + + +TBool CT_LbsClientPosTp176::IsQualityUpdatedL(TUid aUid) + { + TBool updated = ETrue; + CPosModules *modDb = CPosModules::OpenL(); + CleanupStack::PushL(modDb); + + TPositionQuality dynQuality; + + //TTimeIntervalMicroSeconds timeToFirstFix = dynQuality.TimeToNextFix(); + TTimeIntervalMicroSeconds timeToFirstFixBefore; + TReal32 horAccBefore; + TReal32 horAccAfter = dynQuality.HorizontalAccuracy(); + + if (aUid == iUidTestPsyTp176) + { + timeToFirstFixBefore = iQuality.TimeToNextFix(); + horAccBefore = iQuality.HorizontalAccuracy(); + } + else + { + timeToFirstFixBefore = iQualityTestPsy1.TimeToNextFix(); + horAccBefore = iQualityTestPsy1.HorizontalAccuracy(); + } + + + if (horAccBefore != horAccAfter) + { + updated = ETrue; + iQuality = dynQuality; + _LIT(KUpdated, "Dynamic Quality is updated"); + INFO_PRINTF1(KUpdated); + } + else + { + updated = EFalse; + _LIT(KNotUpdated, "Dynamic Quality is NOT updated"); + INFO_PRINTF1(KNotUpdated); + } + + CleanupStack::PopAndDestroy(); + return updated; + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp178.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp178.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,366 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp178.h" +#include +#include + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp178::CT_LbsClientPosTp178(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "Tp178 - Request Timeout"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp178::~CT_LbsClientPosTp178() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp178::CloseTest +// Always called after the test, even if the test leaves +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp178::CloseTest() +{ + ClosePositioner(); + Disconnect(); +} + + +TInt Timeout178(TAny* /*aNothing*/) + { + CActiveScheduler::Stop(); + return KErrNone; + } + +void StartSchedulerForAWhile178L(TTimeIntervalMicroSeconds32 aTimeout) + { + CPeriodic* timer = CPeriodic::NewL(CActive::EPriorityStandard); + CleanupStack::PushL(timer); + timer->Start(aTimeout, aTimeout, TCallBack(Timeout178)); + CActiveScheduler::Start(); + CleanupStack::PopAndDestroy(timer); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp178::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp178::StartL() + { + _LIT(KServiceAccept, "SAAA"); + + SetupPsyL(iUidTestPsy3); + + RPositioner positioner; + TPositionInfo info = TPositionInfo(); + + ConnectL(); + + User::LeaveIfError(positioner.Open(iPosServer,iUidTestPsy3)); + CleanupClosePushL(positioner); + + TInt Err = positioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KServiceAccept); + + TPositionUpdateOptions updateOptionsLong, updateOptionsShort; + + TTimeIntervalMicroSeconds longInterval(7000000); + + updateOptionsLong.SetUpdateTimeOut(longInterval); + Err = positioner.SetUpdateOptions(updateOptionsLong); + + TTimeIntervalMicroSeconds shortInterval(2000000); + updateOptionsShort.SetUpdateTimeOut(shortInterval); + + TPositionUpdateOptions theUpdateOptions; + Err = positioner.GetUpdateOptions(theUpdateOptions); + + if (theUpdateOptions.UpdateTimeOut() != updateOptionsLong.UpdateTimeOut() || + updateOptionsLong.UpdateTimeOut() != longInterval) + { + _LIT(KUpdateOptions, "The update option was not set correctly"); + LogErrorAndLeaveL(KUpdateOptions); + } + + _LIT(KDelayMsg, "The successfull requests was completed within %d microsecs."); + _LIT(KCancelMsg, "The canceled requests was completed within %d microsecs."); + + TRequestStatus status; + + for (TInt i = 0; i < 10; i++) // makes 10 test inorder to get some statistic + { + + positioner.SetUpdateOptions(updateOptionsLong); + TTime requestStartTime; + + requestStartTime.UniversalTime(); + positioner.NotifyPositionUpdate(info, status); + User::WaitForRequest(status); + TTime requestStopTime; + requestStopTime.UniversalTime(); + + TTimeIntervalMicroSeconds durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime); + + TInt duration = durationMicro.Int64(); + + TBuf<100> timeMsg; + timeMsg.Format(KDelayMsg, duration); + INFO_PRINTF1(timeMsg); + + //check error status + if (status != KErrNone) + { + _LIT(KErrPositionRequest, "error code returned from NotifyPositionUpdate, error code = %d"); + TBuf<100> buf; + buf.Format(KErrPositionRequest, status.Int()); + LogErrorAndLeaveL(buf); + } + + + TTimeIntervalMicroSeconds shortInterval(2000000); + updateOptionsShort.SetUpdateTimeOut(shortInterval); + + positioner.SetUpdateOptions(updateOptionsShort); + + requestStartTime.UniversalTime(); + positioner.NotifyPositionUpdate(info, status); + User::WaitForRequest(status); + requestStopTime.UniversalTime(); + + durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime); + + duration = durationMicro.Int64(); + +#ifdef __WINS__ + TTimeIntervalMicroSeconds winsFail(100000); + durationMicro = TTimeIntervalMicroSeconds(durationMicro.Int64()+winsFail.Int64()); +#endif + + timeMsg.Format(KCancelMsg, duration); + INFO_PRINTF1(timeMsg); + + + if (status != KErrTimedOut) + { + _LIT(KErrPositionRequest, "Request did not returned KErrTimedOut, status code = %d."); + TBuf<100> buf; + buf.Format(KErrPositionRequest, status.Int()); + LogErrorAndLeaveL(buf); + } + + //Check that the request was not aborted before the Interval + //Remove this condition if a lot of data is needed in test log. + if (durationMicro < shortInterval) + { + _LIT(KErrInterval, " The request was aborted before the set timed out "); + LogErrorAndLeaveL(KErrInterval); + } + + + } // end for loop + CleanupStack::PopAndDestroy(1); //positioner + Disconnect(); + + // Do timeout test + TestTimeoutL(); + + // Do cancel test + TestCancelL(); + + // ESLI-5QRA7U just check that it is not possible to set a timeout that is less than + // the update interval + TestOptionL(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp178::TestTimeout +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp178::TestTimeoutL() + { + _LIT(KSTART, "TestTimeout()"); + _LIT(KEND, "TestTimeout() passed"); + _LIT(KTIME, "Request took %d us"); + + // Setup verification stuff + INFO_PRINTF1(KSTART); + + //TPrivDlgDiagnostics tmpdiag; + TTime requestStartTime; + TTime requestStopTime; + TTimeIntervalMicroSeconds durationMicro; + + TBuf<100> buf; + + _LIT(KService, "SAAA"); + TPositionUpdateOptions updateOptions; + + TTimeIntervalMicroSeconds longInterval(7000000); + ConnectL(); + SetupPsyL(iUidTestPsy3); + + OpenPositionerByName(iUidTestPsy3); + updateOptions.SetUpdateTimeOut(longInterval); + + // Access protected member (iPositioner) here + iPositioner.SetUpdateOptions(updateOptions); + + _LIT(KONE, "Perform first request, should NOT time out"); + INFO_PRINTF1(KONE); + + requestStartTime.UniversalTime(); + //Make one request to verify psy + PerformRequestL(KService, CRequestor::ERequestorService, CRequestor::EFormatApplication); + + CheckRequestResultL(KErrNone); + requestStopTime.UniversalTime(); + + durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime); + TInt duration = durationMicro.Int64(); + + buf.Format(KTIME, duration); + INFO_PRINTF1(buf); + + ClosePositioner(); + + OpenPositionerByName(iUidTestPsy3); + // ECancelButton means that the Automatised class should wait for a cancel call + // before returning result + + updateOptions.SetUpdateTimeOut(longInterval); + + // Access protected (iPositioner) member here + iPositioner.SetUpdateOptions(updateOptions); + + _LIT(KTWO, "Perform second request, should not time out"); + INFO_PRINTF1(KTWO); + + //Make one request to verify psy + TPositionInfo info = TPositionInfo(); + requestStartTime.UniversalTime(); + TInt err = PerformSyncRequest(KService, &info); + requestStopTime.UniversalTime(); + + if (err != KErrNone) + { + _LIT(KError, "Wrong result from iStatus, should be KErrNone, was %d"); + TBuf<100> buf; + buf.Format(KError, err); + LogErrorAndLeaveL(buf); + } + + durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime); + duration = durationMicro.Int64(); + + buf.Format(KTIME, duration); + INFO_PRINTF1(buf); + + ClosePositioner(); + Disconnect(); + + INFO_PRINTF1(KEND); +} + +// --------------------------------------------------------- +// CT_LbsClientPosTp178::TestCancel +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp178::TestCancelL() + { + _LIT(KSTART, "TestCancel()"); + _LIT(KEND, "TestCancel() passed"); + + // Setup verification stuff + INFO_PRINTF1(KSTART); + + _LIT(KService, "SAAA"); + ConnectL(); + SetupPsyL(iUidTestPsy3); + + OpenPositionerByName(iUidTestPsy3); + + PerformRequestL(KService, CRequestor::ERequestorService, CRequestor::EFormatApplication); + StartSchedulerForAWhile178L(2000000); + iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); + CheckRequestResultL(KErrCancel); + + ClosePositioner(); + Disconnect(); + + INFO_PRINTF1(KEND); +} + + +void CT_LbsClientPosTp178::TestOptionL() + { + SetupPsyL(iUidTestPsy3); + + RPositioner positioner; + + ConnectL(); + + User::LeaveIfError(positioner.Open(iPosServer,iUidTestPsy3)); + CleanupClosePushL(positioner); + + _LIT(KKalle, "Kalle"); + positioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KKalle); + + TPositionUpdateOptions updateOptions; + + TTimeIntervalMicroSeconds timeoutInterval(4000000); + TTimeIntervalMicroSeconds periodicInterval(7000000); + + updateOptions.SetUpdateTimeOut(timeoutInterval); + updateOptions.SetUpdateInterval(periodicInterval); + TInt err = positioner.SetUpdateOptions(updateOptions); + if (err != KErrArgument) + { + _LIT(KErrArg, "Possible to set timout < update interval, error code = %d"); + TBuf<100> buf; + buf.Format(KErrArg, err); + INFO_PRINTF1(buf); + LogErrorAndLeaveL(buf); + } + + //should never be runned; + CleanupStack::PopAndDestroy(1); //positioner + Disconnect(); + } + + +// End of File + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp179.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp179.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,207 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp179.h" +#include "ctlbsposclientholder.h" +#include + +// CONSTANTS +_LIT(KPosPhoneTimeLocaleFormat, + " phone time: %F%H:%F%T:%F%S:%F%C"); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp179::CT_LbsClientPosTp179(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "Tp179 - One Client, same PSY"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp179::~CT_LbsClientPosTp179() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp179::CloseTest +// Always called after the test, even if the test leaves +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp179::CloseTest() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp179::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp179::StartL() + { + const TInt NumClients = 3; + SetupPsyL(iUidTestPsy12); + + //Make one request, the performance requirement are not valid for + //the first request. + TTime startTime, stopTime; + TTime serverStartTime, serverStopTime; + TTimeIntervalMicroSeconds requestTime, connectionTime; + TBuf<150> buf; + + serverStartTime.UniversalTime(); + ConnectL(); + serverStopTime.UniversalTime(); + + User::LeaveIfError(OpenPositioner()); + + TPositionInfo posInfo = TPositionInfo(); + _LIT(KService, "service"); + // Request data from default psy should be test psy 2 + startTime.UniversalTime(); + TInt err = PerformSyncRequest(KService, &posInfo); + stopTime.UniversalTime(); + + if (err != KErrNone) + { + _LIT(KErrorRequest, "The request was not completed with KErrorNone"); + LogErrorAndLeaveL(KErrorRequest); + } + + requestTime = stopTime.MicroSecondsFrom(startTime); + connectionTime = serverStopTime.MicroSecondsFrom(serverStartTime); + + // Added some extra timing here + _LIT(KDebug, "Connecting to Epos took: %d us"); + buf.Format(KDebug, connectionTime.Int64()); + INFO_PRINTF1(buf); + _LIT(KSeparator, "********"); + INFO_PRINTF1(KSeparator); + buf.Zero(); + _LIT(KFirstRequest, "The first request took: %d us"); + buf.Format(KFirstRequest, requestTime.Int64()); + INFO_PRINTF1(buf); + INFO_PRINTF1(KSeparator); + + CT_LbsPosClientHolder* clients = CT_LbsPosClientHolder::NewLC(NumClients, iUidTestPsy12, ETrue); + + TTime starttime,stoptime; + + starttime.UniversalTime(); + + clients->MakeRequests(); + + stoptime.UniversalTime(); + + // Substract total delay incurred due to TestPsy2...i.e 2sec + TInt duration=stoptime.Int64()-starttime.Int64()-2000000; + + _LIT(KMessage,"3 simultaneous requests from 3 different sub-sessions with a psy completed in %d microsec"); + TBuf<256> message; + message.Format(KMessage,duration); + INFO_PRINTF1(message); + + if(duration>3000000) + { + _LIT(KTime, "Time taken>3 sec"); + INFO_PRINTF1(KTime); + } + + TPositionInfo position[NumClients]; + + TTimeIntervalMicroSeconds + reqTime[NumClients], + reqTimeLimit(5000000), + timeDifferenceLimit(500000); + TInt status; + TBool error = EFalse; + + //some printing mostly used for information purpose. + for (TInt i = 0; i < NumClients; i++) + { + clients->GetResult(status, position[i], reqTime[i], i); + TPosition tmp; + position[i].GetPosition(tmp); + if (status != 0) + { + _LIT(KError, "The position requested could not be retrieved, status = %d"); + buf.Format(KError, status); + ERR_PRINTF1(buf); + error = ETrue; + } + if (reqTime[i].Int64() > reqTimeLimit.Int64()) + { + _LIT(KErrorMsg, "The request time of client %d took more than 5 seconds, req. time = %d microsecs."); + buf.Format(KErrorMsg, i, reqTime[i].Int64()); + ERR_PRINTF1(buf); + error = ETrue; + } + for (TInt j = 0; j < i; j++) + { + _LIT(KReqMsg, "client %d request time: %d"); + + buf.Format(KReqMsg, j, reqTime[j].Int64()); + INFO_PRINTF1(buf); + TPosition posi; + TPosition posj; + position[i].GetPosition(posi); + position[j].GetPosition(posj); + posj.Time().FormatL(buf, KPosPhoneTimeLocaleFormat); + INFO_PRINTF1(buf); + + buf.Format(KReqMsg, i, reqTime[i].Int64()); + INFO_PRINTF1(buf); + posi.Time().FormatL(buf, KPosPhoneTimeLocaleFormat); + INFO_PRINTF1(buf); + + _LIT(KSeparator, "********"); + INFO_PRINTF1(KSeparator); + + if (Abs(reqTime[i].Int64() - reqTime[j].Int64()) > timeDifferenceLimit.Int64()) + { + _LIT(KMsg1, "Requests by client %d and %d wasn't served simultaniously: %d microsecs difference between reqTime."); + TBuf<150> buf; + buf.Format(KMsg1, i, j, Abs(reqTime[i].Int64() - reqTime[j].Int64())); + ERR_PRINTF1(buf); + error = ETrue; + } + if (Abs(posi.Time().Int64() - posj.Time().Int64()) > timeDifferenceLimit.Int64()) + { + _LIT(KMsg2, "Requests by client %d and %d wasn't served simultaniously: %d microsecs difference between phoneTime."); + TBuf<150> buf; + buf.Format(KMsg2, i, j, Abs(posi.Time().Int64() - posj.Time().Int64())); + ERR_PRINTF1(buf); + error = ETrue; + } + } + } + + CleanupStack::PopAndDestroy(); //clients + ClosePositioner(); + + Disconnect(); + + if (error) + User::Leave(KErrGeneral); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp188.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp188.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,178 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp188.h" +#include +#include + +// CONSTANTS +const TInt32 KUidNonExistingPsy = 0x01111111; +const TInt KMaxMessageSize = 200; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp188::CT_LbsClientPosTp188(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName,"Tp188 - Get Module Status"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp188::~CT_LbsClientPosTp188() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp188::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp188::StartL() + { + SetupPsyL(iUidTestStatusPsy); + + // Synchronous request to start server. + ConnectL(); + + // Request status information for PSY. + TPositionModuleStatus moduleStatus = TPositionModuleStatus(); + TInt err = iPosServer.GetModuleStatus(moduleStatus, iUidTestStatusPsy); + _LIT(KErrFailStatus1, "1. Error when getting module status, error code = %d"); + AssertTrueL(err == KErrNone, KErrFailStatus1, err); + + iModuleStatus.SetDeviceStatus(TPositionModuleStatus::EDeviceInactive); + iModuleStatus.SetDataQualityStatus(TPositionModuleStatus::EDataQualityUnknown); + + CheckModuleStatusL(moduleStatus); + + // Disable PSY. + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(EFalse); + db->UpdateModuleL(iUidTestStatusPsy, *moduleUpdate); + + User::After(1000000); + + // Request status information for PSY. + err = iPosServer.GetModuleStatus(moduleStatus, iUidTestStatusPsy); + _LIT(KErrFailStatus2, "2. Error when getting module status, error code = %d"); + AssertTrueL(err == KErrNone, KErrFailStatus2, err); + + iModuleStatus.SetDeviceStatus(TPositionModuleStatus::EDeviceDisabled); + iModuleStatus.SetDataQualityStatus(TPositionModuleStatus::EDataQualityUnknown); + + User::After(1000000); + + CheckModuleStatusL(moduleStatus); + + // Request status information for a non-existing PSY. + TUid aNonExistingUid; + aNonExistingUid.iUid = KUidNonExistingPsy; + err = iPosServer.GetModuleStatus(moduleStatus, aNonExistingUid); + _LIT(KErrFailStatus3, "3. Error when getting module status, error code = %d"); + AssertTrueL(err == KErrNotFound, KErrFailStatus3, err); + + SetupPsyL(iUidTestStatusPsy); + + // Request to be notified about Module Status Events. + TPositionModuleStatusEvent statusEvent; + TRequestStatus status = KErrNone; + statusEvent.SetRequestedEvents(TPositionModuleStatusEvent::EEventDeviceStatus); // Obligatory to set Requested events, EEventAll works also. + iPosServer.NotifyModuleStatusEvent(statusEvent, status, iUidTestStatusPsy); + + // Open a subsession to PSY. + err = OpenPositionerByName(iUidTestStatusPsy); + _LIT(KErrFailStatus4, "4. Error when opening module , error code = %d"); + AssertTrueL(err == KErrNone, KErrFailStatus4, err); + + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + + User::WaitForRequest(status); + _LIT(KErrFailStatus5, "5. Error in completed request, error code = %d"); + AssertTrueL(status.Int() == KErrNone, KErrFailStatus5, err); + + // Request status information for PSY. + err = iPosServer.GetModuleStatus(moduleStatus, iUidTestStatusPsy); + _LIT(KErrFailStatus6, "6. Error whe getting module status, error code = %d"); + AssertTrueL(err == KErrNone, KErrFailStatus6, err); + + iModuleStatus.SetDeviceStatus(TPositionModuleStatus::EDeviceReady); + iModuleStatus.SetDataQualityStatus(TPositionModuleStatus::EDataQualityNormal); + CheckModuleStatusL(moduleStatus); + + ClosePositioner(); + + + Disconnect(); + + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp188::CheckModuleStatus +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp188::CheckModuleStatusL(const TPositionModuleStatus& aStatus) + { + TBuf buf; + _LIT(KStatus,"Checking module status"); + INFO_PRINTF1(KStatus); + + _LIT(KDevSta, "Device Status (EDeviceUnknown = 0, EDeviceError = 1, EDeviceDisabled = 2, EDeviceInactive = 3, EDeviceInitialising = 4, EDeviceStandBy = 5, EDeviceReady = 6, EDeviceActive = 7) : %d"); + buf.Format(KDevSta, aStatus.DeviceStatus()); + INFO_PRINTF1(buf); + buf.Zero(); + + _LIT(KDatQual, "Data Quality Status (EDataQualityUnknown = 0, EDataQualityLoss = 1, EDataQualityPartial = 2, EDataQualityNormal = 3) : , %d"); + buf.Format(KDatQual, aStatus.DataQualityStatus()); + INFO_PRINTF1(buf); + buf.Zero(); + + //unused TInt myVar = iModuleStatus.DeviceStatus(); + //unused TInt myVar2 = aStatus.DeviceStatus(); + + if (iModuleStatus.DeviceStatus() != aStatus.DeviceStatus() || + iModuleStatus.DataQualityStatus() != aStatus.DataQualityStatus()) + { + if (iModuleStatus.DeviceStatus() != aStatus.DeviceStatus()) + { + _LIT(KError, "Status is not correct, Status returned %d Status expected %d"); + buf.Format(KError, aStatus.DeviceStatus(), iModuleStatus.DeviceStatus()); + LogErrorAndLeaveL(buf); + } + else + { + _LIT(KError , "Quality is not correct, Quality returned %d Quality expected"); + buf.Format(KError, aStatus.DataQualityStatus(), iModuleStatus.DataQualityStatus()); + LogErrorAndLeaveL(KError); + } + + } + } + +// End of file diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp189.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp189.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,343 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp189.h" +#include +#include + +// CONSTANTS +const TInt32 KUidNonExistingPsy = 0x01111111; +const TInt KMaxMessageSize = 200; +const TInt KNrOfDeviceStatusChanges = 8; // 9 since some are ignored +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp189::CT_LbsClientPosTp189(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "Tp189 - Status Events"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp189::~CT_LbsClientPosTp189() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp189::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp189::StartL() + { + _LIT(KDeviceStatusValues, "Device Status Values (Unknown = 0, Error = 1, Disabled = 2, Inactive = 3, Initialising = 4, StandBy = 5, Ready = 6, Active = 7)"); + INFO_PRINTF1(KDeviceStatusValues); + _LIT(KDataQualityValue, "Data Quality Status (Unknown = 0, Loss = 1, Partial = 2, Normal = 3)"); + INFO_PRINTF1(KDataQualityValue); + + _LIT(KSetTestStatusPsy, "Setting up TestStatusPsy"); + INFO_PRINTF1(KSetTestStatusPsy); + + SetupPsyL(iUidTestStatusPsy); + + TPositionModuleStatusEvent statusEvent2; + statusEvent2.SetRequestedEvents(TPositionModuleStatusEvent::EEventDeviceStatus); + TRequestStatus status2 = KErrNone; + RPositionServer client2; + CleanupClosePushL(client2); + TInt err = client2.Connect(); + _LIT(KConnectError, "TP18 Unable to open connection to Epos, return code %d"); + AssertTrueL(err == KErrNone, KConnectError, err); + + // Synchronous request to start server. + ConnectL(); + + // 1. Request to be notified about Module Status Events. + TPositionModuleStatusEvent statusEvent; + TRequestStatus status = KErrNone; + + // Open a subsession to PSY.1 + _LIT(KOpenPSY, "Calling OpenPositionerByName"); + INFO_PRINTF1(KOpenPSY); + err = OpenPositionerByName(iUidTestStatusPsy); + _LIT(KErrOpen, "1. Error when opening subsession to PSY , error code = %d"); + AssertTrueL(err == KErrNone, KErrOpen, err); + + + for(TInt i = 0; i < (KNrOfDeviceStatusChanges - 1); i++) //Iterate through different device statuses. Skip first and last + { + RequestWaitAndLogEventL(TPositionModuleStatusEvent::EEventDeviceStatus); + } + + RequestWaitAndLogEventL(TPositionModuleStatusEvent::EEventDataQualityStatus); //Test to be notified about data quality changes + + // Renew request before proceeding + statusEvent.SetRequestedEvents(TPositionModuleStatusEvent::EEventDeviceStatus); + iPosServer.NotifyModuleStatusEvent(statusEvent, status, iUidTestStatusPsy); + + // 2. Disable PSY1. + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(EFalse); + db->UpdateModuleL(iUidTestStatusPsy, *moduleUpdate); + _LIT(KWaitStatus, "Waiting for status after UpdateModuleL1"); + INFO_PRINTF1(KWaitStatus); + User::WaitForRequest(status); + + _LIT(KWait, "Error when request completed, error code = %d"); + iExpectedStatus.SetDeviceStatus(TPositionModuleStatus::EDeviceDisabled); + iExpectedStatus.SetDataQualityStatus(TPositionModuleStatus::EDataQualityNormal); + + TPositionModuleStatus getStatus; + statusEvent.GetModuleStatus(getStatus); + + if (iExpectedStatus.DeviceStatus() != getStatus.DeviceStatus() || + iExpectedStatus.DataQualityStatus() != getStatus.DataQualityStatus()) + { + TBuf<100> buf; + if (iExpectedStatus.DeviceStatus() != getStatus.DeviceStatus()) + { + _LIT(KError, "Status is not correct, Status returned %d Status expected %d"); + buf.Format(KError, getStatus.DeviceStatus(), iExpectedStatus.DeviceStatus()); + LogErrorAndLeaveL(buf); + } + else + { + _LIT(KError , "Quality is not correct, Quality returned %d Quality expected"); + buf.Format(KError, getStatus.DataQualityStatus(), iExpectedStatus.DataQualityStatus()); + LogErrorAndLeaveL(KError); + } + } + + // 3. Renew request + iPosServer.NotifyModuleStatusEvent(statusEvent, status, iUidTestStatusPsy); + _LIT(KNotifyModuleStatusEvent, "Called NotifyModuleStatusEvent"); + INFO_PRINTF1(KNotifyModuleStatusEvent); + + // 4. Enable PSY1 + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestStatusPsy, *moduleUpdate); + _LIT(KWaitUpdateModuleL2, "Waiting for status after UpdateModuleL2"); + INFO_PRINTF1(KWaitUpdateModuleL2); + + User::WaitForRequest(status); + AssertTrueL(status.Int() == KErrNone, KWait, status.Int()); + + // 5. Renew request + iPosServer.NotifyModuleStatusEvent(statusEvent, status, iUidTestStatusPsy); + client2.NotifyModuleStatusEvent(statusEvent2, status2, iUidMultiPsy); + + // 7. Disable PSY1 + _LIT(KDisable, "Disabling TestStatusPsy"); + INFO_PRINTF1(KDisable); + moduleUpdate->SetUpdateAvailability(EFalse); + db->UpdateModuleL(iUidTestStatusPsy, *moduleUpdate); + + // 9. Enable PSY2 + _LIT(KEnable, "Enabling MultiPsy"); + INFO_PRINTF1(KEnable); + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidMultiPsy, *moduleUpdate); + + _LIT(KStatus, "Waiting for status & status2"); + INFO_PRINTF1(KStatus); + User::WaitForRequest(status, status2); + if (status == KRequestPending) + { + User::WaitForRequest(status); + } + else + { + User::WaitForRequest(status2); + } + + + AssertTrueL(status.Int() == KErrNone, KWait, status.Int()); + AssertTrueL(status2.Int() == KErrNone, KWait, status2.Int()); + + // 10. Renew request for all PSYs + iPosServer.NotifyModuleStatusEvent(statusEvent, status, iUidTestStatusPsy); + + // 11. Enable PSY1 + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestStatusPsy, *moduleUpdate); + _LIT(KWaitUpdateModuleL3, "Waiting for status after UpdateModuleL3"); + INFO_PRINTF1(KWaitUpdateModuleL3); + + User::WaitForRequest(status); + AssertTrueL(status.Int() == KErrNone, KWait, status.Int()); + + // Open a subsession to PSY.1 + err = iPositioner2.Open(iPosServer, iUidTestStatusPsy); + _LIT(KErrOpenOther, "7. Error when opening subsession to PSY , error code = %d"); + AssertTrueL(err == KErrNone, KErrOpenOther, err); + + User::After(10000000); //wait for all psy event to timeout + // Renew request for all PSYs + iPosServer.NotifyModuleStatusEvent(statusEvent, status); + User::After(1000000); + // 14. Close subsession to PSY1. All events execept close event has happen + iPositioner2.Close(); + _LIT(KStatusClose, "Waiting for status after Close"); + INFO_PRINTF1(KStatusClose); + + User::WaitForRequest(status); + err = status.Int(); + _LIT(KStatusErr, "status: %d"); + INFO_PRINTF2(KStatusErr, err); + AssertTrueL(err == KErrNone, KWait, err); + + + // 15. Renew request for PSY1 + iPosServer.NotifyModuleStatusEvent(statusEvent, status, iUidTestStatusPsy); + + User::After(600000); + // 16. Cancel request + TInt cancelErr = iPosServer.CancelRequest(EPositionServerNotifyModuleStatusEvent); + _LIT(KCancel, "7. Error canceling request, error code = %d"); + AssertTrueL(cancelErr == KErrNone, KCancel, cancelErr); + _LIT(KStatusCancelRequest, "Waiting for status after CancelRequest"); + INFO_PRINTF1(KStatusCancelRequest); + + User::WaitForRequest(status); + AssertTrueL(status.Int() == KErrCancel, KCancel, status.Int()); + + // 17. Cancel request again + cancelErr = iPosServer.CancelRequest(EPositionServerNotifyModuleStatusEvent); + AssertTrueL(cancelErr == KErrNotFound, KCancel, cancelErr); + + // 18. Request for non-existing PSY. + _LIT(KNonExistingPSY, "Request for non-existing PSY"); + INFO_PRINTF1(KNonExistingPSY); + TUid aNonExistingUid; + aNonExistingUid.iUid = KUidNonExistingPsy; + iPosServer.NotifyModuleStatusEvent(statusEvent, status, aNonExistingUid); + _LIT(KStatusWaiting, "Waiting for status"); + INFO_PRINTF1(KStatusWaiting); + + User::WaitForRequest(status); + AssertTrueL(status.Int() == KErrNotFound, KWait, status.Int()); + + + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + CleanupStack::PopAndDestroy(&client2); + + _LIT(KClosePositioner, "Calling ClosePositioner"); + INFO_PRINTF1(KClosePositioner); + ClosePositioner(); + + Disconnect(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp189::CheckModuleStatus +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp189::RequestWaitAndLogEventL(const TInt aEventToListenFor) + { + TPositionModuleStatusEvent statusEvent; + TRequestStatus status = KErrNone; + + if(aEventToListenFor == TPositionModuleStatusEvent::EEventDataQualityStatus) + { + statusEvent.SetRequestedEvents(TPositionModuleStatusEvent::EEventDataQualityStatus); + } + else + { + statusEvent.SetRequestedEvents(TPositionModuleStatusEvent::EEventDeviceStatus); + } + + // Renew request + iPosServer.NotifyModuleStatusEvent(statusEvent, status, iUidTestStatusPsy); + + User::WaitForRequest(status); + _LIT(KErrLoopOpen, "Error in loop when opening subsession to PSY , error code = %d"); + AssertTrueL(status.Int() == KErrNone, KErrLoopOpen, status.Int()); + + // Get status information for PSY. + TPositionModuleStatus moduleStatus = TPositionModuleStatus(); + TInt err = iPosServer.GetModuleStatus(moduleStatus, iUidTestStatusPsy); + _LIT(KGet, "Error when getting module status from PSY , error code = %d"); + AssertTrueL(err == KErrNone, KGet, err); + CheckModuleStatusL(moduleStatus); + } +// --------------------------------------------------------- +// CT_LbsClientPosTp189::CheckModuleStatus +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp189::CheckModuleStatusL(const TPositionModuleStatus& aStatus , const TBool /*aCheckStatus*/) + { + TBuf buf; + _LIT(KStatus,"Checking module status"); + INFO_PRINTF1(KStatus); + _LIT(KErrBoundary, "The value on status/quaity is out of range"); + + _LIT(KDevSta, "Device Status = %d"); + TInt status = aStatus.DeviceStatus(); + buf.Format(KDevSta, status); + INFO_PRINTF1(buf); + buf.Zero(); + //check that status value is not out of range + switch(status) + { + case TPositionModuleStatus::EDeviceUnknown: + case TPositionModuleStatus::EDeviceError: + case TPositionModuleStatus::EDeviceInitialising: + case TPositionModuleStatus::EDeviceStandBy: + case TPositionModuleStatus::EDeviceReady: + case TPositionModuleStatus::EDeviceActive: + case TPositionModuleStatus::EDeviceInactive: //the psy should not be able to report this + break; + case TPositionModuleStatus::EDeviceDisabled: //the psy should not be able to report this + default: + LogErrorAndLeaveL(KErrBoundary); + } + + + + _LIT(KDatQual, "Data Quality Status = %d"); + TInt quality = aStatus.DataQualityStatus(); + buf.Format(KDatQual, quality); + INFO_PRINTF1(buf); + buf.Zero(); + //check that qauality value is not out of range + switch(quality) + { + case TPositionModuleStatus::EDataQualityUnknown: + case TPositionModuleStatus::EDataQualityLoss: + case TPositionModuleStatus::EDataQualityPartial: + case TPositionModuleStatus::EDataQualityNormal: + break; + default: + LogErrorAndLeaveL(KErrBoundary); + } + } + +// End of file diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp193.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp193.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,129 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp193.h" +#include "ctlbsposclientholder.h" +#include + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp193::CT_LbsClientPosTp193(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP193 - Maximum number of Clients"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp193::~CT_LbsClientPosTp193() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp193::CloseTest +// Always called after the test, even if the test leaves +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp193::CloseTest() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp193::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp193::StartL() + { + SetupPsyL(iUidTestPsy2); + + User::After(2000000); + + const TInt KNrOfClients = 25; + CT_LbsPosClientHolder* clients = CT_LbsPosClientHolder::NewLC(KNrOfClients,iUidTestPsy2); + + TTime starttime,stoptime; + + starttime.UniversalTime(); + + clients->MakeRequests(); + + stoptime.UniversalTime(); + + // Substract total delay incurred due to TestPsy2...i.e 2sec + TInt duration=stoptime.Int64()-starttime.Int64()-2000000; + + _LIT(KMessage,"25 simultaneous requests from 25 different sessions with a psy completed in %d microsec"); + TBuf<256> message; + message.Format(KMessage,duration); + INFO_PRINTF1(message); + + if(duration>3000000) + { + _LIT(KTime, "Time taken>3 sec"); + INFO_PRINTF1(KTime); + } + + //check the result of the request + //only KErrNoMemory or KErrNone is allowed. + // CONSTANTS + + TPositionInfo position[KNrOfClients]; + + TTimeIntervalMicroSeconds reqTime[KNrOfClients]; + TInt status; + TBool error = EFalse; + TBuf<150> buf; + + //some printing mostly used for information purpose. + for (TInt i = 0; i < KNrOfClients; i++) + { + clients->GetResult(status, position[i], reqTime[i], i); + if (status != 0) + { + _LIT(KError, "The position requested could not be retrieved, status = %d"); + buf.Format(KError, status); + ERR_PRINTF1(buf); + if (status != -4) + { + error = ETrue; + } + } + _LIT(KReqMsg, "client %d request time: %d"); + + buf.Format(KReqMsg, i, reqTime[i].Int64()); + INFO_PRINTF1(buf); + _LIT(KSeparator, "********"); + INFO_PRINTF1(KSeparator); + } + + if (error) + { + _LIT(KErrorCode, "The requests was not completed with KErrNoMemory or KErrNone"); + LogErrorAndLeaveL(KErrorCode); + } + CleanupStack::PopAndDestroy(clients); //clients + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp194.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp194.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,87 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDE FILES +#include "ctlbsclientpostp194.h" +#include "ctlbsclientperiodictester.h" + +// CONSTANTS +_LIT(KServiceName1, " aaaaaaaaaaa"); +_LIT(KServiceName2, " bbbbbbbbbbb"); + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp194::CT_LbsClientPosTp194(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP194 - Periodic Updates, Duration test"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp194::~CT_LbsClientPosTp194() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp194::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp194::StartL() + { + + SetupPsyL(iUidMultiPsy); + + TInt numberOfRuns = 100; + TTimeIntervalMicroSeconds interval5 = TTimeIntervalMicroSeconds(4000000); + TUid uid = iUidMultiPsy; + + CT_LbsClientPeriodicTester* periodicTester1 = CT_LbsClientPeriodicTester::NewL(interval5, KServiceName1, iLog, uid, numberOfRuns); + CleanupStack::PushL(periodicTester1); + + CT_LbsClientPeriodicTester* periodicTester2 = CT_LbsClientPeriodicTester::NewL(interval5, KServiceName2, iLog, uid, numberOfRuns); + CleanupStack::PushL(periodicTester2); + + periodicTester1->RequestNotification(); + periodicTester2->RequestNotification(); + + // Active scheduler is stopped two times. + CActiveScheduler::Start(); + CActiveScheduler::Start(); + + //check for errors + TBool test1 = periodicTester1 -> IsCompletedOK(); + TBool test2 = periodicTester2 -> IsCompletedOK(); + + CleanupStack::PopAndDestroy(2,periodicTester1); + + if (!test1 || !test2) + { + _LIT(KError, "Test did not complete with no error, check log file"); + LogErrorAndLeaveL(KError); + } + + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp195.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp195.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,129 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDE FILES +#include "ctlbsclientpostp195.h" +#include +#include +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp195::CT_LbsClientPosTp195(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP195 - Periodic Updates, Slow PSY"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp195::~CT_LbsClientPosTp195() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp195::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp195::StartL() + { + SetupPsyL(iUidTestPsy3); + + TInt numberOfRuns = 5; + TTimeIntervalMicroSeconds interval = TTimeIntervalMicroSeconds(2000000); + const TInt slowPsyUpdate = 4000000; + + #ifdef __WINS__ + const TInt KErrorInterval = 2500000; + #else + const TInt KErrorInterval = 500000; + #endif + + + RPositionServer posServer; + CleanupClosePushL(posServer); + RPositioner positioner; + CleanupClosePushL(positioner); + TPositionInfo positionInfo = TPositionInfo(); + + _LIT(KConnectErr, "Error when connecing to EPos server, %d"); + TInt err = posServer.Connect(); + AssertTrueL(err == KErrNone, KConnectErr, err); + + _LIT(KOpenErr, "Error when opening positioner, %d"); + err = positioner.Open(posServer, iUidTestPsy3); + AssertTrueL(err == KErrNone, KOpenErr, err); + + TPositionUpdateOptions posOption; + posOption.SetUpdateInterval(interval); + + _LIT(KUpdateErr, "Error when setting update interval, %d"); + err = positioner.SetUpdateOptions(posOption); + AssertTrueL(err == KErrNone, KUpdateErr, err); + + _LIT(KService ,"Service"); + positioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KService); + + //do a couple of request and check the times between requests. + + TTime now, startTime; + TTimeIntervalMicroSeconds requestTime; + _LIT(KErrorRequest, "Error in request"); + TRequestStatus status; + TInt64 reqTime; + + for (TInt i = 0; i < numberOfRuns; i++) + { + startTime.UniversalTime(); + positioner.NotifyPositionUpdate(positionInfo, status); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone, KErrorRequest, err); + now.UniversalTime(); + requestTime = now.MicroSecondsFrom(startTime); + _LIT(KError, "Request time, %d microsecs."); + TBuf<100> buf; + reqTime = requestTime.Int64(); + buf.Format(KError, reqTime); + INFO_PRINTF1(buf); + if (i != 0) + { + //check that the time is ok, by accepting an error interval + TInt var1 = 2000000 + slowPsyUpdate + KErrorInterval; + TInt var2 = 2000000 + (slowPsyUpdate - KErrorInterval); + if (reqTime > var1 || reqTime < var2) + { + _LIT(KErrorInterval, "The update is not within valid range"); + LogErrorAndLeaveL(KErrorInterval); + } + } + } + + CleanupStack::PopAndDestroy(&positioner); + CleanupStack::PopAndDestroy(&posServer); + + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp2.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp2.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,213 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + + +// INCLUDES +#include "ctlbsclientpostp2.h" +#include "ctlbsclientpositionconstants.h" +#include + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp2::CT_LbsClientPosTp2(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP2 - Request location from specific PSY"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp2::~CT_LbsClientPosTp2() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp2::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp2::StartL() + { + SetupPsyL(iUidMultiPsy); + + //synchronous request + ConnectL(); + + User::LeaveIfError(OpenPositionerByName(iUidMultiPsy)); + + TPositionInfo info = TPositionInfo(); + + RequestL(info); + CheckPositionInfoL(info); + + TPositionCourseInfo courseInfo; + + RequestL(courseInfo); + CheckPositionCourseInfoL(courseInfo); + + TPositionSatelliteInfo satelliteInfo; + + RequestL(satelliteInfo); + CheckPositionSatelliteInfoL(satelliteInfo); + + + HPositionGenericInfo* genericInfo = HPositionGenericInfo::NewLC(); + + RequestL(*genericInfo); + CheckGenericInfoL(*genericInfo); + + CleanupStack::PopAndDestroy(); //genericInfo + + ClosePositioner(); + + Disconnect(); + } + + +// --------------------------------------------------------- +// CT_LbsClientPosTp2::AssertTrueL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp2::AssertTrueL(TBool aCondition, const TDesC& aErrorMsg) + { + if (!aCondition) + { + LogErrorAndLeaveL(aErrorMsg); + } + } + +void CT_LbsClientPosTp2::RequestL(TPositionInfoBase& aInfoBase) + { + _LIT(KService, "service"); + TInt err = PerformSyncRequest(KService, &aInfoBase); + + if (err != KErrNone) + { + _LIT(KErrorRequest, "The request was not completed with KErrorNone, errCode = %d"); + TBuf<100> buf; + buf.Format(KErrorRequest, err); + LogErrorAndLeaveL(buf); + } + + _LIT(KIncorrectPsySyncRequestError, + "TP2. Position from wrong PSY received (sync request)."); + AssertTrueL(iUidMultiPsy == aInfoBase.ModuleId(), KIncorrectPsySyncRequestError); + } + +void CT_LbsClientPosTp2::CheckPositionInfoL(TPositionInfo& aInfo) + { + TPosition pos; + aInfo.GetPosition(pos); + CheckPositionL(pos); + } + +void CT_LbsClientPosTp2::CheckPositionCourseInfoL(TPositionCourseInfo& aCourseInfo) + { + CheckPositionInfoL(aCourseInfo); + TCourse course; + aCourseInfo.GetCourse(course); + if (course.Heading() != KHeading || + course.Speed() != KSpeed || + course.SpeedAccuracy() != KSpeedAcc || + course.HeadingAccuracy() != KHeadingAcc ) + { + _LIT(KErrCourse, "Course not correct"); + LogErrorAndLeaveL(KErrCourse); + } + } + +void CT_LbsClientPosTp2::CheckPositionSatelliteInfoL(TPositionSatelliteInfo& aSatelliteInfo) + { + CheckPositionCourseInfoL(aSatelliteInfo); + if((TUint)aSatelliteInfo.NumSatellitesUsed() != KNumberOfSatellitesUsed || + aSatelliteInfo.SatelliteTime() != TTime(KSatelliteTime) || + (TUint)aSatelliteInfo.NumSatellitesInView() != KNumberOfSatellitesInView || + aSatelliteInfo.HorizontalDoP() != KHorizontalDoPValue || + aSatelliteInfo.VerticalDoP() != KVerticalDoPValue || + aSatelliteInfo.TimeDoP() != KTimeDoPValue) + { + _LIT(KErrBasicSat, "Basic satellite information not correct"); + LogErrorAndLeaveL(KErrBasicSat); + } + TInt sats = aSatelliteInfo.NumSatellitesInView(); + for (int i = 0; i < sats; i++) + { + TSatelliteData satelliteData; + TInt err = aSatelliteInfo.GetSatelliteData(i,satelliteData); + if (err != KErrNone) + { + _LIT(KErrGetSat, "Not possible to get satellite data, error code = %d"); + TBuf<100> buf; + buf.Format(KErrGetSat, err); + LogErrorAndLeaveL(buf); + } + if ( (i%2) == 0 ) + { + if( satelliteData.SatelliteId() != (KSatelliteId +i) || + satelliteData.Azimuth() != KAzimuth || + satelliteData.Elevation() != KElevation || + satelliteData.IsUsed() != KIsUsed || + satelliteData.SignalStrength() != KSignalStrength) + { + _LIT(KErrSatDataEven, "Incorrect satellite data on even satellites"); + LogErrorAndLeaveL(KErrSatDataEven); + } + } + else + { + if( satelliteData.SatelliteId() != (KSatelliteId +i) || + satelliteData.Azimuth() != KAzimuthOdd || + satelliteData.Elevation() != KElevationOdd || + satelliteData.IsUsed() != KIsUsedOdd || + satelliteData.SignalStrength() != KSignalStrengthOdd) + { + _LIT(KErrSatDataOdd, "Incorrect satellite data on odd satellites"); + LogErrorAndLeaveL(KErrSatDataOdd); + } + } + + } + } + +void CT_LbsClientPosTp2::CheckGenericInfoL(HPositionGenericInfo& aGenericInfo) + { + CheckPositionInfoL(aGenericInfo); + + } + +void CT_LbsClientPosTp2::CheckPositionL(TPosition& aPos) + { + if (aPos.Time() != TTime(KPositionTime) || + aPos.HorizontalAccuracy() != KHorizontalAcc || + aPos.VerticalAccuracy() != KVerticalAcc || + aPos.Latitude() != KLatitude || + aPos.Longitude() != KLongitude || + aPos.Altitude() != KAltitude) + { + _LIT(KErrPosition, "Wrong position returned"); + LogErrorAndLeaveL(KErrPosition); + } + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp201.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp201.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,188 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDE FILES +#include "ctlbsclientpostp201.h" +#include +#include +#include +#include +#include +#include "ctlbsclientobserver.h" + +// CONSTANTS +const TInt KSecond = 1*1000*1000; +const TInt KMaxSentenceLength = 60; //Max length of each line in EXEClient-logfile +const TInt KNoOfEXCalls = 3; // Nr of calls to ExeClient +_LIT(KExeClientPath, "ctlbsexeclient"); +_LIT(KExeResultPath, "c:\\logs\\execlientresult%d.txt"); +_LIT(KSucce, "Test %d was successful"); +_LIT(KFail, "Test %d failed"); +_LIT8(KSuccess, "SUCCESS"); //String to search for that indicates the test was succesful + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp201::CT_LbsClientPosTp201(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP201 - Exe Client"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp201::~CT_LbsClientPosTp201() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp201::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp201::StartL() + { + + //This test can be run on emulator now. + TInt result; + TInt i; + TInt foundsucces; + RProcess execlient[KNoOfEXCalls]; + RFile file; + RFileReadStream fstream; + RFs fileSession; + User::LeaveIfError(fileSession.Connect()); + CleanupClosePushL(fileSession); + CleanupClosePushL(fstream); + CleanupClosePushL(file); + CFileMan* fileMan = CFileMan::NewL(fileSession); + CleanupStack::PushL(fileMan); + + _LIT(KRemoveFiles, "Remove files"); + INFO_PRINTF1(KRemoveFiles); + + //1. First check for old ExeClientResult-files to remove. + TBuf<40> filepath; + filepath.Append(KExeResultPath); + for ( i = 1; i<=KNoOfEXCalls; i++) + { + filepath.Format(KExeResultPath,i); + TInt err = fileMan->Delete(filepath, CFileMan::EOverWrite); + if (err != KErrNone && err != KErrNotFound) + { + _LIT(KErrRemoveDll, "Removal of a previous ExeClientResult-file failed!"); + TBuf<50> buf; + buf.Format(KErrRemoveDll, err); + LogErrorAndLeaveL(buf); + } + } + + _LIT(KStartClients, "Start clients"); + INFO_PRINTF1(KStartClients); + + //2. Make 3 calls to ExeClient. + for ( i = 1; i<= KNoOfEXCalls; i++) + { + //Start the execlient-process + result = execlient[i-1].Create(KExeClientPath, KNullDesC); + User::LeaveIfError(result); + execlient[i-1].Resume(); //make the execlient visible + User::After(6000000); + } + + CT_LbsClientObserver::WaitForEPosShutdown(); //Wait for Epos to complete + User::After(KSecond); //Wait for completion of writing to files. 1 minute. + for ( i = 0; i < KNoOfEXCalls; i++) + { + TRequestStatus closed; + execlient[i].Logon(closed); + User::WaitForRequest(closed); + + TBuf<100> exit; + _LIT(KExitClient, "Client %d exited: Type %d, Reason %d"); + exit.Format(KExitClient, + i+1, execlient[i].ExitType(), execlient[i].ExitReason()); + INFO_PRINTF1(exit); + + execlient[i].Close(); //Close handle to exe-client + } + _LIT(KCheckResults, "Check results"); + INFO_PRINTF1(KCheckResults); + + //3. See if all calls were successes + TBuf<40> successinfo; + successinfo.Append(KSucce); + TBuf<40> failinfo; + failinfo.Append(KFail); + for ( i = 1; i <= KNoOfEXCalls; i++) + { + filepath.Format(KExeResultPath,i); + User::LeaveIfError(file.Open(fileSession, filepath, EFileShareReadersOnly));//open read only + fstream.Attach(file); + + TBuf8 dbuffer; //Buffer to place read data from file + TBuf8 prevbuffer; //Buffer to place previous read data from file + TBool search = ETrue; + const TChar eoline(';'); + while (search) + { + dbuffer.Delete(0, KMaxSentenceLength); + TRAPD(ferr, (fstream.ReadL(dbuffer,eoline))); + if ( ferr == KErrEof) + { + search = EFalse; //stop searching + } + else if ( ferr == KErrNone) + { + prevbuffer.Delete(0, KMaxSentenceLength); + prevbuffer = dbuffer; + } + else + { + _LIT(KReadError, "Error when reading from log-file."); + LogErrorAndLeaveL(KReadError); + } + } + //Check if success + foundsucces = prevbuffer.Find(KSuccess); + if ( foundsucces != KErrNotFound) + { + successinfo.Format(KSucce,i); + INFO_PRINTF1(successinfo); + } + else + { + failinfo.Format(KFail,i); + LogErrorAndLeaveL(failinfo); + } + } //for + + _LIT(KDone, "Done."); + INFO_PRINTF1(KDone); + + //4. Let's clean... + CleanupStack::PopAndDestroy(fileMan); //fileMan + CleanupStack::PopAndDestroy(&file); //file + CleanupStack::PopAndDestroy(&fstream); //fstream + CleanupStack::PopAndDestroy(&fileSession); //fileSession + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp203.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp203.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,433 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDE FILES +#include "ctlbsclientpostp203.h" +#include "ctlbsrequester.h" +#include +#include +#include +#include +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// Constructor. +CT_LbsClientPosTp203::CT_LbsClientPosTp203(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP203 - Periodic Update, default psy"); + SetTestStepName(KTestName); + } + +// Destructor +CT_LbsClientPosTp203::~CT_LbsClientPosTp203() + { + RDebug::Print(_L("CT_LbsClientPosTp203::~CT_LbsClientPosTp203")); + } + +// --------------------------------------------------------- +// CPosTp203::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp203::CloseTest() + { + RDebug::Print(_L("CT_LbsClientPosTp203::CloseTest")); + + delete iPeriodicTimer; + iPeriodicTimer = NULL; + } + +// --------------------------------------------------------- +// CPosTp203::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp203::StartL() + { + const TInt KLongErrorInterval = 3000000; + +#ifdef __WINS__ + const TInt KNormalErrorInterval = 1500000; +#else + const TInt KNormalErrorInterval = 500000; +#endif + + + TInt numberOfRuns = 6; + TInt normalInterval = 4500000; + // Using the same interval as the slow psy (TestPsy3) to make things easy. + TTimeIntervalMicroSeconds interval = TTimeIntervalMicroSeconds(normalInterval); + TTimeIntervalMicroSeconds shortInterval = TTimeIntervalMicroSeconds(1500000); + + // Will happen the first time when default is changed + TInt longInterval = 8500000; + TInt errorInterval = KNormalErrorInterval; + + TInt requestUpdate = normalInterval; + + RPositionServer posServer; + CleanupClosePushL(posServer); + TInt err = posServer.Connect(); + _LIT(KConnectErr, "Error when connecing to EPos server, %d"); + AssertTrueL(err == KErrNone, KConnectErr, err); + + SetupPsyL(iUidMultiPsy); + + RPositioner positioner; + CleanupClosePushL(positioner); + err = positioner.Open(posServer); // Use Default PSY + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueL(err == KErrNone, KOpenErr, err); + + TPositionInfo positionInfo = TPositionInfo(); + TPositionUpdateOptions posOption; + posOption.SetUpdateInterval(interval); + + err = positioner.SetUpdateOptions(posOption); + _LIT(KUpdateErr, "Error when setting update interval, %d"); + AssertTrueL(err == KErrNone, KUpdateErr, err); + + _LIT(KService ,"Service"); + positioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KService); + + // Do a couple of request and check the times between requests. + TTime now, startTime; + TTimeIntervalMicroSeconds requestTime; + _LIT(KErrorRequest, "Error in request"); + TRequestStatus status; + TInt64 reqTime; + + for (TInt i = 0; i < numberOfRuns; i++) + { + TBuf<100> info; + _LIT(KInfo, "Making request %d"); + info.Format(KInfo, i); + INFO_PRINTF1(info); + if (i == 2) + { + _LIT(KSetTestPSY3, "Setting up TestPsy3"); + INFO_PRINTF1(KSetTestPSY3); + SetupPsyL(iUidTestPsy3); + User::After(1000000); + requestUpdate = longInterval; + errorInterval = KLongErrorInterval; + } + else + { + requestUpdate = normalInterval; + errorInterval = KNormalErrorInterval; + } + + _LIT(KWaitStatus1, "Waiting for status after NotifyPositionUpdate1"); + INFO_PRINTF1(KWaitStatus1); + + startTime.UniversalTime(); + positioner.NotifyPositionUpdate(positionInfo, status); + User::WaitForRequest(status); + now.UniversalTime(); + + err = status.Int(); + AssertTrueL(err == KErrNone, KErrorRequest, err); + + requestTime = now.MicroSecondsFrom(startTime); + _LIT(KError, "Request time, %d microsecs."); + TBuf<100> buf; + reqTime = requestTime.Int64(); + buf.Format(KError, reqTime); + INFO_PRINTF1(buf); + + if (i != 0) + { + // Check that the time is ok, by accepting an error interval + if (reqTime > (requestUpdate + errorInterval) || + reqTime < (requestUpdate - errorInterval)) + { + _LIT(KErrorInterval, "The update is not within valid range"); + LogErrorAndLeaveL(KErrorInterval); + } + } + + // Check that position was returned from correct PSY: + if (i < 2) + { + VerifyPositionFromL(positionInfo, iUidMultiPsy); + } + else + { + VerifyPositionFromL(positionInfo, iUidTestPsy3); + } + } + + _LIT(KSetUpdateOptions, "Calling SetUpdateOptions"); + INFO_PRINTF1(KSetUpdateOptions); + posOption.SetUpdateInterval(shortInterval); + err = positioner.SetUpdateOptions(posOption); + AssertTrueL(err == KErrNone, KUpdateErr, err); + + // Set up three PSYs the two onces with top priorities supports tracking + // and the third one does not + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + _LIT(KSetPriority0, "Enabling Tracking PSY with priority 0"); + INFO_PRINTF1(KSetPriority0); + moduleUpdate->SetUpdateAvailability(ETrue); + User::After(1000000); + + db->UpdateModuleL(iUidTestTrackingPsy, *moduleUpdate); + db->SetModulePriorityL(iUidTestTrackingPsy, 0); + User::After(1000000); + + + + _LIT(KSetPriority1, "Enabling Timer PSY with priority 1"); + /*INFO_PRINTF1(KSetPriority1); + db->UpdateModuleL(iUidTestTimerPsy, *moduleUpdate); + db -> SetModulePriorityL(iUidTestTimerPsy, 1); + User::After(1000000);*/ + + _LIT(KSetPriority2, "Enabling Multi PSY with priority 2"); + /*INFO_PRINTF1(KSetPriority2); + db->UpdateModuleL(iUidMultiPsy, *moduleUpdate); + db -> SetModulePriorityL(iUidMultiPsy, 2); + User::After(1000000); // just to let the events happen in the server.*/ + + + // Make one request to ensure that Start tracking is called. + positioner.NotifyPositionUpdate(positionInfo, status); + _LIT(KWaitStatus2, "Waiting for status after NotifyPositionUpdate2"); + INFO_PRINTF1(KWaitStatus2); + RDebug::Print(KWaitStatus2); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone || err == KPositionQualityLoss, KErrorRequest, err); + + TPosition pos; + positionInfo.GetPosition(pos); + User::After(1000000); + + // TestTrackingPsy returns 65.0 for Tracking requests and 30.0 for ordinary position requests + _LIT(KErrorAndLeave, "Wrong position returned from tracking PSY"); + if (pos.Latitude() != 65.0 || pos.Longitude() != 65.0 || pos.Altitude() != 65.0) + { + LogErrorAndLeaveL(KErrorAndLeave); + } + + INFO_PRINTF1(KSetPriority1); + db->UpdateModuleL(iUidTestTimerPsy, *moduleUpdate); + db -> SetModulePriorityL(iUidTestTimerPsy, 1); + User::After(2000000); // MH move + + // Disable the psy with top priority, should result in switch of psy + _LIT(KDisablePSY, "Disabling Tracking PSY"); + INFO_PRINTF1(KDisablePSY); + moduleUpdate->SetUpdateAvailability(EFalse); + db->UpdateModuleL(iUidTestTrackingPsy, *moduleUpdate); + // To let the events happen in the server. + User::After(2000000); + + // Make one request to enable tracking + positioner.NotifyPositionUpdate(positionInfo, status); + _LIT(KWaitStatus4, "Waiting for status after NotifyPositionUpdate4"); + INFO_PRINTF1(KWaitStatus4); + RDebug::Print(KWaitStatus4); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone || err == KPositionQualityLoss, KErrorRequest, err); + + positionInfo.GetPosition(pos); + + // To let the events happen in the server. + User::After(2000000); + + // TestTimerPsy returns 55.0 for Tracking requests and 20.0 for ordinary position requests + if (pos.Latitude() != 55.0 || pos.Longitude() != 55.0 || pos.Altitude() != 55.0) + { + LogErrorAndLeaveL(KErrorAndLeave); + } + + // Enable the psy with top priority, should result in switch back to that psy + _LIT(KEnablePSY, "Enabling tracking PSY"); + INFO_PRINTF1(KEnablePSY); + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestTrackingPsy, *moduleUpdate); + User::After(2000000); // just to let the events happen in the server. + + // To enable tracking + positioner.NotifyPositionUpdate(positionInfo, status); + _LIT(KWaitStatus6, "Waiting for status after NotifyPositionUpdate6"); + INFO_PRINTF1(KWaitStatus6); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone || err == KPositionQualityLoss, KErrorRequest, err); + + // To let the events happen in the server. + User::After(2000000); + + positionInfo.GetPosition(pos); + // TestTrackingPsy returns 65.0 for Tracking requests and 30.0 for ordinary position requests + if (pos.Latitude() != 65.0 || pos.Longitude() != 65.0 || pos.Altitude() != 65.0) + { + LogErrorAndLeaveL(KErrorAndLeave); + } + + INFO_PRINTF1(KSetPriority2); + db->UpdateModuleL(iUidMultiPsy, *moduleUpdate); + db -> SetModulePriorityL(iUidMultiPsy, 2); + // To let the events happen in the server. //MH + User::After(1000000); + + // Disable two psys with top priority that supports tracking. + _LIT(KDisableTimer,"Disabling Timer and Tracking PSY"); + INFO_PRINTF1(KDisableTimer); + moduleUpdate->SetUpdateAvailability(EFalse); + db->UpdateModuleL(iUidTestTimerPsy, *moduleUpdate); + db->UpdateModuleL(iUidTestTrackingPsy, *moduleUpdate); + User::After(2000000); // just to let the events happen in the server. + + positioner.NotifyPositionUpdate(positionInfo, status); + _LIT(KWaitStatus8, "Waiting for status after NotifyPositionUpdate8"); + INFO_PRINTF1(KWaitStatus8); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone, KErrorRequest, err); + + if (iUidMultiPsy.iUid != positionInfo.ModuleId().iUid) + { + _LIT(KIncorrectPsyError, + "Position from wrong PSY received"); + LogErrorAndLeaveL(KIncorrectPsyError); + } + + // Disable a PSY during ongoing requesting + // Enable the the top three PSYs + _LIT(KEnableTimer,"Enabling Timer PSY"); + INFO_PRINTF1(KEnableTimer); + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestTimerPsy, *moduleUpdate); + db->UpdateModuleL(iUidTestTrackingPsy, *moduleUpdate); + moduleUpdate->SetUpdateAvailability(EFalse); + db->UpdateModuleL(iUidMultiPsy, *moduleUpdate); + // To let the events happen in the server. + User::After(2000000); + + const TInt KRequestInterval = 4000000; + TCallBack callback(DisablePsyL, this); + iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityStandard); + TTimeIntervalMicroSeconds32 disableTime = TTimeIntervalMicroSeconds32(2000000); + iPeriodicTimer->Start(disableTime, disableTime, callback); + CT_LbsRequester* request = CT_LbsRequester::NewL(this, KRequestInterval, Logger()); // TTF = 0s + CleanupStack::PushL(request); + + // To enable tracking + _LIT(KRequest1, "Calling request->StartRequest1"); + INFO_PRINTF1(KRequest1); + request->StartRequest(); // only one request should exist + + CActiveScheduler::Start(); + + err = request ->CompletionCode(); + _LIT(KErrCode, "Competion code is not KErrNone"); + AssertTrueL(err == KErrNone, KErrCode, err); + + request->GetPositionInfo(positionInfo); + User::After(2000000); + + // Should get tracking data + _LIT(KRequest2, "Calling request->StartRequest2"); + INFO_PRINTF1(KRequest2); + request->StartRequest(); // only one request should exist in reqlog + + CActiveScheduler::Start(); + + err = request ->CompletionCode(); + AssertTrueL(err == KErrNone, KErrCode, err); + + request ->GetPositionInfo(positionInfo); + positionInfo.GetPosition(pos); + + if (iUidTestTimerPsy.iUid != positionInfo.ModuleId().iUid) + { + _LIT(KIncorrectPsyError, + "Position from wrong PSY received"); + LogErrorAndLeaveL(KIncorrectPsyError); + } + // TestTimerPsy returns 55.0 for Tracking requests and 20.0 for ordinary position requests + if (pos.Latitude() != 55.0 || pos.Longitude() != 55.0 || pos.Altitude() != 55.0) + { + LogErrorAndLeaveL(KErrorAndLeave); + } + + _LIT(KSetPSY, "Setting up Tracking PSY"); + INFO_PRINTF1(KSetPSY); + SetupPsyL(iUidTestTrackingPsy); + User::After(1500000); // just to let the events happen in the server. + + CT_LbsRequester* request2 = CT_LbsRequester::NewL(this, interval, Logger()); // TTF = 0s + CleanupStack::PushL(request2); + + iPeriodicTimer->Start(disableTime, disableTime, callback); + _LIT(KRequest3, "Calling request2->StartRequest"); + INFO_PRINTF1(KRequest3); + request2->StartRequest(); // only one request should exist in reqlog + + CActiveScheduler::Start(); + + err = request2 ->CompletionCode(); + _LIT(KErrNotFoundCode, "Competion code is not KErrNone"); + AssertTrueL(err == KErrNone, KErrNotFoundCode, err); + + CleanupStack::PopAndDestroy(request2); + CleanupStack::PopAndDestroy(request); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + + CleanupStack::PopAndDestroy(&positioner); + CleanupStack::PopAndDestroy(&posServer); + + RDebug::Print(_L("CT_LbsClientPosTp203::StartL end")); + } + +TInt CT_LbsClientPosTp203::DisablePsyL(TAny* aSelf) + { + // Do not forget to cancel the timer + CT_LbsClientPosTp203* self = static_cast (aSelf); + self -> iPeriodicTimer -> Cancel(); + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + moduleUpdate->SetUpdateAvailability(EFalse); + TUid trackingId; + trackingId.iUid = KUidTestTrackingPsy; + db->UpdateModuleL(trackingId, *moduleUpdate); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + return KErrNone; + } + +void CT_LbsClientPosTp203::RequestCompleteL() + { + CActiveScheduler::Stop(); + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp204.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp204.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,129 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp204.h" +#include "ctlbsclientobserver.h" +#include +#include +#include +#include +#include "ctlbsclientpositionconstants.h" + +// CONSTANTS + +// Constructor. +CT_LbsClientPosTp204::CT_LbsClientPosTp204(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP204 - BackUpTest"); + SetTestStepName(KTestName); + } + +// Destructor +CT_LbsClientPosTp204::~CT_LbsClientPosTp204() + { + } + +// --------------------------------------------------------- +// CPosTp215::CloseTest +// Always called after the test, even if the test leaves +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp204::CloseTest() + { + } + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPosTp204::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp204::StartL() + { + + TDriveList nullDriveList; + nullDriveList.Zero(); + + using namespace conn; + CSBEClient* SbeClient = CSBEClient::NewL(); + CleanupStack::PushL(SbeClient); + + iCompletedRequests = 0; + + RPositionServer server; + CleanupClosePushL(server); + TInt err = server.Connect(); + if (err != KErrNone) + { + _LIT(KBackupError1, "Cannot connect to Server"); + INFO_PRINTF1(KBackupError1); + User::Leave(KErrGeneral); + } + + _LIT(KBackupLog1, "connect to server success"); + INFO_PRINTF1(KBackupLog1); + server.Close(); + + SbeClient->SetBURModeL(nullDriveList, EBURBackupFull, EBackupBase); + User::After(500000); // Wait for 500 milli seconds + + err = server.Connect(); + if (err == KErrNone) + { + _LIT(KBackupError2, "connect to server works :-("); + INFO_PRINTF1(KBackupError2); + User::Leave(KErrGeneral); + } + + server.Close(); + + SbeClient->SetBURModeL(nullDriveList, EBURNormal, ENoBackup); + User::After(500000); // Wait for 500 milli seconds + + err = server.Connect(); + if (err != KErrNone) + { + _LIT(KBackupError3, "connect to server doesn't work :-("); + INFO_PRINTF1(KBackupError3); + User::Leave(KErrGeneral); + } + + CleanupStack::PopAndDestroy(2); + + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp25::RequestCompleteL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp204::RequestCompleteL() + { + const TInt KNofRequesters = 3; + if (++iCompletedRequests == KNofRequesters) + { + CActiveScheduler::Stop(); + } + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp208.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp208.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,556 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp208.h" +#include +#include +#include + +// CONSTANTS +static const TInt KNrOfClients = 5; +static const TInt KNrOfRuns = 20; + +static const TInt KServerMinHeapSize = 4096; +static const TInt KServerMaxHeapSize = 128000; + + +_LIT(KThread2Name, "req_location1"); +_LIT(KThread3Name, "req_location2"); +_LIT(KErrMsgThreadCreation, "failed to create thread"); + +// ================= MEMBER FUNCTIONS ======================= + +// Constructor. +CT_LbsClientPosTp208::CT_LbsClientPosTp208(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP208-Multi Thread Connection"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp208::~CT_LbsClientPosTp208() + { + } + +// --------------------------------------------------------- +// CPosTp208::CloseTest +// Always called after the test, even if the test leaves +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp208::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// Struct passed to the thread in a TAny* +struct MyAnyData +{ + TBool iFullTest; // If fulltest defined + TInt iNrOfRuns; // number if requests to make for each thread +}; + +// +// Performes the test by connecting to MLFW +// (and makes a number of Location requests if aFullTest is true +// +void DoTestL(TBool aFullTest, TInt aNumberOfRuns, TInt *aResult) + { + RPositionServer posServer; + TInt errorCode = errorCode = posServer.Connect(); + + if (errorCode != KErrNone) + { + *aResult = KErrCouldNotConnect; + return; + } + CleanupClosePushL(posServer); + + RPositioner positioner; + + + // Full test means requesting position updates + if (aFullTest) + { + TPositionInfo positionInfo = TPositionInfo(); + const TInt32 KUidMultiPsy = 0x01010176; + TUid uidMultiPsy; + uidMultiPsy.iUid = KUidMultiPsy; + errorCode = positioner.Open(posServer, uidMultiPsy); + + if (errorCode != KErrNone) + { + *aResult = errorCode; + return; + } + CleanupClosePushL(positioner); + + _LIT(KService ,"Service"); + errorCode = positioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KService); + + if (errorCode != KErrNone) + { + *aResult = 1001; + return; + } + + TRequestStatus status; + TLocality loca(TCoordinate(0,0,0),0); + TPosition pos(loca, TTime(0)); + + for (TInt i = 0; i < aNumberOfRuns; i++) + { + positionInfo.SetPosition(pos); + positioner.NotifyPositionUpdate(positionInfo, status); + User::WaitForRequest(status); + TInt err = status.Int(); + if (err != KErrNone) + { + *aResult = err; + } + TPosition result; + positionInfo.GetPosition(result); + + //sanity check + if (result.Latitude() == pos.Latitude() || + result.Longitude() == pos.Longitude() || + result.Altitude() == pos.Altitude()) + { + //_LIT(KErrorPositon, "ERROR:: The postion was not updated"); + errorCode = 1005; + } + } + positioner.Close(); + CleanupStack::PopAndDestroy(&positioner); + } + + posServer.Close(); + CleanupStack::PopAndDestroy(&posServer); + } + +// --------------------------------------------------------- +// LOCAL_C TInt MyThreadFunctionL(TAny* aData) +// Runs the DoTestL in a TRAP nest +// Panics this thread if any errors occurred +// --------------------------------------------------------- +// +LOCAL_C TInt MyThreadFunctionL(TAny* aData) + { + __UHEAP_MARK; + CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack + + // Read parameters from TAny* + MyAnyData* info = (MyAnyData*) aData; + + TInt result = KErrNone; + TInt err = KErrNone; + // Why must this function be TRAPPED? + TRAP(err, DoTestL(info->iFullTest, info->iNrOfRuns, &result)); + + _LIT(KErrorConnect, "Error when connecting to RPositionServer"); + __ASSERT_ALWAYS(!err, User::Panic(KErrorConnect, err)); + __ASSERT_ALWAYS(result == KErrNone, User::Panic(KErrorConnect, result)); + + delete cleanup; // destroy clean-up stack + __UHEAP_MARKEND; + return 0; + } + +// --------------------------------------------------------- +// CPosTp208::StartThreads +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CT_LbsClientPosTp208::StartThreads(TBool aFullTest) + { + TFixedArray statusArray; + TFixedArray threadArray; + TFixedArray retArray; + + TBuf<150> buf; + TInt errorsFound = KErrNone; + _LIT(KInfoCreate, "Creating threads"); + INFO_PRINTF1(KInfoCreate); + _LIT(KThreadName, "Thread %d"); + + // Introduce parameters for each thread. + MyAnyData info; + + info.iNrOfRuns = KNrOfRuns; + info.iFullTest = aFullTest; + // Make sure that if one of the threads panic, whole emulator is not + // paniced (this has effect only in Wins). + TBool jit = User::JustInTime(); + User::SetJustInTime(EFalse); + + TInt i=0; + for (i=0; i=0; i--) + { + + if (retArray[i] == KErrNone) User::WaitForRequest(statusArray[i]); + + buf.Zero(); + buf.Format(KThreadName, i); + + _LIT(KWaitForRequest, " User::WaitForRequest "); + buf.Append(KWaitForRequest); + INFO_PRINTF1(buf); + + buf.Zero(); + buf.Format(KThreadName, i); + + if (threadArray[i].ExitType() == EExitPanic) + { + _LIT(KPanicExit, " EExitPanic "); + buf.Append(KPanicExit); + INFO_PRINTF1(buf); + errorsFound++; + } + else if (threadArray[i].ExitType() == EExitKill) + { + _LIT(KKillExit, " EExitKill"); + buf.Append(KKillExit); + INFO_PRINTF1(buf); + } + else if (threadArray[i].ExitType() == EExitPending) + { + _LIT(KPendingExit, " EExitPending"); + buf.Append(KPendingExit); + INFO_PRINTF1(buf); + errorsFound++; + } + else + { + _LIT(KOtherExit, " other "); + buf.Append(KOtherExit); + INFO_PRINTF1(buf); + errorsFound++; + } + } + + for (i=0; iDes(); + + // Run the actual test, and trap possible leave + TRAPD(leave, LocationRequestThreadMainPartL(ptr)); + + // Open connection to file server + RFs fs; + User::LeaveIfError(fs.Connect()); + + TInt index = *((TInt*) aData); + + TBuf<30> errorFile; + _LIT(KInfThread, "c:\\logs\\thread%derrinfo.txt"); + errorFile.Format(KInfThread, index); + + // Open log file + RFile file; + + TInt err = file.Replace(fs,errorFile,EFileStreamText|EFileWrite); + + if (err != KErrNone) + { + User::Leave(err); + } + + _LIT(KErrLeave, "*** This thread (thread %d) leave code: %d\r\n"); + ptr.AppendFormat(KErrLeave, index, leave); + + TFileText fileText; + fileText.Set(file); + + fileText.Write(ptr); + + // Close log file + file.Close(); + fs.Close(); + + // Delete cleanup stack + delete cleanup; + + // Exit this thread with leave code (KErrNone in successful case) + User::Exit(leave); + + return 0; +} + +// --------------------------------------------------------- +// CPosTp208::DoFastConnectionL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TInt CT_LbsClientPosTp208::DoFastConnectionL() + { + TInt err; + + // Create two different threads. Each thread connects + // and disconnect from MLFW very fast. + const TInt KMinHeapSize = 4096; + const TInt KMaxHeapSize = 128000; + + RThread thread2; + RThread thread3; + + TInt thread2Id = 2; + TInt thread3Id = 3; + + // Make sure that if one of the threads panic, whole emulator is not + // paniced (this has effect only in Wins). + User::SetJustInTime(EFalse); + + _LIT(KInfo, "Create two threads"); + INFO_PRINTF1(KInfo); + + err = thread2.Create(KThread2Name, LocationRequestThread, KDefaultStackSize, + KMinHeapSize, KMaxHeapSize, &thread2Id); + + AssertTrueL(err == KErrNone, KErrMsgThreadCreation, err); + + err = thread3.Create(KThread3Name, LocationRequestThread, KDefaultStackSize, + KMinHeapSize, KMaxHeapSize, &thread3Id); + + AssertTrueL(err == KErrNone, KErrMsgThreadCreation, err); + + // Logon to each thread, so we can get a notification when they kill + // themselves. + TRequestStatus status2, status3; + thread2.Logon(status2); + thread3.Logon(status3); + + _LIT(KStart, "Start the threads will connect to and disconnect to MLFW,"); + INFO_PRINTF1(KStart); + + // Start all treads. + thread2.Resume(); + User::After(2000000); + thread3.Resume(); + + + // Wait for all threads to exit + User::WaitForRequest(status2); + User::WaitForRequest(status3); + + // Actual test is now run. + _LIT(KInfoExit, "All threads have exited, exit reasons:"); + INFO_PRINTF1(KInfoExit); + + // Check that all threads had correct exit reason. Also log + // all the exit reasons into log file. + TInt exitReasonsCorrect = 0; + + exitReasonsCorrect |= thread2.ExitReason(); + exitReasonsCorrect |= thread3.ExitReason(); + + // Close all handles to threads. + thread2.Close(); + thread3.Close(); + + // Return back to normal mode + User::SetJustInTime(ETrue); + return exitReasonsCorrect; + } + +// --------------------------------------------------------- +// CPosTp208::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp208::StartL() + { + //first do a simple connection test + TInt fasterr = DoFastConnectionL(); + _LIT(KFailConnect, "Fast connection failed"); + AssertTrueL(fasterr == KErrNone, KFailConnect, fasterr); + + SetupPsyL(iUidMultiPsy); + + TInt nrOfRounds = 1; + TBuf<100> buf; + + _LIT(KPsitionUpdate, + ">>>>>>>>>>Running StartThreads(ETrue) requesting position updates<<<<<<<<"); + INFO_PRINTF1(KPsitionUpdate); + + _LIT(KEmptySpace, ""); + _LIT(KRound, ">>>>>>Round nr %d :"); + _LIT(KErrorsFound, "Errors found!!!"); + + for (TInt i=0; i>>>>>>>>>Running StartThreads(EFalse) connect/disconnect Epos<<<<<<<<"); + INFO_PRINTF1(KConnectDisconnect); + nrOfRounds = 5; + for (TInt j=0; j +#include +#include +#include "ctlbsclientpostp21.h" +// CONSTANTS + +// ================= MEMBER FUNCTIONS ====================== + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp21::CT_LbsClientPosTp21(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP21 - Enable/Disable PSY"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp21::~CT_LbsClientPosTp21() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp21::CloseTest +// Always called after the test, even if the test leaves +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp21::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp21::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp21::StartL() + { + _LIT(KTestFailedText1, "Unable to open positioner, error code = %d"); + _LIT(KRequestor, "SAAA"); + + TUid myPsyId = iUidStubPositioner; + + // Setup - copy files + + ConnectL(); + + // Enable myPsyId, disable all others + SetupPsyL(myPsyId, ETrue); + // Open subsession to enabled PSY + TInt error = OpenPositionerByName(myPsyId); // Psy is enabled by default + if (error != KErrNone) + { + TBuf<100> errMsg; + errMsg.Format(KTestFailedText1, error); + LogErrorAndLeaveL(errMsg); + } + // Make a request + PerformRequestL(KRequestor, CRequestor::ERequestorService, CRequestor::EFormatTelephone); + CheckRequestResultL(KErrNone); + + // Disable the PSY and perform another request + SetupPsyL(myPsyId, EFalse); + User::After(10000000); + PerformRequestL(KRequestor, CRequestor::ERequestorService, CRequestor::EFormatTelephone); + CheckRequestResultL(KErrNotFound); + + // Close the subsession and create another one + ClosePositioner(); + + error = OpenPositionerByName(myPsyId); + if (error != KErrNotFound) + { + TBuf<100> errMsg; + errMsg.Format(KTestFailedText1, error); + LogErrorAndLeaveL(errMsg); + } + + // Enable the module and make a request + SetupPsyL(myPsyId, ETrue); + + error = OpenPositionerByName(myPsyId); + PerformRequestL(KRequestor, CRequestor::ERequestorService, CRequestor::EFormatTelephone); + CheckRequestResultL(KErrNone); + + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp21::SetupPsyL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp21::SetupPsyL(const TUid aPsyUid, + TBool aChoice) + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + // Disable PSY + moduleUpdate->SetUpdateAvailability(EFalse); + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + // Disable all PSY:s + TInt size = prioList->Count(); + for (TInt i = 0 ; i < size; i++) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + + // Enable/Disable the PSY that came as an in parameter + if (aChoice) + { + moduleUpdate->SetUpdateAvailability(ETrue); + } + else + { + moduleUpdate->SetUpdateAvailability(EFalse); + } + + db->UpdateModuleL(aPsyUid, *moduleUpdate); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp213.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp213.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,384 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDE FILES +#include "ctlbsclientpostp213.h" +#include "ctlbsclientrequestor.h" +#include "ctlbsclienteventtimer.h" +#include +#include +#include +#include +#include + +// CONSTANTS +_LIT(KClient1, "RunL client1"); +_LIT(KClient2, "RunL client2"); +_LIT(KClient3, "RunL client3"); + +_LIT(KClient1Default, "RunL client1, default psy"); +_LIT(KClient2Default, "RunL client2, default psy"); +_LIT(KClient3Default, "RunL client3, default psy"); + +//Error logs +_LIT( KErrStatusMismatch, "Statuses does not conform to each other!" ); +_LIT( KEventReceived, "Client 3 received an event that shouldn't be received!" ); +_LIT( KCanceledRequest, "Client 2 didn't receive KErrCancel, but %d!" ); +_LIT( KFileNotDeleted, "File created by PSY NOT deleted! PSY really unloaded from memory?" ); + +//File name. Beware, also declared in EPos_CTestStatusPsy.h!!!! +_LIT(KDummyFileName, "c:\\TestStatusPsyIsNotUnloaded.txt"); + +// ================= MEMBER FUNCTIONS ======================= + +// Constructor. +CT_LbsClientPosTp213::CT_LbsClientPosTp213(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP213 - Disabling psy during request"); + SetTestStepName(KTestName); + } + +// Destructor +CT_LbsClientPosTp213::~CT_LbsClientPosTp213() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp213::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp213::CloseTest() + { + delete ieventtimer; + ieventtimer = NULL; + + delete iclient1; + delete iclient2; + delete iclient3; + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp213::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp213::StartL() + { + TBool usedefaultpsy = FALSE; // Indicating if the default psy should be used + iNoFurtherEvents = FALSE; // Client should receive events! + iErrorDuringExecution = FALSE; // True if an error occurs + + //Enable PSY + CPosModules* idb = CPosModules::OpenL(); + CleanupStack::PushL(idb); + _LIT(KEnablePSY, "Enabling Test Status PSY"); + INFO_PRINTF1(KEnablePSY); + EnablePsyL(*idb, iUidTestStatusPsy); + + // Event timer + ieventtimer = CT_LbsClientEventTimer::NewL(Logger()); + ieventtimer->SetObserver(this); + + // 3 clients + iclient1 = CT_LbsClientRequestor::NewL(iUidTestStatusPsy, this, KClient1, Logger()); + iclient2 = CT_LbsClientRequestor::NewL(iUidTestStatusPsy, this, KClient2, Logger()); + iclient3 = CT_LbsClientRequestor::NewL(iUidTestStatusPsy, this, KClient3, Logger()); + + // Make a request with client 2 + _LIT(KRequestClient2, "Calling StartRequestL for client2"); + INFO_PRINTF1(KRequestClient2); + iclient2->StartRequestL(usedefaultpsy); + + // Make client3 listen for status events + iclient3->RequestModuleStatusEvent(); + + // Disable Psy 3 + User::After(100000); //a small delay + _LIT(KDisablePSY, "Disabling Test Status PSY"); + INFO_PRINTF1(KDisablePSY); + DisablePsyL(*idb, iUidTestStatusPsy); + + // Client1 reads Module Status + // Client API + TInt clientapistatus = iclient1->ReadModuleStatusClientApi(iUidTestStatusPsy); + _LIT(KClientApi, "Module Status from Client API: %d."); + TBuf<100> bufclientapi; + bufclientapi.Format(KClientApi, clientapistatus); + INFO_PRINTF1(bufclientapi); + + // Modules API + TInt modulesapistatus = iclient1->ReadModuleStatusModulesApi(idb, iUidTestStatusPsy); + _LIT(KModulesApi, "Module Status from Module API: (IsAvailable=) %d."); + TBuf<100> bufmodulesapi; + bufmodulesapi.Format(KModulesApi, modulesapistatus); + INFO_PRINTF1(bufmodulesapi); + // Compare received statuses + if ( !((modulesapistatus == 0) && (clientapistatus == TPositionModuleStatus::EDeviceDisabled)) ) + { + iErrorDuringExecution = TRUE; + ERR_PRINTF1(KErrStatusMismatch); + } + + iclient2->ClosePositioner(); + + delete iclient1; + delete iclient2; + delete iclient3; + + ///////////////////// Default PSY ///////////////////////////////////// + + // Do the same as before but now use the default PSY + iNoFurtherEvents = FALSE; // Client should receive events! + _LIT(KDefaultPsyStart, "****** Testing Default PSY ******"); + INFO_PRINTF1(KDefaultPsyStart); + + // Enable Psy + INFO_PRINTF1(KEnablePSY); + EnablePsyL(*idb, iUidTestStatusPsy); + + // 3 clients + iclient1 = CT_LbsClientRequestor::NewL(iUidTestStatusPsy, this, KClient1Default, Logger()); + iclient2 = CT_LbsClientRequestor::NewL(iUidTestStatusPsy, this, KClient2Default, Logger()); + iclient3 = CT_LbsClientRequestor::NewL(iUidTestStatusPsy, this, KClient3Default, Logger()); + + // Make a request with client 2 + INFO_PRINTF1(KRequestClient2); + iclient2->StartRequestL(usedefaultpsy); + + // Make client3 listen for status events + iclient3->RequestModuleStatusEvent(); + + // Disable Psy 3 + User::After(1000000); //A small delay + usedefaultpsy = TRUE; //Use default PSY + INFO_PRINTF1(KDisablePSY); + DisablePsyL(*idb, iUidTestStatusPsy); + + // Client1 reads Module Status + // Client API + clientapistatus = iclient1->ReadModuleStatusClientApi(iUidTestStatusPsy); + bufclientapi.Format(KClientApi, clientapistatus); + INFO_PRINTF1(bufclientapi); + + // Modules API + modulesapistatus = iclient1->ReadModuleStatusModulesApi(idb, iUidTestStatusPsy); + bufmodulesapi.Format(KModulesApi, modulesapistatus); + INFO_PRINTF1(bufmodulesapi); + // Compare received statuses + if ( !((modulesapistatus == 0) && (clientapistatus == TPositionModuleStatus::EDeviceDisabled)) ) + { + iErrorDuringExecution = TRUE; + ERR_PRINTF1(KErrStatusMismatch); + } + + iclient2->ClosePositioner(); + + delete iclient1; + iclient1 = NULL; + delete iclient2; + iclient2 = NULL; + delete iclient3; + iclient3 = NULL; + + // Connect to EPos + User::LeaveIfError(iPosServer.Connect()); + + // Enable Psy + INFO_PRINTF1(KEnablePSY); + EnablePsyL(*idb, iUidTestStatusPsy); + + // Open subsession to Status Psy that still is disabled!!! + _LIT(KInfoStatusPSY, "Calling OpenPositionerByName for Test Status PSY"); + INFO_PRINTF1(KInfoStatusPSY); + TInt err = OpenPositionerByName(iUidTestStatusPsy); + User::After(100000); //A small delay + + if (err != KErrNone) + { + _LIT(KErrorRequest, "OpenPositionerByName failed, errCode = %d"); + TBuf<100> buf; + buf.Format(KErrorRequest, err); + LogErrorAndLeaveL(buf); + } + + // Make a position request + _LIT(KService, "service"); + TPositionInfo positionInfo = TPositionInfo(); + _LIT(KPerformSyncRequest, "Calling PerformSyncRequest"); + INFO_PRINTF1(KPerformSyncRequest); + err = PerformSyncRequest(KService, &positionInfo); + + if (err != KErrNone) + { + _LIT(KErrorRequest, "The last request was not completed with KErrorNone, errCode = %d"); + TBuf<100> buf; + buf.Format(KErrorRequest, err); + LogErrorAndLeaveL(buf); + } + + //Close Positioner + ClosePositioner(); + + //Disconnect from Epos + Disconnect(); + + CleanupStack::PopAndDestroy(idb); + + //Checking if any errors occured during execution + if (iErrorDuringExecution) + { + _LIT(KErrorAndLeave, "Error(s) occured during execution, closing test!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp213::EnablePsyL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp213::EnablePsyL( + CPosModules& aDb, + TUid aPsy) + { + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + // Enable Psy + moduleUpdate->SetUpdateAvailability(ETrue); + aDb.UpdateModuleL(aPsy, *moduleUpdate); + CleanupStack::PopAndDestroy(moduleUpdate); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp213::DisablePsyL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp213::DisablePsyL( + CPosModules& aDb, + TUid aPsy) + { + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + // Disable Psy + moduleUpdate->SetUpdateAvailability(EFalse); + aDb.UpdateModuleL(aPsy, *moduleUpdate); + CleanupStack::PopAndDestroy(moduleUpdate); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp213::RequestCompleteL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp213::RequestCompleteL() + { + if (iclient2->CompletionCode() != KNoEvent) + { + _LIT(KClient2Compl, "Client 2 request completed with %d."); + TBuf<100> bufclient2comp; + bufclient2comp.Format(KClient2Compl, iclient2->CompletionCode()); + INFO_PRINTF1(bufclient2comp); + + if (iclient2->CompletionCode() != KErrCancel) + { + TBuf<80> errorMessage; + errorMessage.Format( KCanceledRequest, iclient2->CompletionCode() ); + ERR_PRINTF1( errorMessage ); + } + + /*Testing if PSY is unloaded from memory. PSY created a temp-file that only should + exist during its lifespan. */ + User::After(5000000); + RFs fileserver; + RFile file; + User::LeaveIfError(fileserver.Connect()); + TInt err = file.Open(fileserver, KDummyFileName, EFileWrite); + if (err == KErrNone || err == KErrInUse) + { + ERR_PRINTF1(KFileNotDeleted); + } + file.Close(); + fileserver.Close(); + + iclient2->ClosePositioner(); + iclient2->ResetCompletionCode(); + } + + else if (iclient3->CompletionCode() != KNoEvent) + { + iclient3->ResetCompletionCode(); + _LIT(KClient3Compl, "Client 3 request completed, "); + INFO_PRINTF1(KClient3Compl); + + if (iNoFurtherEvents) //Client 3 received event but should NOT have! + { + iErrorDuringExecution = TRUE; + ERR_PRINTF1(KEventReceived); + } + + //Read what event was received! + TInt eventReading = iclient3->ReadModuleStatusEvent(); + + if (eventReading != TPositionModuleStatus::EDeviceDisabled) //NO Disable Event! + { + _LIT(KClientStatusRead, "Event received by client not EDeviceDisabled, but %d."); + TBuf<100> bufstatusread; + bufstatusread.Format(KClientStatusRead, eventReading); + INFO_PRINTF1(bufstatusread); + + //Make client3 listen for status events again!! + iclient3->ContinueRequesting(); + } + else //A Disable Event! + { + _LIT(KClient3ComplDisabled, "Client 3 received EDeviceDisabled event!"); + INFO_PRINTF1(KClient3ComplDisabled); + + //Make client3 listen for status events again!! + iclient3->ContinueRequesting(); + + /*Wait 5 s for events before halting the scheduler. + No further events for client 3 should be received! */ + ieventtimer->Start(5000000); + iNoFurtherEvents = TRUE; + //Start Timer + _LIT(KStartTiming, "Start Timer, 5 s."); + INFO_PRINTF1(KStartTiming); + } + } + else if (ieventtimer->CompletionCode() != KNoEvent) //Time-out + { + ieventtimer->ResetCompletionCode() ; + + //Stop Scheduler + _LIT(KTimeOut, "Timer Stopped."); + INFO_PRINTF1(KTimeOut); + CActiveScheduler::Stop(); + } + else + { + _LIT(KUnknownEvent, "Unknown request was completed!"); + LogErrorAndLeaveL(KUnknownEvent); + } + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp217.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp217.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,513 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp217.h" +#include +#include +#include + +// CONSTANTS +const TInt MAX_AGE_TIME = 10000000; // 10 sec + +_LIT(KKallesService, "Kalles Service"); + +// ================= MEMBER FUNCTIONS ======================= + +// Constructor. +CT_LbsClientPosTp217::CT_LbsClientPosTp217(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP217 - Max Age, specific Psy"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp217::~CT_LbsClientPosTp217() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp217::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp217::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// This flag must be defined if MaxAge is NOT supported +#ifdef MAX_AGE_NOT_SUPPORTED + +// --------------------------------------------------------- +// CT_LbsClientPosTp217::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +// MaxAge NOT supported +void CT_LbsClientPosTp217::StartL() + { + TTimeIntervalMicroSeconds maxAge = TTimeIntervalMicroSeconds(MAX_AGE_TIME); + + SetupPsyL(iUidTestPsyMaxAge); + + //connect to EPos + User::LeaveIfError(iPosServer.Connect()); + TInt err = KErrNone; + TRequestStatus myStatus; + + // Open default psy + User::LeaveIfError(iPositioner.Open(iPosServer)); + TBuf<150> buf; + + TPositionUpdateOptions posOption; + posOption.SetMaxUpdateAge(maxAge); + + _LIT(KTestMaxAge, "Testing that MaxAge is not supported"); + INFO_PRINTF1(KTestMaxAge); + err = iPositioner.SetUpdateOptions(posOption); + _LIT(KErr, "MaxAge should NOT be supported instead code %d was returned"); + AssertTrueL(err == KErrNotSupported, KErr, err); + + TPositionInfo posInfo1 = TPositionInfo(); + TPositionInfo posInfo2 = TPositionInfo(); + + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KKallesService); + + // Get position, first position + iPositioner.NotifyPositionUpdate(posInfo1, myStatus); + + User::WaitForRequest(myStatus); + + err = myStatus.Int(); + _LIT(KNotifyPositionUpdate, "Error from NotifyPositionUpdate, err %d"); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + _LIT(KWaitMaxAge, "Wait for half Max Age..."); + INFO_PRINTF1(KWaitMaxAge); + // Wait half MAX_AGE_TIME + User::After(HALF_MAX_AGE_TIME); + + // Get position again, should be the same as first position + iPositioner.NotifyPositionUpdate(posInfo2, myStatus); + User::WaitForRequest(myStatus); + err = myStatus.Int(); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + if (ComparePositionL(posInfo1, posInfo2)) + { + _LIT(KErrorAndLeave, + "The old position was returned from positioner, MaxAge seems to be supported!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + } + +#else +// --------------------------------------------------------- +// CT_LbsClientPosTp217::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +// MaxAge supported +void CT_LbsClientPosTp217::StartL() + { + TTimeIntervalMicroSeconds maxAge = TTimeIntervalMicroSeconds(MAX_AGE_TIME); + + //connect to EPos + User::LeaveIfError(iPosServer.Connect()); + TInt err = KErrNone; + + SetupPsyL(iUidTestPsyMaxAge); + + //Open subsession + User::LeaveIfError(iPositioner.Open(iPosServer, iUidTestPsyMaxAge)); + TBuf<150> buf; + + TPositionInfo posInfo = TPositionInfo(); + TPositionInfo posInfo2 = TPositionInfo(); + TRequestStatus myStatus; + + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KKallesService); + + // Make sure that it is possible to get position from psy + iPositioner.NotifyPositionUpdate(posInfo, myStatus); + User::WaitForRequest(myStatus); + err = myStatus.Int(); + _LIT(KNotifyPositionUpdate, "Error from NotifyPositionUpdate"); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + const TTimeIntervalMicroSeconds32 KSomeTime(1000000); //1 sec + User::After(KSomeTime); + + // Make sure that the psy returns differens positions + iPositioner.NotifyPositionUpdate(posInfo2, myStatus); + User::WaitForRequest(myStatus); + err = myStatus.Int(); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + if (ComparePositionL(posInfo, posInfo2)) + { + _LIT(KErrorAndLeave, "The same position was returned from positioner!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + TPositionUpdateOptions returnPosOption; + iPositioner.GetUpdateOptions(returnPosOption); + TTimeIntervalMicroSeconds returnInterval = returnPosOption.MaxUpdateAge(); + + _LIT(KMageAge, "Max age should not hold a value"); + AssertTrueL(returnInterval == TTimeIntervalMicroSeconds(0), + KMageAge, KErrGeneral); + + TPositionUpdateOptions posOption; + posOption.SetMaxUpdateAge(maxAge); + err = iPositioner.SetUpdateOptions(posOption); + + _LIT(KChange, "ERROR: When setting max age in SetMaxAge, error %d"); + AssertTrueL(err == KErrNone, KChange, err); + + TPositionUpdateOptions returnPosOption2; + iPositioner.GetUpdateOptions(returnPosOption2); + + returnInterval = returnPosOption2.MaxUpdateAge(); + _LIT(KNotMatch, "Max age does not match, %d %d "); + buf.Format(KNotMatch, returnInterval.Int64(), MAX_AGE_TIME); + + AssertTrueL(returnInterval == maxAge, buf, KErrGeneral); + + TPositionInfo posInfo3 = TPositionInfo(); + TPositionInfo posInfo4 = TPositionInfo(); + TPositionInfo posInfo5 = TPositionInfo(); + // Get position, first position + iPositioner.NotifyPositionUpdate(posInfo3, myStatus); + + User::WaitForRequest(myStatus); + err = myStatus.Int(); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + TPosition position = TPosition(); + posInfo.GetPosition(position); + + // Wait half MAX_AGE_TIME + const TTimeIntervalMicroSeconds32 KHalfTime(MAX_AGE_TIME/2); //5 sec + User::After(KHalfTime); + + // Get position again, should be the same as first position + iPositioner.NotifyPositionUpdate(posInfo4, myStatus); + + User::WaitForRequest(myStatus); + err = myStatus.Int(); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + if (!ComparePositionL(posInfo3, posInfo4)) + { + _LIT(KErrorAndLeave, "The same position was returned from positioner!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // Wait MAX_AGE_TIME + const TTimeIntervalMicroSeconds32 KTime(MAX_AGE_TIME); //10 sec + User::After(KTime); + + // Get position again, should NOT be the same as earlier + iPositioner.NotifyPositionUpdate(posInfo5, myStatus); + + User::WaitForRequest(myStatus); + err = myStatus.Int(); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + if (ComparePositionL(posInfo4, posInfo5)) + { + _LIT(KErrorAndLeave, "The same position was returned from positioner!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + //Try to set an interval that is less than MaxAge + TTimeIntervalMicroSeconds mySmallInterval = TTimeIntervalMicroSeconds(400000); + posOption.SetUpdateInterval(mySmallInterval); + posOption.SetMaxUpdateAge(maxAge); + + err = iPositioner.SetUpdateOptions(posOption); + _LIT(KErr2, "Setting updateinterval less than MaxAge should result in KErrArgument, instead error %d"); + AssertTrueL(err == KErrArgument, KErr2, err); + + // Check that the MaxAge did not change + iPositioner.GetUpdateOptions(returnPosOption); + TTimeIntervalMicroSeconds interval = returnPosOption.MaxUpdateAge(); + + if (interval != maxAge) + { + _LIT(KErrorAndLeave, "MaxAge does not match %d with %d"); + buf.Format(KErrorAndLeave, interval.Int64(), maxAge.Int64()); + LogErrorAndLeaveL(buf); + } + + + ClosePositioner(); + Disconnect(); + + ExtendedTesting1(); + + ExtendedTesting2(); + } + +#endif + +// --------------------------------------------------------- +// CT_LbsClientPosTp217::ExtendedTesting1 +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp217::ExtendedTesting1() + { + _LIT(KFunctionName, "We are inside ExtendedTesting1()"); + INFO_PRINTF1(KFunctionName); + TTimeIntervalMicroSeconds maxAge = TTimeIntervalMicroSeconds(5000000); + TTimeIntervalMicroSeconds myInterval = TTimeIntervalMicroSeconds(400000); + + // Set iUidTestPsyMaxAge to defaultpsy + SetupPsyL(iUidTestPsyMaxAge); + + //connect to EPos + User::LeaveIfError(iPosServer.Connect()); + TInt err = KErrNone; + + // Open default psy + User::LeaveIfError(iPositioner.Open(iPosServer)); + + TPositionUpdateOptions posOption; + + //Try to set an interval that is less than MaxAge + posOption.SetUpdateInterval(myInterval); + posOption.SetMaxUpdateAge(maxAge); + + err = iPositioner.SetUpdateOptions(posOption); + _LIT(KErr2, "Setting updateinterval less than MaxAge should result in KErrArgument, instead error %d"); + AssertTrueL(err == KErrArgument, KErr2, err); + + // Check that the MaxAge did not change + TPositionUpdateOptions returnPosOption; + iPositioner.GetUpdateOptions(returnPosOption); + + //Try to set an interval that is equal to MaxAge + posOption.SetUpdateInterval(maxAge); + posOption.SetMaxUpdateAge(maxAge); + + err = iPositioner.SetUpdateOptions(posOption); + _LIT(KErr3, "Setting updateinterval equal to MaxAge should result in KErrArgument, instead error %d"); + AssertTrueL(err == KErrArgument, KErr3, err); + + ClosePositioner(); + Disconnect(); + _LIT(KFunctionDone, "ExtendedTesting1 Done"); + INFO_PRINTF1(KFunctionDone); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp217::ExtendedTesting2 +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp217::ExtendedTesting2() + { + _LIT(KFunctionName, "We are inside ExtendedTesting2()"); + INFO_PRINTF1(KFunctionName); + TTimeIntervalMicroSeconds maxAge = TTimeIntervalMicroSeconds(30000000); // 30 sec + TTimeIntervalMicroSeconds maxAge2 = TTimeIntervalMicroSeconds(4000000); // 4 sec + + // The MaxAge psy adds one second to the timeout time, therefore 6 seconds here (just to be sure) + const TTimeIntervalMicroSeconds32 KSomeTime(6000000); //6 sec + + //connect to EPos + User::LeaveIfError(iPosServer.Connect()); + TInt err = KErrNone; + //Open subsession + User::LeaveIfError(iPositioner.Open(iPosServer, iUidTestPsyMaxAge)); + + SetupPsyL(iUidTestPsyMaxAge); + + TPositionInfo posInfo1 = TPositionInfo(); + TPositionInfo posInfo2 = TPositionInfo(); + TPositionInfo posInfo3 = TPositionInfo(); + TPositionInfo posInfo4 = TPositionInfo(); + + TRequestStatus myStatus; + + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KKallesService); + + // Make sure that it is possible to get position from psy + iPositioner.NotifyPositionUpdate(posInfo1, myStatus); + User::WaitForRequest(myStatus); + err = myStatus.Int(); + _LIT(KNotifyPositionUpdate, "Error from NotifyPositionUpdate"); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + // Add a short delay here so that the MaxAge Psy has the possibilty + // to create a new random position (the randomization seed is created with a time) + User::After(2000000); + + // Make sure that the psy returns differens positions + iPositioner.NotifyPositionUpdate(posInfo2, myStatus); + User::WaitForRequest(myStatus); + err = myStatus.Int(); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + if (ComparePositionL(posInfo1, posInfo2)) + { + _LIT(KErrorAndLeave, "The same position was returned from positioner!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // Set MaxAge + TPositionUpdateOptions posOption; + posOption.SetMaxUpdateAge(maxAge); + err = iPositioner.SetUpdateOptions(posOption); + + _LIT(KChange, "ERROR: When setting max age in SetMaxAge, error %d"); + AssertTrueL(err == KErrNone, KChange, err); + User::After(KSomeTime); + + iPositioner.NotifyPositionUpdate(posInfo3, myStatus); + User::WaitForRequest(myStatus); + err = myStatus.Int(); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + // This position should be the old one + if (!ComparePositionL(posInfo2, posInfo3)) + { + _LIT(KErrorAndLeave, "The same position was returned from positioner!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // Now change MaxAge again and check that it has been changed + posOption.SetMaxUpdateAge(maxAge2); + err = iPositioner.SetUpdateOptions(posOption); + + _LIT(KChange2, "ERROR: When setting max age in SetMaxAge (2), error %d"); + AssertTrueL(err == KErrNone, KChange2, err); + _LIT(KTimeout, "Waiting for the new maxage-timeout"); + INFO_PRINTF1(KTimeout); + User::After(KSomeTime); + + iPositioner.NotifyPositionUpdate(posInfo4, myStatus); + User::WaitForRequest(myStatus); + err = myStatus.Int(); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + // This position should be new since maxage has expired + if (ComparePositionL(posInfo3, posInfo4)) + { + _LIT(KErrorAndLeave, "The same position was returned from positioner!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + ClosePositioner(); + Disconnect(); + _LIT(KFunctionDone, "ExtendedTesting2() Done"); + INFO_PRINTF1(KFunctionDone); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp217::ComparePositionL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CT_LbsClientPosTp217::ComparePositionL(TPositionInfo aPosInfo1, TPositionInfo aPosInfo2) + { + _LIT(KFunctionName, "We are inside ComparePositionL"); + INFO_PRINTF1(KFunctionName); + TBool result = ETrue; + TBuf<150> buf; + + TPosition pos1 = TPosition(); + TPosition pos2 = TPosition(); + aPosInfo1.GetPosition(pos1); + aPosInfo2.GetPosition(pos2); + + TTime time1 = pos1.Time(); + TTime time2 = pos2.Time(); + + if (time1 == time2) + { + _LIT(KEqualTime, "Equal Time"); + INFO_PRINTF1(KEqualTime); + } + else + { + _LIT(KNotEqualTime, "NOT Equal Time"); + INFO_PRINTF1(KNotEqualTime); + } + + if ((time1 != time2) || (pos1.Latitude() != pos2.Latitude()) || + (pos1.Longitude() != pos2.Longitude()) || + (pos1.Altitude() != pos2.Altitude()) ) + { + // Not equal + result = EFalse; + _LIT(KNotEqual, "Not equal"); + INFO_PRINTF1(KNotEqual); + _LIT(KPosition1, "Position1: Lat %f Long %f Alt %f"); + buf.Format(KPosition1, pos1.Latitude(), pos1.Longitude() ,pos1.Altitude()); + INFO_PRINTF1(buf); + _LIT(KPosition2, "Position1: Lat %f Long %f Alt %f"); + buf.Format( KPosition2, pos2.Latitude(), pos2.Longitude() ,pos2.Altitude()); + INFO_PRINTF1(buf); + } + else + { + _LIT(KEqual, "Equal"); + INFO_PRINTF1(KEqual); + result = ETrue; + _LIT(KPosition1, "Position1: Lat %f Long %f Alt %f"); + buf.Format( KPosition1, pos1.Latitude(), pos1.Longitude() ,pos1.Altitude()); + INFO_PRINTF1(buf); + } + + return result; + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp217::AssertTrueSecL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp217::AssertTrueL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode) + { + if (!aCondition) + { + // LogErrorAndLeave does not leave if KErrNone is error + if (aErrorCode == KErrNone) aErrorCode = KErrGeneral; + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + LogErrorAndLeaveL(buf, aErrorCode); + } + } + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp218.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp218.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,414 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp218.h" +#include +#include +#include +#include + +// CONSTANTS +const TInt MAX_AGE_TIME = 10000000; // 10 sec +const TInt HALF_MAX_AGE_TIME = 5000000; // 5 sec + +_LIT(KKallesService, "Kalles Service"); + +// ================= MEMBER FUNCTIONS ======================= + +// Constructor. +CT_LbsClientPosTp218::CT_LbsClientPosTp218(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP218 - Max Age, default Psy"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp218::~CT_LbsClientPosTp218() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp218::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp218::CloseTest() + { + ClosePositioner(); + iPositioner1.Close(); + iPositioner2.Close(); + Disconnect(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp218::SetupDefaultPsyL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp218::SetupDefaultPsyL(const TUid aPsyUid) + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + SetupPsyL(aPsyUid); + //setting priority + TPositionModuleInfo moduleInfoHp;//Hp - high prio; + TPositionModuleInfo moduleInfoLp;//Lp - low prio; + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + db->GetModuleInfoL(prioList->At(0), moduleInfoHp); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + if (aPsyUid.iUid == moduleInfoHp.ModuleId().iUid) + { + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL((*prioList)[0], *moduleUpdate); + } + else + { + db->GetModuleInfoL(aPsyUid, moduleInfoLp); + db->UpdateModuleL(aPsyUid, *moduleUpdate); + TUint hp = db -> PriorityL(moduleInfoHp.ModuleId()); + TUint lp = db -> PriorityL(moduleInfoLp.ModuleId()); + db->SetModulePriorityL(aPsyUid, hp); //lp + db->SetModulePriorityL((*prioList)[0], lp); //hp + } + + moduleUpdate->SetUpdateAvailability(ETrue); + db -> UpdateModuleL(aPsyUid, *moduleUpdate); + + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(2); // db, prioList + } + + +// This flag must be defined if MaxAge should NOT be tested +#ifdef MAX_AGE_NOT_SUPPORTED +// --------------------------------------------------------- +// CT_LbsClientPosTp218::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +// >>>>>>>>>>>>>>>MaxAge NOT supported<<<<<<<<<<<<<<<<<<<<<< +void CT_LbsClientPosTp218::StartL() + { + TTimeIntervalMicroSeconds maxAge = TTimeIntervalMicroSeconds(MAX_AGE_TIME); + + // Set iUidTestPsyMaxAge to defaultpsy + SetupDefaultPsyL(iUidTestPsyMaxAge); + + //connect to EPos + User::LeaveIfError(iPosServer.Connect()); + TInt err = KErrNone; + TRequestStatus myStatus; + + // Open default psy + User::LeaveIfError(iPositioner.Open(iPosServer)); + TBuf<150> buf; + + SetupGlobalPrivacyL(TPosPrivacy(TPosPrivacy::EAcceptAll, EFalse)); + + TPositionUpdateOptions posOption; + posOption.SetMaxUpdateAge(maxAge); + + _LIT(KTestMaxAge, "Testing that MaxAge is not supported"); + INFO_PRINTF1(KTestMaxAge); + err = iPositioner.SetUpdateOptions(posOption); + _LIT(KErr, "MaxAge should NOT be supported instead code %d was returned"); + AssertTrueL(err == KErrNotSupported, KErr, err); + + TPositionInfo posInfo1 = TPositionInfo(); + TPositionInfo posInfo2 = TPositionInfo(); + + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KKallesService); + + // Get position, first position + iPositioner.NotifyPositionUpdate(posInfo1, myStatus); + + User::WaitForRequest(myStatus); + + err = myStatus.Int(); + _LIT(KNotifyPositionUpdate, "Error from NotifyPositionUpdate, err %d"); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + _LIT(KWaitMaxAge, "Wait for half Max Age..."); + INFO_PRINTF1(KWaitMaxAge); + // Wait half MAX_AGE_TIME + User::After(HALF_MAX_AGE_TIME); + + // Get position again, should be the same as first position + iPositioner.NotifyPositionUpdate(posInfo2, myStatus); + User::WaitForRequest(myStatus); + err = myStatus.Int(); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + if (ComparePositionL(posInfo1, posInfo2)) + { + _LIT(KErrorAndLeave, + "The old position was returned from positioner, MaxAge seems to be supported!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + } + +#else +// --------------------------------------------------------- +// CT_LbsClientPosTp218::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +// >>>>>>>>>>>>>>>>>>>>MaxAge supported<<<<<<<<<<<<<<<<<<<<<< +void CT_LbsClientPosTp218::StartL() + { + TTimeIntervalMicroSeconds maxAge = TTimeIntervalMicroSeconds(MAX_AGE_TIME); + + // Set iUidTestPsyMaxAge to defaultpsy + SetupDefaultPsyL(iUidTestPsyMaxAge); + + //connect to EPos + User::LeaveIfError(iPosServer.Connect()); + TInt err = KErrNone; + + // Open default psy + User::LeaveIfError(iPositioner.Open(iPosServer)); + TBuf<150> buf; + + TPositionInfo posInfo = TPositionInfo(); + TPositionInfo posInfo2 = TPositionInfo(); + TRequestStatus myStatus; + + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KKallesService); + + // Make sure that it is possible to get position from psy + iPositioner.NotifyPositionUpdate(posInfo, myStatus); + User::WaitForRequest(myStatus); + err = myStatus.Int(); + _LIT(KNotifyPositionUpdate, "Error from NotifyPositionUpdate, err %d"); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + // Make sure that the psy returns differens positions + iPositioner.NotifyPositionUpdate(posInfo2, myStatus); + User::WaitForRequest(myStatus); + err = myStatus.Int(); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + + TPositionUpdateOptions returnPosOption; + iPositioner.GetUpdateOptions(returnPosOption); + TTimeIntervalMicroSeconds returnInterval = returnPosOption.MaxUpdateAge(); + + _LIT(KMaxAge, "Max age should not hold a value"); + AssertTrueL(returnInterval == TTimeIntervalMicroSeconds(0), KMaxAge, KErrGeneral); + + TPositionUpdateOptions posOption; + posOption.SetMaxUpdateAge(maxAge); + + err = iPositioner.SetUpdateOptions(posOption); + _LIT(KChange, "Error when setting max age in SetMaxAge, error %d"); + AssertTrueL(err == KErrNone, KChange, err); + + TPositionUpdateOptions returnPosOption2; + iPositioner.GetUpdateOptions(returnPosOption2); + + returnInterval = returnPosOption2.MaxUpdateAge(); + _LIT(KMaxAgeNotMatch, "Max age does not match, %d %d "); + buf.Format(KMaxAgeNotMatch, returnInterval.Int64(), MAX_AGE_TIME); + AssertTrueL(returnInterval == maxAge, buf, KErrGeneral); + + TPositionInfo posInfo3 = TPositionInfo(); + TPositionInfo posInfo4 = TPositionInfo(); + TPositionInfo posInfo5 = TPositionInfo(); + // Get position, first position + iPositioner.NotifyPositionUpdate(posInfo3, myStatus); + + User::WaitForRequest(myStatus); + + err = myStatus.Int(); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + _LIT(KWaitMAxAge, "Wait for half Max Age..."); + INFO_PRINTF1(KWaitMAxAge); + // Wait half MAX_AGE_TIME + User::After(HALF_MAX_AGE_TIME); + + // Get position again, should be the same as first position + iPositioner.NotifyPositionUpdate(posInfo4, myStatus); + User::WaitForRequest(myStatus); + err = myStatus.Int(); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + if (!ComparePositionL(posInfo3, posInfo4)) + { + _LIT(KErrorAndLeave, "The old position was not returned from positioner!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // Wait MAX_AGE_TIME + _LIT(KWait, "Waiting waiting..."); + INFO_PRINTF1(KWait); + User::After(MAX_AGE_TIME); + + // Get position again, should NOT be the same as earlier + iPositioner.NotifyPositionUpdate(posInfo5, myStatus); + + User::WaitForRequest(myStatus); + err = myStatus.Int(); + AssertTrueL(err == KErrNone, KNotifyPositionUpdate, err); + + if (ComparePositionL(posInfo4, posInfo5)) + { + _LIT(KErrorAndLeave, "(1)The old position was returned from positioner!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + _LIT(KChangePSY11, "Changing default psy to Psy11"); + INFO_PRINTF1(KChangePSY11); + // Set iUidTestPsy11 psy to defaultpsy + SetupDefaultPsyL(iUidTestPsy11); + + // Wait some time to make changes occur + User::After(5000000); + TPositionInfo posInfo6 = TPositionInfo(); + TPositionInfo posInfo7 = TPositionInfo(); + + // Get position again, should NOT be the same as earlier + iPositioner.NotifyPositionUpdate(posInfo6, myStatus); + + User::WaitForRequest(myStatus); + err = myStatus.Int(); + _LIT(KErr1, "Error from NotifyPositionUpdate for default psy, err1: %d"); + AssertTrueL(err == KErrNone, KErr1, err); + + if (ComparePositionL(posInfo5, posInfo6)) + { + _LIT(KErrorAndLeave, + "(2)The old position was returned from positioner!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // Get position again, should NOT be the same as earlier + iPositioner.NotifyPositionUpdate(posInfo7, myStatus); + + User::WaitForRequest(myStatus); + err = myStatus.Int(); + // TestPsy11 returns error every second request + _LIT(KErr2, "Error from NotifyPositionUpdate for default psy, err2: %d"); + AssertTrueL(err == KPositionPartialUpdate, KErr2, err); + + if (ComparePositionL(posInfo6, posInfo7)) + { + _LIT(KErrorAndLeave, + "The old position was returned from default positioner!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + ClosePositioner(); + Disconnect(); + } + +#endif + +// --------------------------------------------------------- +// CT_LbsClientPosTp218::ComparePositionL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CT_LbsClientPosTp218::ComparePositionL(TPositionInfo aPosInfo1, TPositionInfo aPosInfo2) + { + _LIT(KFunctionName, "We are inside ComparePositionL()"); + INFO_PRINTF1(KFunctionName); + TBool result = ETrue; + TBuf<150> buf; + + TPosition pos1 = TPosition(); + TPosition pos2 = TPosition(); + aPosInfo1.GetPosition(pos1); + aPosInfo2.GetPosition(pos2); + + TTime time1 = pos1.Time(); + TTime time2 = pos2.Time(); + + if (time1 == time2) + { + _LIT(KEqualTime, "Equal Time"); + INFO_PRINTF1(KEqualTime); + } + else + { + _LIT(KNotEqualTime, "NOT Equal Time"); + INFO_PRINTF1(KNotEqualTime); + } + + if ((time1 != time2) || (pos1.Latitude() != pos2.Latitude()) || + (pos1.Longitude() != pos2.Longitude()) || + (pos1.Altitude() != pos2.Altitude()) ) + { + // Not equal + result = EFalse; + _LIT(KNotEqual, "Not equal"); + INFO_PRINTF1(KNotEqual); + _LIT(KPosition1, "Position1: Lat %f Long %f Alt %f"); + buf.Format(KPosition1, pos1.Latitude(), pos1.Longitude() ,pos1.Altitude()); + INFO_PRINTF1(buf); + _LIT(KPosition2, "Position2: Lat %f Long %f Alt %f"); + buf.Format(KPosition2, pos2.Latitude(), pos2.Longitude() ,pos2.Altitude()); + INFO_PRINTF1(buf); + } + else + { + _LIT(KEqual, "Equal"); + INFO_PRINTF1(KEqual); + result = ETrue; + _LIT(KPosition1, "Position1: Lat %f Long %f Alt %f"); + buf.Format( KPosition1, pos1.Latitude(), pos1.Longitude() ,pos1.Altitude()); + INFO_PRINTF1(buf); + } + + return result; + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp218::AssertTrueSecL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp218::AssertTrueL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode) + { + if (!aCondition) + { + // LogErrorAndLeave does not leave if KErrNone is error + if (aErrorCode == KErrNone) aErrorCode = KErrGeneral; + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + LogErrorAndLeaveL(buf, aErrorCode); + } + } + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp22.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp22.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,494 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp22.h" +#include "ctlbsclientlog.h" +#include "ctlbsclientperiodictester.h" + +// CONSTANTS +_LIT(KServiceName1, " aaaaaaaaaaa"); +_LIT(KServiceName2, " bbbbbbbbbbb"); +_LIT(KServiceName3, " ccccccccccc"); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp22::CT_LbsClientPosTp22(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP22 - Periodic Location Updates"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp22::~CT_LbsClientPosTp22() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp22::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp22::StartL() + { + TInt numberOfRuns = 5; + TTimeIntervalMicroSeconds interval0 = TTimeIntervalMicroSeconds(0); + TTimeIntervalMicroSeconds interval2 = TTimeIntervalMicroSeconds(2000000); + TTimeIntervalMicroSeconds interval4 = TTimeIntervalMicroSeconds(4000000); + TTimeIntervalMicroSeconds interval5 = TTimeIntervalMicroSeconds(5000000); + TTimeIntervalMicroSeconds interval7 = TTimeIntervalMicroSeconds(7000000); + TTimeIntervalMicroSeconds interval8 = TTimeIntervalMicroSeconds(8000000); + TTimeIntervalMicroSeconds timeoutValue = TTimeIntervalMicroSeconds(10000000); + + TUid uidWithTimer = iUidTestTimerPsy; + TUid uidWithoutTimer = iUidTestPsy1; + TInt errorsFound = KErrNone; + TBuf<150> buf; + + SetupPsyL(iUidTestTimerPsy); + + // Prepare for test + iPeriodicTester1 = CT_LbsClientPeriodicTester::NewL(interval0, KServiceName1, iLog, uidWithTimer, 0); + iPeriodicTester1->RequestNotification(); + CActiveScheduler::Start(); + iPeriodicTester1->ClosePositioner(); + + // 1. + _LIT(KPart1, "<<<<<<<<< PART1 >>>>>>>>>>"); + INFO_PRINTF1(KPart1); + iPeriodicTester1->OpenPositionerL(KServiceName1); + iPeriodicTester1->ChangeTestParametersL(interval5, numberOfRuns); + + iPeriodicTester1->RequestNotification(); + CActiveScheduler::Start(); + // Check that correct fix is returned + TPositionInfo posInfo; + iPeriodicTester1->GetPosition(posInfo); + + TPosition pos; + posInfo.GetPosition(pos); + // TestTimerPsy returns 55.0 for Tracking requests and 20.0 for ordinary position requests + if (pos.Latitude() != 55.0|| pos.Longitude() != 55.0 || pos.Altitude() != 55.0) + { + _LIT(KErrorAndLeave, "Wrong position returned from tracking PSY"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + iPeriodicTester1->ClosePositioner(); + if (!iPeriodicTester1->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester1 returned error (1): %d"); + buf.Format(KErr,iPeriodicTester1->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + //Make another ordinary request + // Not included in TC + iPeriodicTester1->OpenPositionerL(KServiceName1); + iPeriodicTester1->ChangeTestParametersL(interval0, 0); + iPeriodicTester1->RequestNotification(); + + CActiveScheduler::Start(); + iPeriodicTester1->GetPosition(posInfo); + posInfo.GetPosition(pos); + // TestTimerPsy returns 55.0 for Tracking requests and 20.0 for ordinary position requests + if (pos.Latitude() != 20.0|| pos.Longitude() != 20.0 || pos.Altitude() != 20.0) + { + _LIT(KErrorAndLeave, "Wrong position returned from PSY"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + iPeriodicTester1->ClosePositioner(); + if (!iPeriodicTester1->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester1 returned error (1_1): %d"); + buf.Format(KErr,iPeriodicTester1->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + /////////////// + + // 2. + _LIT(KPart2, "<<<<<<<<< PART2 >>>>>>>>>>"); + INFO_PRINTF1(KPart2); + SetupPsyL(uidWithoutTimer); + iPeriodicTester2 = CT_LbsClientPeriodicTester::NewL(interval5, KServiceName2, iLog, uidWithoutTimer, numberOfRuns); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + iPeriodicTester2->ClosePositioner(); + + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (1): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + //Make another ordinary request + // Not included in TC + iPeriodicTester2->OpenPositionerL(KServiceName1); + iPeriodicTester2->ChangeTestParametersL(interval0, 0); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + iPeriodicTester2->ClosePositioner(); + if (!iPeriodicTester1->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (1_1): %d"); + buf.Format(KErr,iPeriodicTester1->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + /////////////// + + // 3. + _LIT(KPart3, "<<<<<<<<< PART3 >>>>>>>>>>"); + INFO_PRINTF1(KPart3); + SetupPsyL(uidWithTimer); + iPeriodicTester1->OpenPositionerL(KServiceName1); + + iPeriodicTester1->ChangeTestParametersL(interval7, 3); + iPeriodicTester1->RequestNotification(); + CActiveScheduler::Start(); + if (!iPeriodicTester1->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester1 returned error (2): %d"); + buf.Format(KErr,iPeriodicTester1->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + iPeriodicTester1->ChangeTestParametersL(interval4, 5); + iPeriodicTester1->RequestNotification(); + CActiveScheduler::Start(); + iPeriodicTester1->ClosePositioner(); + + if (!iPeriodicTester1->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester1 returned error (3): %d"); + buf.Format(KErr,iPeriodicTester1->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + // 4. + _LIT(KPart4, "<<<<<<<<< PART4 >>>>>>>>>>"); + INFO_PRINTF1(KPart4); + SetupPsyL(uidWithoutTimer); + iPeriodicTester2->OpenPositionerL(KServiceName2); + iPeriodicTester2->ChangeTestParametersL(interval7, 3); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (2): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + iPeriodicTester2->ChangeTestParametersL(interval4, 5); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + iPeriodicTester2->ClosePositioner(); + + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (3): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + // 5. + _LIT(KPart5, "<<<<<<<<< PART5 >>>>>>>>>>"); + INFO_PRINTF1(KPart5); + SetupPsyL(uidWithTimer); + iPeriodicTester1->OpenPositionerL(KServiceName1); + iPeriodicTester1->ChangeTestParametersL(interval4, 3); + iPeriodicTester1->RequestNotification(); + CActiveScheduler::Start(); + if (!iPeriodicTester1->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester1 returned error (4): %d"); + buf.Format(KErr,iPeriodicTester1->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + iPeriodicTester1->ChangeTestParametersL(interval0, 0); + + iPeriodicTester1->RequestNotification(); + CActiveScheduler::Start(); + if (!iPeriodicTester1->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester1 returned error (4_1): %d"); + buf.Format(KErr,iPeriodicTester1->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + TPositionInfo posInfo1; + iPeriodicTester1->GetPosition(posInfo1); + + TPosition pos1; + posInfo1.GetPosition(pos1); + // TestTimerPsy returns 55.0 for Tracking requests and 20.0 for ordinary position requests + if (pos1.Latitude() != 20.0 || pos1.Longitude() != 20.0 || pos1.Altitude() != 20.0) + { + _LIT(KErrorAndLeave, "Wrong position returned from PSY, StopTracking has not been called"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + iPeriodicTester1->ClosePositioner(); + + + // 6. + _LIT(KPart6, "<<<<<<<<< PART6 >>>>>>>>>>"); + INFO_PRINTF1(KPart6); + SetupPsyL(uidWithoutTimer); + iPeriodicTester2->OpenPositionerL(KServiceName2); + // Make two requests (note that nr of requests made is 1 + 1, since one is + // made directly when calling RequestNotification) + iPeriodicTester2->ChangeTestParametersL(interval0, 1); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + iPeriodicTester2->ClosePositioner(); + + + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (4): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + // 7. + _LIT(KPart7, "<<<<<<<<< PART7 >>>>>>>>>>"); + INFO_PRINTF1(KPart7); + SetupPsyL(uidWithoutTimer); + iPeriodicTester2->OpenPositionerL(KServiceName2); + iPeriodicTester2->ChangeTestParametersL(interval4, 3); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (5): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + iPeriodicTester2->ChangeTestParametersL(interval0, 0); + iPeriodicTester2->ClosePositioner(); + + // 8. + _LIT(KPart8, "<<<<<<<<< PART8 >>>>>>>>>>"); + INFO_PRINTF1(KPart8); + SetupPsyL(uidWithTimer); + iPeriodicTester1->OpenPositionerL(KServiceName1); + // Make two requests (note that nr of requests made is 1 + 1, since one is + // made directly when calling RequestNotification) + iPeriodicTester1->ChangeTestParametersL(interval0, 1); + iPeriodicTester1->RequestNotification(); + CActiveScheduler::Start(); + + // Check that correct fix is returned + iPeriodicTester1->GetPosition(posInfo1); + posInfo1.GetPosition(pos1); + // TestTimerPsy returns 55.0 for Tracking requests and 20.0 for ordinary position requests + if (pos1.Latitude() != 20.0 || pos1.Longitude() != 20.0 || pos1.Altitude() != 20.0) + { + _LIT(KErrorAndLeave, "Wrong position returned from PSY, StopTracking has not been called"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + iPeriodicTester1->ClosePositioner(); + if (!iPeriodicTester1->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester1 returned error (5): %d"); + buf.Format(KErr,iPeriodicTester1->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + // 9. + _LIT(KPart9, "<<<<<<<<< PART9 >>>>>>>>>>"); + INFO_PRINTF1(KPart9); + SetupPsyL(uidWithoutTimer); + iPeriodicTester2->OpenPositionerL(KServiceName2); + iPeriodicTester2->ChangeTestParametersL(interval4, 3); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (6): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + iPeriodicTester2->ChangeRequestorInformation(KServiceName3); + iPeriodicTester2->ChangeTestParametersL(interval4, 3); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (7): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + iPeriodicTester2->ChangeTestParametersL(interval0, 0); + iPeriodicTester2->ClosePositioner(); + + // 10. + _LIT(KPart10, "<<<<<<<<< PART10 >>>>>>>>>>"); + INFO_PRINTF1(KPart10); + iPeriodicTester2->OpenPositionerL(KServiceName2); + iPeriodicTester2->ChangeTestParametersL(interval4, 0); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (8): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + iPeriodicTester2->ChangeTestParametersL(interval0, 0); + iPeriodicTester2->ClosePositioner(); + + // 11. + _LIT(KPart11, "<<<<<<<<< PART11 >>>>>>>>>>"); + INFO_PRINTF1(KPart11); + iPeriodicTester2->OpenPositionerL(KServiceName2); + iPeriodicTester2->ChangeTestParametersL(interval4, 0); //only one periodic + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + iPeriodicTester2->ClosePositioner(); + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (9): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + // 12. + _LIT(KPart12, "<<<<<<<<< PART12 >>>>>>>>>>"); + INFO_PRINTF1(KPart12); + iPeriodicTester2->OpenPositionerL(KServiceName2); + iPeriodicTester2->ChangeTestParametersL(interval8, 2); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (10): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + // Check that setting MaxAge does not "screw" things up + iPeriodicTester2->SetMaxAgeL(interval2); + + iPeriodicTester2->ChangeTestParametersL(interval8, 2); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (11): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + iPeriodicTester2->SetPartialUpdateL(ETrue); + iPeriodicTester2->ChangeTestParametersL(interval8, 2); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (12): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + iPeriodicTester2->SetTimeOutL(timeoutValue); //must be greater than the interval + iPeriodicTester2->ChangeTestParametersL(interval8, 2); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + iPeriodicTester2->ClosePositioner(); + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (13): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + //13. + _LIT(KPart13, "<<<<<<<<< PART13 >>>>>>>>>>"); + INFO_PRINTF1(KPart13); + iPeriodicTester2->OpenPositionerL(KServiceName2); + iPeriodicTester2->ChangeTestParametersL(interval4, 4); + iPeriodicTester2->SetChangeParametersPrematurely(ETrue); + iPeriodicTester2->RequestNotification(); + CActiveScheduler::Start(); + iPeriodicTester2->ClosePositioner(); + + if (!iPeriodicTester2->IsCompletedOK()) + { + _LIT(KErr, "iPeriodicTester2 returned error (8): %d"); + buf.Format(KErr,iPeriodicTester2->GetError()); + INFO_PRINTF1(buf); + errorsFound++; + } + + if (errorsFound != KErrNone) + { + _LIT(KErrorAndLeave, "Errors found in TP22"); + LogErrorAndLeaveL(KErrorAndLeave); + } + } + +void CT_LbsClientPosTp22::CloseTest() + { + delete iPeriodicTester1; + iPeriodicTester1 = NULL; + delete iPeriodicTester2; + iPeriodicTester2 = NULL; + iRequestArray.Reset(); + iRequestArray.Close(); + } + +// End of file diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp222.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp222.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,196 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp222.h" + +// CONSTANTS +// ================= MEMBER FUNCTIONS ======================= + +// Constructor. +CT_LbsClientPosTp222::CT_LbsClientPosTp222(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP222 - Partial Update test"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp222::~CT_LbsClientPosTp222() + { + } + +// --------------------------------------------------------- +// CPosTp222::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp222::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// This flag must be defined if testing partial update NOT supported +#ifdef PARTIAL_UPDATE_NOT_SUPPORTED +// --------------------------------------------------------- +// CPosTp222::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +// If partial update is NOT supported +void CT_LbsClientPosTp222::StartL() + { + _LIT(KPartialUpdateTest, "-----Testing that PartialUpdate is NOT supported-----"); + INFO_PRINTF1(KPartialUpdateTest); + SetupPsyL(iUidTestPsyPartialUpdate); + SetupGlobalPrivacyL(TPosPrivacy(TPosPrivacy::EAcceptAll, EFalse)); + _LIT(KService, "PellesKattlåda"); + + ConnectL(); + User::LeaveIfError(OpenPositionerByName(iUidTestPsyPartialUpdate)); + + TPositionUpdateOptions updateOptions; + // Check that partial update is not supported + updateOptions.SetAcceptPartialUpdates(ETrue); + + TInt res = iPositioner.SetUpdateOptions(updateOptions); + _LIT(KSetUpdateOptions, "SetUpdateOptions should not be supported, instead error %d was return"); + AssertTrueL(res == KErrNotSupported, KSetUpdateOptions, res); + + TPositionInfo info = TPositionInfo(); + TInt err = PerformSyncRequest(KService, &info); + _LIT(KErrRequest2, "error when performing sync request nr2, err: %d"); + AssertTrueL(err == KErrNone, KErrRequest2, err); + // Check that a "full" position is returned + TPosition pos = TPosition(); + info.GetPosition(pos); + + if (pos.Latitude() == 30 && pos.Longitude() == 40 && pos.Altitude() == 50) + { + _LIT(KErrorAndLeave, + "Partial update position returned from positioner when this feature should be disabled"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + ClosePositioner(); + Disconnect(); + + _LIT(KFunctionDone, "Test Completed successfully"); + INFO_PRINTF1(KFunctionDone); + } + +#else +// --------------------------------------------------------- +// CPosTp222::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +// If partial update is supported +void CT_LbsClientPosTp222::StartL() + { + _LIT(KPartialUpdateTest, "-----Testing that PartialUpdate is supported-----"); + INFO_PRINTF1(KPartialUpdateTest); + SetupPsyL(iUidTestPsyPartialUpdate); + + ConnectL(); + User::LeaveIfError(OpenPositionerByName(iUidTestPsyPartialUpdate)); + _LIT(KService, "PellesKaninlaada"); + + TPositionUpdateOptions updateOptions; + TPositionUpdateOptions resultOptions; + // Check that partial update is not set + TBool res = updateOptions.AcceptPartialUpdates(); + if (res) + { + _LIT(KErrorAndLeave, "Partial update default is not correct"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + updateOptions.SetAcceptPartialUpdates(ETrue); + TInt response = iPositioner.SetUpdateOptions(updateOptions); + _LIT(KSetUpdateOptions, "SetUpdateOptions returned error: %d"); + AssertTrueL(response == KErrNone, KSetUpdateOptions, res); + + // Check that partial update has been set + iPositioner.GetUpdateOptions(resultOptions); + res = resultOptions.AcceptPartialUpdates(); + if (!res) + { + _LIT(KErrorAndLeave, "Partial update not correctly set"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + TPositionInfo info = TPositionInfo(); + TInt err = PerformSyncRequest(KService, &info); + _LIT(KErrRequest, "error when performing sync request, err: %d"); + AssertTrueL(err == KPositionPartialUpdate, KErrRequest, err); + + //Check that a "partial update" position is returned + TPosition pos = TPosition(); + info.GetPosition(pos); + + if (pos.Latitude() != 30 || pos.Longitude() != 40 || pos.Altitude() != 50) + { + _LIT(KErrorAndLeave, + "Wrong position returned from positioner(partial update)"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // Disable partialupdate + updateOptions.SetAcceptPartialUpdates(EFalse); + response = iPositioner.SetUpdateOptions(updateOptions); + _LIT(KSetUpdateOptions1, + "SetUpdateOptions returned error when disabling partial update err: %d"); + AssertTrueL(response == KErrNone, KSetUpdateOptions1, res); + + // Check that partial update has been disabled + iPositioner.GetUpdateOptions(resultOptions); + res = resultOptions.AcceptPartialUpdates(); + if (res) + { + _LIT(KErrorAndLeave, "Partial update should not be set"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + TPositionInfo info2 = TPositionInfo(); + err = PerformSyncRequest(KService, &info2); + _LIT(KErrRequest2, "error when performing sync request nr2, err: %d"); + AssertTrueL(err == KErrNone, KErrRequest2, err); + // Check that a "full" position is returned + TPosition pos2 = TPosition(); + info2.GetPosition(pos2); + + if (pos2.Latitude() == 30 && pos2.Longitude() == 40 && pos2.Altitude() == 50) + { + _LIT(KErrorAndLeave, "Partial update position returned from positioner"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + ClosePositioner(); + Disconnect(); + _LIT(KFunctionDone, "Test Completed successfully"); + INFO_PRINTF1(KFunctionDone); + } +#endif + + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp223.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp223.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,87 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp223.h" +#include +#include +#include +#include +#include +#include + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// Constructor. +CT_LbsClientPosTp223::CT_LbsClientPosTp223(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP223 - Range check in PSY"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp223::~CT_LbsClientPosTp223() + { + } + + +// --------------------------------------------------------- +// CT_LbsClientPosTp223::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp223::StartL() + { + + _LIT(KErrorMsg, "Get Module did not return KErrNotFound, error code = %d"); + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + TPositionModuleInfo moduleInfo; + + TRAPD(err,db->GetModuleInfoL(iUidTestRangePsy, + moduleInfo)); + + AssertTrueSecL(err == KErrNotFound,KErrorMsg, err); + + CleanupStack::PopAndDestroy(db); // db + + } + + +// --------------------------------------------------------- +// CT_LbsClientPosTp223::AssertTrueSecL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp223::AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode) + { + if (!aCondition) + { + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + LogErrorAndLeaveL(buf); + } + } + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp224.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp224.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,110 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp224.h" +#include +#include + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// Constructor. +CT_LbsClientPosTp224::CT_LbsClientPosTp224(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, + "TP224 - MPositionerStatus out of scope after closing PSY subsession"); + SetTestStepName(KTestName); + } + +// Destructor +CT_LbsClientPosTp224::~CT_LbsClientPosTp224() + { + iPositioner.Close(); + iPositioner2.Close(); + iServer.Close(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp224::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// + +void CT_LbsClientPosTp224::CloseTest() + { + iPositioner.Close(); + iPositioner2.Close(); + iServer.Close(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp224::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp224::StartL() + { + _LIT(KConnectErr, "Error when connecting to EPos server, %d"); + _LIT(KOpenErr, "Error when opening positioner, %d"); + + TInt err; + err = iServer.Connect(); + AssertTrueSecL(err == KErrNone, KConnectErr, err); + + SetupPsyL(iUidTestSingPsy); + err = iPositioner.Open(iServer, iUidTestSingPsy); + AssertTrueSecL(err == KErrNone, KOpenErr, err); + + err = iPositioner2.Open(iServer, iUidTestSingPsy); + AssertTrueSecL(err == KErrNone, KOpenErr, err); + + iPositioner.Close(); + iPositioner2.Close(); // Before error correction -> Panic because of MPositionerStatus deleted + + err = iPositioner.Open(iServer, iUidTestSingPsy); + AssertTrueSecL(err == KErrNone, KOpenErr, err); + err = iPositioner2.Open(iServer, iUidTestSingPsy); + AssertTrueSecL(err == KErrNone, KOpenErr, err); + + iPositioner2.Close(); + iPositioner.Close(); + + iServer.Close(); + } + + +// --------------------------------------------------------- +// CT_LbsClientPosTp224::AssertTrueSecL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp224::AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode) + { + if (!aCondition) + { + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + LogErrorAndLeaveL(buf); + } + } + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp227.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp227.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,210 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + + +// INCLUDES +#include "ctlbsclientpostp227.h" +#include +#include +#include +#include +#include + + + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// Constructor. +CT_LbsClientPosTp227::CT_LbsClientPosTp227(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP227 - Settings API performance"); + SetTestStepName(KTestName); + } + +// Destructor +CT_LbsClientPosTp227::~CT_LbsClientPosTp227() + { + + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp227::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// + +void CT_LbsClientPosTp227::CloseTest() + { + + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp227::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp227::StartL() + { + TTime startTime; + TTime stopTime; + + startTime.UniversalTime(); + + CPosModules* db = CPosModules::OpenL(); + stopTime.UniversalTime(); + + TInt duration = stopTime.Int64() - startTime.Int64(); + + if (duration > 500000) + { + _LIT(KDelayMsg, "Time taken to create CPosModules object was more than 0.5 second, it was %d microsecs."); + TBuf<100> error; + error.Format(KDelayMsg, duration); + INFO_PRINTF1(error); + } + else + { + _LIT(KDelayMsg, "Time taken to create CPosModules object was %d microsecs."); + TBuf<100> debug; + debug.Format(KDelayMsg, duration); + INFO_PRINTF1(debug); + } + + CleanupStack::PushL(db); + + startTime.UniversalTime(); + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + stopTime.UniversalTime(); + duration = stopTime.Int64() - startTime.Int64(); + + if (duration > 20000) + { + _LIT(KDelayMsg, "Time taken to get list using ModuleIdListLC() was more than 0.02 second, it was %d microsecs."); + TBuf<100> error; + error.Format(KDelayMsg, duration); + INFO_PRINTF1(error); + } + else + { + _LIT(KDelayMsg, "Time taken to get list using ModuleIdListLC() was %d microsecs."); + TBuf<100> debug; + debug.Format(KDelayMsg, duration); + INFO_PRINTF1(debug); + } + + TPositionModuleInfo moduleInfo; + TInt64 MaxDuration=0; + + for ( TInt count = 0 ; count < prioList->Count() ; count++) + { + startTime.UniversalTime(); + db->GetModuleInfoL((*prioList)[count], moduleInfo); + stopTime.UniversalTime(); + duration = stopTime.Int64() - startTime.Int64(); + + if( duration>MaxDuration ) + MaxDuration=duration; + } + + if (MaxDuration > 10000) + { + _LIT(KDelayMsg, "Time taken for GetModuleInfoL() was more than 0.01 sec, it was %d microsecs."); + TBuf<100> error; + error.Format(KDelayMsg, duration); + INFO_PRINTF1(error); + } + else + { + _LIT(KDelayMsg, "Time taken for GetModuleInfoL() was %d microsecs."); + TBuf<100> debug; + debug.Format(KDelayMsg, duration); + INFO_PRINTF1(debug); + } + + CleanupStack::PopAndDestroy(prioList); // prioList + + TInt visiblestate=1; + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); // destroy! + moduleUpdate->SetUpdateAvailability(ETrue); + + MaxDuration=0; + for(TInt i=0;i<10;i++) + { + if(visiblestate) + { + moduleUpdate->SetUpdateVisibility(EFalse); + visiblestate=0; + } + else + { + moduleUpdate->SetUpdateVisibility(ETrue); + visiblestate=1; + } + + db->UpdateModuleL(iUidTestPsy2, *moduleUpdate); + + startTime.UniversalTime(); + prioList = db->ModuleIdListLC(); + stopTime.UniversalTime(); + duration = stopTime.Int64() - startTime.Int64(); + + if( duration> MaxDuration) + MaxDuration=duration; + + CleanupStack::PopAndDestroy(prioList); + } + + if (MaxDuration > 50000) + { + _LIT(KDelayMsg, "Time taken was more than 0.05 second, it was %d microsecs."); + TBuf<100> error; + error.Format(KDelayMsg, duration); + INFO_PRINTF1(error); + } + else + { + _LIT(KDelayMsg, "Time taken was %d microsecs."); + TBuf<100> debug; + debug.Format(KDelayMsg, duration); + INFO_PRINTF1(debug); + } + + CleanupStack::PopAndDestroy(2); //moduleUpdate,db + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp227::AssertTrueSecL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp227::AssertTrueL(TBool aCondition, const TDesC& aErrorMsg) + { + if (!aCondition) + { + TBuf<100> buf; + buf.Format(aErrorMsg); + LogErrorAndLeaveL(buf); + } + } + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp25.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp25.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,175 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + + +// INCLUDES +#include "ctlbsclientpostp25.h" +#include "ctlbsrequester.h" +#include +#include + +// CONSTANTS + +// ==================== LOCAL FUNCTIONS ==================== + +// --------------------------------------------------------- +// EnablePsyL. Enables a specific psy +// --------------------------------------------------------- +// +void EnablePsyL( + CPosModules& aDb, + TUid aPsy) + { + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + // Enable Psy + moduleUpdate->SetUpdateAvailability(ETrue); + aDb.UpdateModuleL(aPsy, *moduleUpdate); + CleanupStack::PopAndDestroy(moduleUpdate); + + } + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp25::CT_LbsClientPosTp25(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP25 - Request location from multiple PSYs"); + SetTestStepName(KTestName); + } + +// Destructor +CT_LbsClientPosTp25::~CT_LbsClientPosTp25() + { + delete iFastPsy; + delete iMediumPsy; + delete iSlowPsy; + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp25::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp25::StartL() + { + + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + EnablePsyL(*db, iUidTestPsy12);// 0 sec + EnablePsyL(*db, iUidTestPsy4);// 3 sec + EnablePsyL(*db, iUidTestPsy9);// 6 sec + + CleanupStack::PopAndDestroy(); // db + + iFastPsy = CT_LbsRequester::NewL(iUidTestPsy12, this, Logger()); + iMediumPsy = CT_LbsRequester::NewL(iUidTestPsy4, this, Logger()); + iSlowPsy = CT_LbsRequester::NewL(iUidTestPsy9, this, Logger()); + iCompletedRequests = 0; + + TTime starttime,stoptime; + starttime.UniversalTime(); + + // Make request to slow psy first + iSlowPsy->StartRequest(); + iFastPsy->StartRequest(); + iMediumPsy->StartRequest(); + + // Wait for completion + CActiveScheduler::Start(); + + stoptime.UniversalTime(); + + // Substract total delay incurred due to PSY's...i.e 6sec + TInt duration=stoptime.Int64()-starttime.Int64()-6000000; + + + _LIT(KMessage,"3 simultaneous requests from 3 different sessions completed in %d microsec"); + TBuf<256> error; + error.Format(KMessage,duration); + INFO_PRINTF1(error); + + if(duration>3000000) + { + _LIT(KTime, "Time taken>3 sec"); + INFO_PRINTF1(KTime); + } + + // Evaluate result + _LIT(KPsyFast, "testpsy12"); + _LIT(KPsyMedium, "testpsy4"); + _LIT(KPsySlow, "testpsy9"); + + _LIT(KReturnedErrorCode, "Positioner %S returned error code %d"); + TBuf<256> output; + output.Format(KReturnedErrorCode, &KPsyFast, iFastPsy->CompletionCode()); + AssertTrueL(iFastPsy->CompletionCode() == KErrNone, output); + + output.Format(KReturnedErrorCode, &KPsyMedium, iMediumPsy->CompletionCode()); + AssertTrueL(iMediumPsy->CompletionCode() == KErrNone, output); + + output.Format(KReturnedErrorCode, &KPsySlow, iSlowPsy->CompletionCode()); + AssertTrueL(iSlowPsy->CompletionCode() == KErrNone, output); + _LIT(KWrongComplOrder, "Positioners completed out of order"); + + AssertTrueL( + iFastPsy->CompletionTimeUTC() < iMediumPsy->CompletionTimeUTC() && + iMediumPsy->CompletionTimeUTC() < iSlowPsy->CompletionTimeUTC(), + KWrongComplOrder); + + delete iFastPsy; + delete iMediumPsy; + delete iSlowPsy; + iFastPsy = NULL; + iMediumPsy = NULL; + iSlowPsy = NULL; + + _LIT(KTEXT, "TP25 Passed! :)"); + INFO_PRINTF1(KTEXT); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp25::RequestCompleteL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp25::RequestCompleteL() + { + const TInt KNofRequesters = 3; + if (++iCompletedRequests == KNofRequesters) + { + CActiveScheduler::Stop(); + } + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp25::AssertTrueL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp25::AssertTrueL(TBool aCondition, const TDesC& aErrorMsg) + { + if (!aCondition) + { + LogErrorAndLeaveL(aErrorMsg); + } + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp254.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp254.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,390 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDE FILES +#include "ctlbsclientpostp254.h" +#include +#include +#include + +// CONSTANTS +_LIT(KLastPosition, "c:\\private\\101f97b2\\LastKnownPos.dat"); + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp254::CT_LbsClientPosTp254(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP254 - Get last known position"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp254::~CT_LbsClientPosTp254() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp254::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp254::CloseTest() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp254::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp254::StartL() + { + User::After(2000000); + DeleteFileL(KLastPosition); + SetupPsyL(iUidTestPsy11); + + RPositionServer posServer; + CleanupClosePushL(posServer); + RPositioner positioner; + CleanupClosePushL(positioner); + TPositionInfo positionInfo = TPositionInfo(); + TPositionInfo positionInfoLast = TPositionInfo(); + + _LIT(KConnectErr, "Error when connecing to EPos server, %d"); + TInt err = posServer.Connect(); + AssertTrueL(err == KErrNone, KConnectErr, err); + + _LIT(KOpenErr, "Error when opening positioner, %d"); + err = positioner.Open(posServer,iUidTestPsy11 ); //use defalut psy + AssertTrueL(err == KErrNone, KOpenErr, err); + + + _LIT(KService ,"Service"); + positioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KService); + + TRequestStatus status; + status = KRequestPending; + + positionInfoLast.SetUpdateType(EPositionUpdateUnknown); // just to make a difference + + positioner.GetLastKnownPosition(positionInfoLast, status); + User::WaitForRequest(status); + err = status.Int(); + _LIT(KErrorRequest, "Get last known position did not return with KErrUnKnown %d"); + AssertTrueL(err == KErrUnknown, KErrorRequest, err); + + //Verification of TR SBUY-5WHGS3 i.e even if the psy has a really fast + //responce time a last known position should be saved. + status = KRequestPending; + + positioner.NotifyPositionUpdate(positionInfo, status); + User::WaitForRequest(status); + err = status.Int(); + _LIT(KErrPosition, "Not possible to make a request"); + AssertTrueL(err == KErrNone, KErrPosition, err); + + positioner.GetLastKnownPosition(positionInfoLast, status); + User::WaitForRequest(status); + err = status.Int(); + _LIT(KErrorFast, "Get last known position after fast psy did not work %d"); + AssertTrueL(err == KErrNone, KErrorFast, err); + + positioner.Close(); + posServer.Close(); + + const TTimeIntervalMicroSeconds32 KPosWaitServerShutDown( 6000000 ); + User::After(KPosWaitServerShutDown); + DeleteFileL(KLastPosition); + SetupPsyL(iUidTestPsyMaxAge); + err = posServer.Connect(); + AssertTrueL(err == KErrNone, KConnectErr, err); + err = positioner.Open(posServer); //use defalut psy + AssertTrueL(err == KErrNone, KOpenErr, err); + positioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KService); + + + status = KRequestPending; + + positioner.NotifyPositionUpdate(positionInfo, status); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone, KErrPosition, err); + + //Now there should exist a last known position + positioner.GetLastKnownPosition(positionInfoLast, status); + User::WaitForRequest(status); + err = status.Int(); + _LIT(KErrorRequestLast, "Get last known position did not return with KErrNone %d"); + AssertTrueL(err == KErrNone, KErrorRequestLast, err); + + CheckPositionInfoL(positionInfo, positionInfoLast); + + TPositionSatelliteInfo satelliteInfoLast = TPositionSatelliteInfo(); + positioner.GetLastKnownPosition(satelliteInfoLast, status); + User::WaitForRequest(status); + err = status.Int(); + + AssertTrueL(err == KErrArgument, KErrorRequest, err); + + positioner.NotifyPositionUpdate(positionInfo, status); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone, KErrPosition, err); + + positioner.GetLastKnownPosition(positionInfoLast, status); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone, KErrorRequest, err); + + CheckPositionInfoL(positionInfo, positionInfoLast); + + positioner.Close(); + posServer.Close(); + + //connect again + err = posServer.Connect(); + AssertTrueL(err == KErrNone, KConnectErr, err); + err = positioner.Open(posServer); //use defalut psy + AssertTrueL(err == KErrNone, KOpenErr, err); + positioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KService); + + + TPositionInfo positionInfoLast1 = TPositionInfo(); + positioner.GetLastKnownPosition(positionInfoLast1, status); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone, KErrorRequest, err); + CheckPositionInfoL(positionInfoLast, positionInfoLast1); + + positioner.Close(); + posServer.Close(); + User::After(6000000); + + //The position is written to persistant storeage since TEF is shutdown. + if (!FileExistsL(KLastPosition)) + { + _LIT(KErrStore, "The dat file not created"); + LogErrorAndLeaveL(KErrStore); + } + + //Connect again + err = posServer.Connect(); + AssertTrueL(err == KErrNone, KConnectErr, err); + err = positioner.Open(posServer); //use defalut psy + AssertTrueL(err == KErrNone, KOpenErr, err); + positioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KService); + + + TPositionInfo positionInfoLast2 = TPositionInfo(); + positioner.GetLastKnownPosition(positionInfoLast2, status); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone, KErrorRequest, err); + CheckPositionInfoL(positionInfoLast, positionInfoLast2); + + RPositionServer posServer1; + CleanupClosePushL(posServer1); + RPositioner positioner1; + CleanupClosePushL(positioner1); + SetupPsyL(iUidMultiPsy); + _LIT(KConnect1Err, "Error when connecing to EPos server, %d"); + err = posServer1.Connect(); + AssertTrueL(err == KErrNone, KConnect1Err, err); + + _LIT(KOpen1Err, "Error when opening positioner, %d"); + err = positioner1.Open(posServer); //use defalut psy + AssertTrueL(err == KErrNone, KOpen1Err, err); + positioner1.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KService); + + positioner1.NotifyPositionUpdate(positionInfo, status); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone, KErrPosition, err); + + positioner.GetLastKnownPosition(positionInfoLast, status); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone, KErrorRequest, err); + CheckPositionInfoL(positionInfo, positionInfoLast); + + //just to make sure that positioner1 also gets the correct position + positioner1.GetLastKnownPosition(positionInfoLast, status); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone, KErrorRequest, err); + CheckPositionInfoL(positionInfo, positionInfoLast); + + SetupPsyL(iUidTestPsyPartialUpdate); + User::After(1000000); + TPositionInfo positionInfoPartial = TPositionInfo(); + TPositionUpdateOptions updateOption = TPositionUpdateOptions(); + updateOption.SetAcceptPartialUpdates(ETrue); + positioner1.SetUpdateOptions(updateOption); + + positioner1.NotifyPositionUpdate(positionInfoPartial, status); + User::WaitForRequest(status); + err = status.Int(); + _LIT(KErrPositionPartial, "no partial position returned %d"); + AssertTrueL(err == KPositionPartialUpdate, KErrPositionPartial, err); + + positioner.GetLastKnownPosition(positionInfoLast, status); + User::WaitForRequest(status); + err = status.Int(); + AssertTrueL(err == KErrNone, KErrorRequest, err); + + TPosition pos; + TPosition lastPos; + positionInfoPartial.GetPosition(pos); + positionInfoLast.GetPosition(lastPos); + + if (pos.Time() == lastPos.Time()) + { + _LIT(KErrPosition, "Partial position was cached"); + LogErrorAndLeaveL(KErrPosition); + } + + CleanupStack::PopAndDestroy(&positioner1); + CleanupStack::PopAndDestroy(&posServer1); + CleanupStack::PopAndDestroy(&positioner); + CleanupStack::PopAndDestroy(&posServer); + + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp254::DeleteFileL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp254::DeleteFileL(const TDesC& aFile) + { + RFs fs; + TInt err = fs.Connect(); + + err = fs.Delete(aFile); + fs.Close(); + if (err == KErrNone) + { + _LIT(KDebugText, "TP254: The specified file deleted"); + INFO_PRINTF1(KDebugText); + } + else + { + if (err == KErrInUse) + { + _LIT(KErrText, "TP254: The specified file could not be deleted it is already in use, errorcode %d"); + INFO_PRINTF1(aFile); + TBuf<100> buf; + buf.Format(KErrText, err); + AssertTrueL(err==0, KErrText, err); + } + else if (err == KErrNotFound) + { + _LIT(KDebugText, "TP254: The specified file could not be found ,errorcode %d"); + TBuf<100> buf; + buf.Format(KDebugText, err); + INFO_PRINTF1(buf); + } + else + { + _LIT(KErrText, "TP254: The specified file could not be deleted, errorcode %d"); + TBuf<100> buf; + buf.Format(KErrText, err); + AssertTrueL(err==0, KErrText, err); + } + } + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp254::FileExistsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CT_LbsClientPosTp254::FileExistsL(const TDesC& aFile) + { + RFs fs; + TInt err = fs.Connect(); + TBool exists = EFalse; + + if(KErrNone==err) + { + exists = BaflUtils::FileExists(fs, aFile); + if (exists) + { + _LIT(KErrText, "TP254: The specified file does not exist"); + INFO_PRINTF1(KErrText); + } + else + { + _LIT(KErrText, "TP254: The specified file exists"); + INFO_PRINTF1(KErrText); + } + } + + fs.Close(); + return exists; + } + +void CT_LbsClientPosTp254::CheckPositionInfoL(TPositionInfo& aInfo, TPositionInfo& aLastInfo) + { + if (aInfo.UpdateType() != aLastInfo.UpdateType()) + { + _LIT(KErrUpdateType, "Update type not stored correctly"); + LogErrorAndLeaveL(KErrUpdateType); + } + if (aLastInfo.ModuleId().iUid != 0) + { + _LIT(KIncorrectPsyError, + "Uid not reseted"); + LogErrorAndLeaveL(KIncorrectPsyError); + } + TPosition pos; + TPosition lastPos; + aInfo.GetPosition(pos); + aLastInfo.GetPosition(lastPos); + CheckPositionL(pos, lastPos); + } + +void CT_LbsClientPosTp254::CheckPositionL(TPosition& aPos, TPosition& aLastPos) + { + if (aPos.Time() != aLastPos.Time() || + aPos.HorizontalAccuracy() != aLastPos.HorizontalAccuracy() || + aPos.VerticalAccuracy() != aLastPos.VerticalAccuracy() || + aPos.Latitude() != aLastPos.Latitude() || + aPos.Longitude() != aLastPos.Longitude() || + aPos.Altitude() != aLastPos.Altitude()) + { + _LIT(KErrPosition, "Wrong position returned"); + LogErrorAndLeaveL(KErrPosition); + } + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp256.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp256.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,291 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include +#include +#include "ctlbsclientpostp256.h" +#include + +// CONSTANTS +const TInt KNoMultipleClients=2; +const TUint KMaxHeapSize=0x80000; + +// Structure for passing parameters to threads +struct MyThreadData + { + TBool iTestFlag; + }; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp256::CT_LbsClientPosTp256(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "Tp256 - Location Settings and Multiple Clients"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp256::~CT_LbsClientPosTp256() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp256::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp256::StartL() + { + _LIT(KMultipleErr, "Error %d when multiple clients access the CPosModules, err from client:%d"); + _LIT(KSuccess, "Client %d is successful"); + _LIT(KAllErr, "All clients gets error when multiple clients access the CPosModules"); + _LIT(KPanicErr, "Panic when multiple clients access the CPosModules, Thread: %d panics"); + + TFixedArray statuses; + //make a request just to make sure att all databases are created. + + SetupPsyL(iUidMultiPsy); + + //synchronous request + ConnectL(); + + User::LeaveIfError(OpenPositionerByName(iUidMultiPsy)); + + TPositionInfo info = TPositionInfo(); + + RequestL(info); + + //potenial memory leak if above function leav + ClosePositioner(); + Disconnect(); + + //End first request. + + + TInt errorsFound = KErrNone; + CreateThreadsL(); + + for (TInt i=0; i buf; + if (exitReason != KErrNone) + { + buf.Format(KMultipleErr, exitReason, t); + INFO_PRINTF1(buf); + + errorsFound++; + } + else + { + buf.Format(KSuccess, t); + INFO_PRINTF1(buf); + } + AssertTrueL(iThreads[t].ExitType() != EExitPanic, KPanicErr, t); + } + + AssertTrueL(errorsFound < KNoMultipleClients, KAllErr, KErrGeneral); + + _LIT(KPass, "CT_LbsClientPosTp256 passed!!!"); + INFO_PRINTF1(KPass); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp256::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp256::CloseTest() + { + for (TInt i=0; iResetAllModulesL(); + CPosModuleIdList* myDebugList = db->ModuleIdListLC(); + + nrOfModules = myDebugList->Count(); + TPositionModuleInfo debugModuleInfo; + TBuf<40> moduleName; + TPositionQuality quality; + + for (TInt i=0;iGetModuleInfoL(myDebugList->At(i), debugModuleInfo); + moduleName.Zero(); + debugModuleInfo.GetModuleName(moduleName); + debugModuleInfo.GetPositionQuality(quality); + } + CleanupStack::PopAndDestroy(myDebugList); + } + + for (i=0;iiTestFlag) + { + for (TInt j=0;jSetModulePriorityL(nrOfModules-j-1, j); + } + } + // And all the other thread does this + else + { + CPosModuleIdList* myDebugList = db->ModuleIdListLC(); + + TInt debugCount = myDebugList->Count(); + TPositionModuleInfo debugModuleInfo; + TBuf<20> moduleName; + TPositionQuality quality; + + for (TInt i=0;iGetModuleInfoL(myDebugList->At(i), debugModuleInfo); + moduleName.Zero(); + debugModuleInfo.GetModuleName(moduleName); + debugModuleInfo.GetPositionQuality(quality); + } + CleanupStack::PopAndDestroy(myDebugList); + } + } + + + CleanupStack::PopAndDestroy(db); + } + +// --------------------------------------------------------- +// LOCAL_C TInt ThreadFunction +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +LOCAL_C TInt ThreadFunction(TAny* aData) + { + __UHEAP_MARK; + CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack + + if (cleanup == NULL) + { + return KErrNoMemory; + } + // we need an ActiveScheduler + CActiveScheduler scheduler; + CActiveScheduler::Install(&scheduler); + + TRAPD(err, RunTestL(aData)); + + delete cleanup; // destroy clean-up stack + __UHEAP_MARKEND; + return err; + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp256::CreateThreadsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp256::CreateThreadsL() + { + _LIT(KThreadName, "TP256 test thread%d"); + _LIT(KCreateThreadErr, "Create thread failed with %d"); + + for (TInt i=0; i name; + name.Format(KThreadName, 1+iThreads.Count()); + + TInt err; + err = thread.Create(name, ThreadFunction, KDefaultStackSize, KMinHeapSize, KMaxHeapSize, reinterpret_cast(&info)); + AssertTrueL(err == KErrNone, KCreateThreadErr, err); + + iThreads.Append(thread); + } + } + + +void CT_LbsClientPosTp256::RequestL(TPositionInfoBase& aInfoBase) + { + _LIT(KService, "service"); + TInt err = PerformSyncRequest(KService, &aInfoBase); + + if (err != KErrNone) + { + _LIT(KErrorRequest, "The request was not completed with KErrorNone, errCode = %d"); + TBuf<100> buf; + buf.Format(KErrorRequest, err); + LogErrorAndLeaveL(buf); + } + + _LIT(KIncorrectPsySyncRequestError, + "TP2. Position from wrong PSY received (sync request)."); + if (iUidMultiPsy != aInfoBase.ModuleId()) + { + LogErrorAndLeaveL(KIncorrectPsySyncRequestError); + } + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp257.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp257.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,592 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp257.h" + +// CONSTANTS +_LIT(KLastPosition, "c:\\private\\101f97b2\\LastKnownPos.dat"); + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp257::CT_LbsClientPosTp257(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "Tp257-GetLastKnown Position, update options"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp257::~CT_LbsClientPosTp257() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp257::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp257::CloseTest() + { + // Disconnect disconnects from "iPosServer" + Disconnect(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp257::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp257::StartL() + { + + // make sure Server is closed + User::After(2100000); + + // Remove getlastknown data file + DeleteFileL(KLastPosition); + + SetupPsyL(iUidMultiPsy); + ConnectL(); + + TInt err = KErrNone; + + RPositioner positioner1; + RPositioner positioner2; + TRequestStatus status1; + TRequestStatus status2; + TPositionInfo moduleInfo1; + TPositionInfo moduleInfo2; + TPositionInfo moduleInfo3; + TPositionInfo moduleInfoMaxAge1; + TPositionInfo moduleInfoMaxAge2; + + // 1) Connect to server and open positioner + err = positioner1.Open(iPosServer); + CleanupClosePushL(positioner1); + if (err != KErrNone) + { + _LIT(KErrorAndLeave, "Could not open positioner"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + _LIT(KKalleService, "KallesService"); + err = positioner1.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KKalleService); + if (err != KErrNone) + { + _LIT(KErrorAndLeave, "Could not set requestor"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // 2) Request a position + positioner1.NotifyPositionUpdate(moduleInfo1, status1); + User::WaitForRequest(status1); + if (status1.Int() != KErrNone) + { + _LIT(KErrorAndLeave, "Wrong status1 returned: "); + LogErrorAndLeaveL(KErrorAndLeave, status1.Int()); + } + + // Not included in TC, just test that it is possible to get a lastknownposition + positioner1.GetLastKnownPosition(moduleInfo2, status1); + User::WaitForRequest(status1); + if (status1.Int() != KErrNone) + { + _LIT(KErrorAndLeave, "Wrong status3 returned: "); + LogErrorAndLeaveL(KErrorAndLeave, status1.Int()); + } + + if (!ComparePositionL(moduleInfo1, moduleInfo2)) + { + _LIT(KErrorAndLeave, "1. The old position1 was not returned!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // 3) Set update interval to 5 seconds, if there are no ongoing + // position requests a GetLastKnown request is OK + TPositionUpdateOptions posOption; + posOption.SetUpdateInterval(TTimeIntervalMicroSeconds(5000000)); + + err = positioner1.SetUpdateOptions(posOption); + _LIT(KChange, "Error when setting update interval, error %d"); + AssertTrueL(err == KErrNone, KChange, err); + + positioner1.GetLastKnownPosition(moduleInfo2, status1); + User::WaitForRequest(status1); + + if (status1.Int() != KErrNone) + { + _LIT(KErrorAndLeave, "KErrNone should be returned from a tracking session"); + LogErrorAndLeaveL(KErrorAndLeave, status1.Int()); + } + + // Reset interval + posOption.SetUpdateInterval(TTimeIntervalMicroSeconds(0)); + err = positioner1.SetUpdateOptions(posOption); + + // Get last known position + positioner1.GetLastKnownPosition(moduleInfo3, status1); + User::WaitForRequest(status1); + if (status1.Int() != KErrNone) + { + _LIT(KErrorAndLeave, "Wrong status1 returned 2: "); + LogErrorAndLeaveL(KErrorAndLeave, status1.Int()); + } + + if (!ComparePositionL(moduleInfo1, moduleInfo3)) + { + _LIT(KErrorAndLeave, "2. The old position2 was not returned!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // 5 ) Set maxage to five seconds + TPositionUpdateOptions posOption2; + posOption2.SetMaxUpdateAge(TTimeIntervalMicroSeconds(5000000)); + err = positioner1.SetUpdateOptions(posOption2); + _LIT(KChange1, "Error when setting max age in SetMaxUpdateAge, error %d"); + AssertTrueL(err == KErrNone, KChange1, err); + + //Wait for five seconds + User::After(5000000); + + // 6) Get last known position + positioner1.GetLastKnownPosition(moduleInfo3, status1); + User::WaitForRequest(status1); + if (status1.Int() != KErrNone) + { + _LIT(KErrorAndLeave, "Wrong status1 returned 3"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + if (!ComparePositionL(moduleInfo1, moduleInfo3)) + { + _LIT(KErrorAndLeave, "3. The old position was not returned from positioner!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // 7) Open the maxage psy + SetupPsyL(iUidTestPsyMaxAge); + err = positioner2.Open(iPosServer, iUidTestPsyMaxAge); + CleanupClosePushL(positioner2); + _LIT(KKalleService2, "KallesService2"); + err = positioner2.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KKalleService2); + + _LIT(KErrOepnMaxAge, "Could not open the maxage psy"); + AssertTrueL(err == KErrNone, KErrOepnMaxAge, err); + + positioner2.NotifyPositionUpdate(moduleInfoMaxAge1, status2); + User::WaitForRequest(status2); + err = status2.Int(); + if (err != KErrNone) + { + _LIT(KErrorAndLeave, "Wrong status2 returned"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // 8) + positioner1.NotifyPositionUpdate(moduleInfo1, status1); + User::WaitForRequest(status1); + err = status1.Int(); + + // 9) Set maxage to four seconds for positioner2 + posOption2.SetMaxUpdateAge(TTimeIntervalMicroSeconds(4000000)); + err = positioner2.SetUpdateOptions(posOption2); + _LIT(KErrSetMaxAge, "Error when setting max age in SetMaxUpdateAge, error %d"); + AssertTrueL(err == KErrNone, KErrSetMaxAge, err); + + positioner2.NotifyPositionUpdate(moduleInfoMaxAge2, status2); + User::WaitForRequest(status2); + err = status2.Int(); + if (err != KErrNone) + { + _LIT(KErrorAndLeave, "Wrong status2 returned"); + LogErrorAndLeaveL(KErrorAndLeave); + } + // Check moduleInfoMaxAge2 and moduleInfoMaxAge1 here, should be the same + _LIT(KCheckMaxAge, "Check MaxAge position"); + INFO_PRINTF1(KCheckMaxAge); + if (!ComparePositionL(moduleInfoMaxAge1, moduleInfoMaxAge2)) + { + _LIT(KErrorAndLeave, "The maxage position was not returned from maxage positioner!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + // Close maxage positioner + positioner2.Close(); + + // 10) Check moduleInfo2 and moduleInfo1 here, should be the same + positioner1.GetLastKnownPosition(moduleInfo2, status1); + User::WaitForRequest(status1); + if (!ComparePositionL(moduleInfo2, moduleInfo1)) + { + _LIT(KErrorAndLeave, "The same maxage position was not returned from positioner for client 1!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // 11) + TPositionUpdateOptions posOption3; + posOption3.SetUpdateTimeOut(TTimeIntervalMicroSeconds(4000000)); + err = positioner1.SetUpdateOptions(posOption3); + _LIT(KErrSetTimeout, "Error when setting timeout in SetUpdateOptions, error %d"); + AssertTrueL(err == KErrNone, KErrSetTimeout, err); + + _LIT(KWaitForCancel, "Wait for cancel..."); + INFO_PRINTF1(KWaitForCancel); + + // 12) + positioner1.GetLastKnownPosition(moduleInfo2, status1); + + // Wait for five seconds + User::After(5000000); + _LIT(KWaitForRequest, "Wait for WaitForRequest(status1)..."); + INFO_PRINTF1(KWaitForRequest); + User::WaitForRequest(status1); + // Check moduleInfo2 and moduleInfo1 here, should be the same + if (!ComparePositionL(moduleInfo2, moduleInfo1)) + { + _LIT(KErrorAndLeave, "4. The same position was not returned from positioner for client 1!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // 13 ) Check with partial update + SetupPsyL(iUidTestPsyPartialUpdate); + err = positioner2.Open(iPosServer, iUidTestPsyPartialUpdate); + if (err != KErrNone) + { + _LIT(KErrorAndLeave, "Could not open PartialUpdate positioner"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + _LIT(KPellesService, "PellesService"); + err = positioner2.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KPellesService); + + // Get a position from partial update psy + positioner2.NotifyPositionUpdate(moduleInfo1, status2); + User::WaitForRequest(status2); + err = status2.Int(); + if (err != KErrNone) + { + _LIT(KErrorAndLeave, "Wrong status returned from partial update psy"); + LogErrorAndLeaveL(KErrorAndLeave, err); + } + + TPositionUpdateOptions updateOptions; + updateOptions.SetAcceptPartialUpdates(ETrue); + err = positioner2.SetUpdateOptions(updateOptions); + _LIT(KErrSetPartialupdate, "Error when setting partialupdate in SetUpdateOptions, error %d"); + AssertTrueL(err == KErrNone, KErrSetPartialupdate, err); + + // 14) GetLastKnownPosition from partial update psy + positioner2.GetLastKnownPosition(moduleInfo2, status1); + User::WaitForRequest(status1); + // Check moduleInfo2 and moduleInfo1 here, should be the same + if (!ComparePositionL(moduleInfo2, moduleInfo1)) + { + _LIT(KErrorAndLeave, "5. The same partial update position was not returned from positioner!!!"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // 15) Get another position from partial update psy, this should be a partial update position + // and should not be saved as lastknownposition + positioner2.NotifyPositionUpdate(moduleInfo1, status2); + User::WaitForRequest(status2); + err = status2.Int(); + if (err != KPositionPartialUpdate) + { + _LIT(KErrorAndLeave, "Partial Update PSY did not return KPositionPartialUpdate"); + LogErrorAndLeaveL(KErrorAndLeave, err); + } + + // 16) GetLastKnownPosition from partial update psy + positioner2.GetLastKnownPosition(moduleInfo3, status1); + User::WaitForRequest(status1); + // Check moduleInfo2 and moduleInfo1 here, should NOT be the same + if (ComparePositionL(moduleInfo1, moduleInfo2)) + { + _LIT(KErrorAndLeave, "6. The partial update position should NOT have been returned"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // Check moduleInfo3 and moduleInfo2 here, should be the same + if (ComparePositionL(moduleInfo3, moduleInfo1)) + { + _LIT(KErrorAndLeave, "7. The old position was not returned"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // Close all connections + positioner1.Close(); + positioner2.Close(); + + // 17 ) Start a periodic update session + _LIT(KPeriodicUpdate, "Checking periodic update session"); + INFO_PRINTF1(KPeriodicUpdate); + posOption.SetUpdateInterval(TTimeIntervalMicroSeconds(5000000)); + + // Connect to server and open positioner + err = positioner1.Open(iPosServer); + if (err != KErrNone) + { + _LIT(KErrorAndLeave, "Could not open positioner"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + _LIT(KKallesPeriodicService, "KallesPeriodicService"); + err = positioner1.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KKallesPeriodicService); + if (err != KErrNone) + { + _LIT(KErrorAndLeave, "Could not set requestor"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + err = positioner1.SetUpdateOptions(posOption); + _LIT(KErrSetUpdateOption, "Could not set updateoptions"); + AssertTrueL(err == KErrNone, KErrSetUpdateOption, err); + + TRequestStatus status; + positioner1.NotifyPositionUpdate(moduleInfo1, status); + User::WaitForRequest(status); + + posOption.SetUpdateInterval(TTimeIntervalMicroSeconds(0)); + // Settings update interval to 0 should stop the periodic update + err = positioner1.SetUpdateOptions(posOption); + _LIT(KErrSetUpdateOption2, "Could not set updateoptions2"); + AssertTrueL(err == KErrNone, KErrSetUpdateOption2, err); + + // Get GetLastKnownPosition from the stopped periodic update session + positioner1.GetLastKnownPosition(moduleInfo2, status); + User::WaitForRequest(status); + // Check moduleInfo2 and moduleInfo1 here, should be the same + if (!ComparePositionL(moduleInfo1, moduleInfo2)) + { + _LIT(KErrorAndLeave, "1. The periodic update session position was not equal to getlastknown position"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + positioner1.Close(); + moduleInfo1 = TPositionInfo(); + moduleInfo2 = TPositionInfo(); + + // 18 ) Start a periodic update session + INFO_PRINTF1(KPeriodicUpdate); + posOption.SetUpdateInterval(TTimeIntervalMicroSeconds(5000000)); + + // Connect to server and open positioner + err = positioner1.Open(iPosServer); + if (err != KErrNone) + { + _LIT(KErrorAndLeave, "Could not open positioner"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + err = positioner1.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KKallesPeriodicService); + if (err != KErrNone) + { + _LIT(KErrorAndLeave, "Could not set requestor"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // Connect to server and open positioner + err = positioner2.Open(iPosServer); + if (err != KErrNone) + { + _LIT(KErrorAndLeave, "Could not open positioner2"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + err = positioner2.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KKallesPeriodicService); + if (err != KErrNone) + { + _LIT(KErrorAndLeave, "Could not set requestor"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + + err = positioner1.SetUpdateOptions(posOption); + AssertTrueL(err == KErrNone, KErrSetUpdateOption, err); + + positioner1.NotifyPositionUpdate(moduleInfo1, status); + User::WaitForRequest(status); + + posOption.SetUpdateInterval(TTimeIntervalMicroSeconds(0)); + // Settings update interval to 0 should stop the periodic update + err = positioner1.SetUpdateOptions(posOption); + AssertTrueL(err == KErrNone, KErrSetUpdateOption2, err); + + positioner2.GetLastKnownPosition(moduleInfo2, status1); + User::WaitForRequest(status1); + + // Check moduleInfo2 and moduleInfo1 here, should be the same + if (!ComparePositionL(moduleInfo1, moduleInfo2)) + { + _LIT(KErrorAndLeave, "2. The periodic update session position was not equal to getlastknown position"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + positioner1.Close(); + positioner2.Close(); + + CleanupStack::PopAndDestroy(1); //positioner2 + CleanupStack::PopAndDestroy(1); //positioner1 + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp257::ComparePositionL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CT_LbsClientPosTp257::ComparePositionL(TPositionInfo aPosInfo1, TPositionInfo aPosInfo2) + { + _LIT(KFunctionName, "We are inside ComparePositionL"); + INFO_PRINTF1(KFunctionName); + TBool result = ETrue; + TBuf<150> buf; + + TPosition pos1 = TPosition(); + TPosition pos2 = TPosition(); + aPosInfo1.GetPosition(pos1); + aPosInfo2.GetPosition(pos2); + + TTime time1 = pos1.Time(); + TTime time2 = pos2.Time(); + + if (time1 == time2) + { + _LIT(KTime, "Equal Time"); + INFO_PRINTF1(KTime); + } + else + { + _LIT(KTime, "NOT Equal Time"); + INFO_PRINTF1(KTime); + } + + if ((time1 != time2) || (pos1.Latitude() != pos2.Latitude()) || + (pos1.Longitude() != pos2.Longitude()) || + (pos1.Altitude() != pos2.Altitude()) ) + { + // Not equal + result = EFalse; + _LIT(KNotEqual, "Not equal"); + INFO_PRINTF1(KNotEqual); + _LIT(KPosition1, "Position1: Lat %f Long %f Alt %f"); + buf.Format(KPosition1, pos1.Latitude(), pos1.Longitude() ,pos1.Altitude()); + INFO_PRINTF1(buf); + _LIT(KPosition2, "Position2: Lat %f Long %f Alt %f"); + buf.Format(KPosition2, pos2.Latitude(), pos2.Longitude() ,pos2.Altitude()); + INFO_PRINTF1(buf); + } + else + { + _LIT(KEqual, "Equal"); + INFO_PRINTF1(KEqual); + result = ETrue; + _LIT(KPosition1, "Position1: Lat %f Long %f Alt %f"); + buf.Format(KPosition1, pos1.Latitude(), pos1.Longitude() ,pos1.Altitude()); + INFO_PRINTF1(buf); + } + return result; + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp257::DeleteFileL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp257::DeleteFileL(const TDesC& aFile) + { + RFs fs; + TInt err = fs.Connect(); + + err = fs.Delete(aFile); + fs.Close(); + if (err == KErrNone) + { + _LIT(KDebugText, "TP257: The specified file deleted"); + INFO_PRINTF1(KDebugText); + } + else + { + if (err == KErrInUse) + { + _LIT(KErrText, "TP257: The specified file could not be deleted it is already in use, errorcode %d"); + INFO_PRINTF1(aFile); + TBuf<100> buf; + buf.Format(KErrText, err); + AssertTrueL(err==0, KErrText, err); + } + else if (err == KErrNotFound) + { + _LIT(KDebugText, "TP257: The specified file could not be found ,errorcode %d"); + TBuf<100> buf; + buf.Format(KDebugText, err); + INFO_PRINTF1(buf); + } + else + { + _LIT(KErrText, "TP257: The specified file could not be deleted, errorcode %d"); + TBuf<100> buf; + buf.Format(KErrText, err); + AssertTrueL(err==0, KErrText, err); + } + } + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp254::FileExistsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +TBool CT_LbsClientPosTp257::FileExistsL(const TDesC& aFile) + { + TBool exist = EFalse; + RFs fs; + RFile file; + TInt err = fs.Connect(); + + err = file.Open(fs, aFile, EFileRead); + if (err==KErrNotFound) // file does not exist + { + fs.Close(); + _LIT(KErrText, "TP257: The specified file does not exist"); + INFO_PRINTF1(KErrText); + } + else + { + exist = ETrue; + _LIT(KErrText, "TP257: The specified file exists"); + INFO_PRINTF1(KErrText); + file.Close(); + fs.Close(); + } + return exist; + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp259.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp259.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,200 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp259.h" + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp259::CT_LbsClientPosTp259(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP259 - Cancel Request with incorrect enum values"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp259::~CT_LbsClientPosTp259() + { + } +// --------------------------------------------------------- +// CT_LbsClientPosTp259::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp259::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp259::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp259::StartL() + { + // TestPart1 tests the separate case described in Error Report + // "SBUY-5W8KJ6-Bug in subsession selection when forwarding requests" + TestPart1L(); + + // Testpart2 tests some other scenarios not included in TestPart1L + TestPart2L(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp259::TestPart1L +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp259::TestPart1L() + { + _LIT(KFunctionsName, "We are inside TestPart1L()"); + INFO_PRINTF1(KFunctionsName); + ConnectL(); + + // First call the RPosServer::CancelRequest method with inparameter + // EPositionerNotifyPositionUpdate and then call the RPositioner::CancelRequest + // method with EPositionServerNotifyModuleStatusEvent + + _LIT(KCancelRequest, "iPosServer.CancelRequest(EPositionerNotifyPositionUpdate)"); + INFO_PRINTF1(KCancelRequest); + TInt cancelErr = iPosServer.CancelRequest(EPositionerNotifyPositionUpdate); + if (cancelErr != KErrNotSupported) + { + _LIT(KErrorAndLeave, "The CancelRequest(EPositionerNotifyPositionUpdate) call did not return KErrNotSupported"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + SetupPsyL(iUidMultiPsy); + User::LeaveIfError(OpenPositionerByName(iUidMultiPsy)); + + _LIT(KModuleStatusEvent, "iPositioner.CancelRequest(EPositionServerNotifyModuleStatusEvent);"); + INFO_PRINTF1(KModuleStatusEvent); + TInt err = iPositioner.CancelRequest(EPositionServerNotifyModuleStatusEvent); + if (err != KErrNotSupported) + { + _LIT(KErrorAndLeave, "The CancelRequest(EPositionServerNotifyModuleStatusEvent) call did not return KErrNotFound"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp259::TestPart2L +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp259::TestPart2L() + { + _LIT(KFunctionsName,"We are inside TestPart2L()"); + INFO_PRINTF1(KFunctionsName); + SetupPsyL(iUidMultiPsy); + ConnectL(); + TInt err = KErrNone; + User::LeaveIfError(OpenPositionerByName(iUidMultiPsy)); + + err = iPositioner.CancelRequest(EPositionServerNotifyModuleStatusEvent); + if (err != KErrNotSupported) + { + _LIT(KErrorAndLeave, "The CancelRequest(EPositionServerNotifyModuleStatusEvent) call did not return KErrNotFound"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // Verify that a RPosServer.CancelRequest(EPositionServerNotifyModuleStatusEvent) (incorrect call) + // call does not affect the RPositioner.NotifyPositionUpdate call + _LIT(KKalle, "Kalle"); + PerformRequestL(KKalle, CRequestor::ERequestorService, CRequestor::EFormatTelephone); + err = iPosServer.CancelRequest(EPositionServerNotifyModuleStatusEvent); + if (err != KErrNotFound) + { + _LIT(KErrorAndLeave, "The CancelRequest(EPositionServerNotifyModuleStatusEvent) call did not return KErrNotFound"); + LogErrorAndLeaveL(KErrorAndLeave); + } + CheckRequestResultL(KErrNone); + + // Verify that a RPositioner.CancelRequest(EPositionServerNotifyModuleStatusEvent) (incorrect call) + // call does not affect the RPositioner.NotifyPositionUpdate call + PerformRequestL(KKalle, CRequestor::ERequestorService, CRequestor::EFormatTelephone); + err = iPositioner.CancelRequest(EPositionServerNotifyModuleStatusEvent); + if (err != KErrNotSupported) + { + _LIT(KErrorAndLeave, "The CancelRequest(EPositionServerNotifyModuleStatusEvent) call did not return KErrNotFound"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + CheckRequestResultL(KErrNone); + + err = iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); + if (err != KErrNotFound) + { + _LIT(KErrorAndLeave, "The CancelRequest(EPositionerNotifyPositionUpdate) call did not return KErrNotFound"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + ClosePositioner(); + + // According to error report "SBUY-5W8KJ6 - Bug in subsession selection when forwarding requests" + // CancelRequest call will return with KErrNotSupported + TInt cancelErr = iPosServer.CancelRequest(EPositionerNotifyPositionUpdate); + if (cancelErr != KErrNotSupported) + { + _LIT(KErrorAndLeave, "The CancelRequest(EPositionerNotifyPositionUpdate) call did not return KErrNotSupported"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + // According to error report "SBUY-5W8KJ6 - Bug in subsession selection when forwarding requests" + // CancelRequest call will return with KErrNotSupported + _LIT(KLastKnownPosition, "iPosServer.CancelRequest(EPositionerGetLastKnownPosition)"); + INFO_PRINTF1(KLastKnownPosition); + cancelErr = iPosServer.CancelRequest(EPositionerGetLastKnownPosition); + if (cancelErr != KErrNotSupported) + { + _LIT(KErrorAndLeave, "The CancelRequest(EPositionerGetLastKnownPosition) call did not return KErrNotSupported"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + //Make a request and then cancel a GetLastKnownPosition request that hasn't been made + //and check that the position request is not affected + User::LeaveIfError(OpenPositionerByName(iUidMultiPsy)); + PerformRequestL(KKalle, CRequestor::ERequestorService, CRequestor::EFormatTelephone); + + cancelErr = iPosServer.CancelRequest(EPositionerGetLastKnownPosition); + if (cancelErr != KErrNotSupported) + { + _LIT(KErrorAndLeave, "The CancelRequest(EPositionerGetLastKnownPosition call did not return KErrNotSupported"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + CheckRequestResultL(KErrNone); + + ClosePositioner(); + Disconnect(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp261.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp261.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,256 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp261.h" +#include +#include + +// CONSTANTS + +// LOCAL FUNCTIONS +void CleanOp(TAny* aAnArray) + { + // Cleanup function the requestor stack + RRequestorStack* theStack = reinterpret_cast (aAnArray); + theStack->ResetAndDestroy(); + } + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp261::CT_LbsClientPosTp261(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName,"Tp261 - RequestorStack Externalize/Internalize"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp261::~CT_LbsClientPosTp261() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp261::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp261::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp261::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp261::StartL() + { + _LIT(KService1, "Service1"); + _LIT(KService2, "Service2"); + _LIT(KService3, "Service3"); + + _LIT(KContact1, "Contact1"); + _LIT(KContact2, "Contact2"); + _LIT(KContact3, "Contact3"); + + CRequestor* serviceId1 = + CRequestor::NewL(CRequestor::ERequestorService, CRequestor::EFormatApplication, + KService1); + + CRequestor* serviceId2 = + CRequestor::NewL(CRequestor::ERequestorService, CRequestor::EFormatApplication, + KService2); + + CRequestor* serviceId3 = + CRequestor::NewL(CRequestor::ERequestorService, CRequestor::EFormatApplication, + KService3); + + CRequestor* contactId1 = + CRequestor::NewL(CRequestor::ERequestorContact, CRequestor::EFormatTelephone, + KContact1); + + CRequestor* contactId2 = + CRequestor::NewL(CRequestor::ERequestorContact, CRequestor::EFormatUrl, + KContact2); + + CRequestor* contactId3 = + CRequestor::NewL(CRequestor::ERequestorContact, CRequestor::EFormatMail, + KContact3); + + RRequestorStack stack = RRequestorStack(); + CleanupStack::PushL(TCleanupItem(CleanOp ,&stack)); + + CleanupStack::PushL(serviceId1); + CleanupStack::PushL(serviceId2); + CleanupStack::PushL(serviceId3); + CleanupStack::PushL(contactId1); + CleanupStack::PushL(contactId2); + CleanupStack::PushL(contactId3); + + ConnectL(); + OpenPositioner(); + + stack.Append(serviceId1); + stack.Append(contactId1); + stack.Append(contactId2); + stack.Append(serviceId2); + stack.Append(contactId3); + stack.Append(serviceId3); + + CleanupStack::Pop(contactId3); + CleanupStack::Pop(contactId2); + CleanupStack::Pop(contactId1); + CleanupStack::Pop(serviceId3); + CleanupStack::Pop(serviceId2); + CleanupStack::Pop(serviceId1); + + TInt err = iPositioner.SetRequestor(stack); + if (err != KErrNone) + { + _LIT(KErrorAndLeave, "Problems setting requestorstack"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + const TInt KPosBufFlatExpandSize = 100; + + //ExternalizeL + CBufFlat* bufFlat = CBufFlat::NewL(KPosBufFlatExpandSize); + CleanupStack::PushL(bufFlat); + + RBufWriteStream stream(*bufFlat); + CleanupClosePushL(stream); + stack.ExternalizeL(stream); + + TPtr8 dataPtr((TUint8*)NULL, 0); + dataPtr.Set(bufFlat->Ptr(0)); + + CleanupStack::PopAndDestroy(&stream); + + HBufC8* tempBuf = HBufC8::NewLC(bufFlat->Size()); + TPtr8 ptr = tempBuf->Des(); + ptr = dataPtr; + + //Internalize + bufFlat->InsertL(0, ptr); + + RBufReadStream rstream(*bufFlat); + CleanupClosePushL(rstream); + + RRequestorStack stack2 = RRequestorStack(); + CleanupStack::PushL(TCleanupItem(CleanOp ,&stack2)); + + stack2.InternalizeL(rstream); + + // Verify the requestor stack + VerifyRequestorStackL(stack2); + _LIT(KResult, "The RequestorStack is correct after Externalize/Internalize"); + INFO_PRINTF1(KResult); + + CleanupStack::PopAndDestroy(1); // CleanupOp stack2 + + CleanupStack::PopAndDestroy(&rstream); + CleanupStack::PopAndDestroy(tempBuf); + CleanupStack::PopAndDestroy(bufFlat); + CleanupStack::PopAndDestroy(1); // CleanupOp stack1 + + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp261::VerifyRequestorStackL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp261::VerifyRequestorStackL(RRequestorStack& aStack) + { + TInt count = aStack.Count(); + + _LIT(KService1, "Service1"); + _LIT(KService2, "Service2"); + _LIT(KService3, "Service3"); + + _LIT(KContact1, "Contact1"); + _LIT(KContact2, "Contact2"); + _LIT(KContact3, "Contact3"); + + // Hardcoded number of requestors + if (count != 6) + { + _LIT(KErrorAndLeave, "Wrong number of requestors in the stack"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + if (aStack[0]->RequestorType() != CRequestor::ERequestorService + || aStack[0]->RequestorFormat() != CRequestor::EFormatApplication + || aStack[0]->RequestorData() != KService1) + { + _LIT(KErrorAndLeave, "Wrong requestor(1) in stack"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + if (aStack[1]->RequestorType() != CRequestor::ERequestorContact + || aStack[1]->RequestorFormat() != CRequestor::EFormatTelephone + || aStack[1]->RequestorData() != KContact1) + { + _LIT(KErrorAndLeave, "Wrong requestor(2) in stack"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + if (aStack[2]->RequestorType() != CRequestor::ERequestorContact + || aStack[2]->RequestorFormat() != CRequestor::EFormatUrl + || aStack[2]->RequestorData() != KContact2) + { + _LIT(KErrorAndLeave, "Wrong requestor(3) in stack"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + if (aStack[3]->RequestorType() != CRequestor::ERequestorService + || aStack[3]->RequestorFormat() != CRequestor::EFormatApplication + || aStack[3]->RequestorData() != KService2) + { + _LIT(KErrorAndLeave, "Wrong requestor(4) in stack"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + if (aStack[4]->RequestorType() != CRequestor::ERequestorContact + || aStack[4]->RequestorFormat() != CRequestor::EFormatMail + || aStack[4]->RequestorData() != KContact3) + { + _LIT(KErrorAndLeave, "Wrong requestor(5) in stack"); + LogErrorAndLeaveL(KErrorAndLeave); + } + + if (aStack[5]->RequestorType() != CRequestor::ERequestorService + || aStack[5]->RequestorFormat() != CRequestor::EFormatApplication + || aStack[5]->RequestorData() != KService3) + { + _LIT(KErrorAndLeave, "Wrong requestor(6) in stack"); + LogErrorAndLeaveL(KErrorAndLeave); + } + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp269.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp269.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,229 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp269.h" +#include +#include +#include +#include +#include + +// CONSTANTS + +const TInt KEspectedErrorCodePSY1Request6 = KErrDied; +const TInt KEspectedErrorCodePSY1Request8 = KErrBadPower; +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp269::CT_LbsClientPosTp269(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "Tp269 - Fallback in Default Proxy (CR0526)"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp269::~CT_LbsClientPosTp269() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp269::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp269::StartL() + { + ConnectL(); + + SetupProxyPSYsL(); + + TInt err = OpenPositioner(); + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueSecL(err == KErrNone, KOpenErr, err); + + _LIT(KServiceName, "TP269"); + iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); + + TUint request = 0; + + TPositionInfo posInfo; + ///////////////////////////////////////////// + // Request 1 + ///////////////////////////////////////////// + RequestL(posInfo, ++request, KEspectedErrorCodePSY2); + + // Used test PSYs reports ready when loaded, inactive when unloaded + VerifyPsyLoadedL(iUidTestProxyPsy1); + VerifyPsyLoadedL(iUidTestProxyPsy2); + + ///////////////////////////////////////////// + // Request 2 + ///////////////////////////////////////////// + RequestL(posInfo, ++request, KEspectedErrorCodePSY1); + VerifyPsyLoadedL(iUidTestProxyPsy1); + + ///////////////////////////////////////////// + // Request 3 + ///////////////////////////////////////////// + RequestL(posInfo, ++request, KEspectedErrorCodePSY3); + VerifyPsyLoadedL(iUidTestProxyPsy1); + VerifyPsyLoadedL(iUidTestProxyPsy2); + VerifyPsyLoadedL(iUidTestProxyPsy3); + + ///////////////////////////////////////////// + // Request 4 + ///////////////////////////////////////////// + RequestL(posInfo, ++request, KEspectedErrorCodePSY3); + VerifyPsyLoadedL(iUidTestProxyPsy1); + VerifyPsyLoadedL(iUidTestProxyPsy2); + VerifyPsyLoadedL(iUidTestProxyPsy3); + + ///////////////////////////////////////////// + // Request 5 + ///////////////////////////////////////////// + RequestL(posInfo, ++request, KEspectedErrorCodePSY2); + VerifyPsyLoadedL(iUidTestProxyPsy1); + VerifyPsyLoadedL(iUidTestProxyPsy2); + + ///////////////////////////////////////////// + // Request 6 + ///////////////////////////////////////////// + RequestL(posInfo, ++request, KEspectedErrorCodePSY1Request6); + VerifyPsyLoadedL(iUidTestProxyPsy1); + VerifyPsyLoadedL(iUidTestProxyPsy2); + VerifyPsyLoadedL(iUidTestProxyPsy3); + + // Switch priority + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + db->SetModulePriorityL(iUidTestProxyPsy3, 1); + db->SetModulePriorityL(iUidTestProxyPsy2, 2); + + ///////////////////////////////////////////// + // Request 7 + ///////////////////////////////////////////// + RequestL(posInfo, ++request, KEspectedErrorCodePSY3); + VerifyPsyLoadedL(iUidTestProxyPsy1); + VerifyPsyLoadedL(iUidTestProxyPsy3); + + ///////////////////////////////////////////// + // Request 8 + ///////////////////////////////////////////// + RequestL(posInfo, ++request, KEspectedErrorCodePSY1Request8); + VerifyPsyLoadedL(iUidTestProxyPsy1); + VerifyPsyLoadedL(iUidTestProxyPsy2); + VerifyPsyLoadedL(iUidTestProxyPsy3); + + // Switch back priority + db->SetModulePriorityL(iUidTestProxyPsy2, 1); + db->SetModulePriorityL(iUidTestProxyPsy3, 2); + + CleanupStack::PopAndDestroy(db); + + ///////////////////////////////////////////// + // Request 9 + ///////////////////////////////////////////// + TPositionSatelliteInfo satInfo; + RequestL(satInfo, ++request, KErrArgument); + + ///////////////////////////////////////////// + // Request 10 + ///////////////////////////////////////////// + TPositionCourseInfo courseInfo; + RequestL(courseInfo, ++request, KEspectedErrorCodePSY3); + + VerifyPsyLoadedL(iUidTestProxyPsy3); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp269::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp269::CloseTest() + { + iPositioner.Close(); + iPosServer.Close(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp269::AssertTrueSecL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp269::AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode) + { + if (!aCondition) + { + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + LogErrorAndLeaveL(buf); + } + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp269::SetupProxyPSYsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp269::SetupProxyPSYsL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(EFalse); + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + // Disable all PSY:s except PSYs used by this TP269, TP270 + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != iUidTestProxyPsy1 && + (*prioList)[i] != iUidTestProxyPsy2 && + (*prioList)[i] != iUidTestProxyPsy3) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestProxyPsy1, *moduleUpdate); + db->UpdateModuleL(iUidTestProxyPsy2, *moduleUpdate); + db->UpdateModuleL(iUidTestProxyPsy3, *moduleUpdate); + + db->SetModulePriorityL(iUidTestProxyPsy1, 0); + db->SetModulePriorityL(iUidTestProxyPsy2, 1); + db->SetModulePriorityL(iUidTestProxyPsy3, 2); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// End of File + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp27.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp27.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,336 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp27.h" +#include "ctlbsposclientholder.h" +#include +#include +#include +#include + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp27::CT_LbsClientPosTp27(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName,"TP27 - Cancel Request"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp27::~CT_LbsClientPosTp27() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp27::CloseTest +// Always called after the test, even if the test leaves +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp27::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp27::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp27::StartL() + { + SetupPsyL(iUidDynDbTestPsy); + TTimeIntervalMicroSeconds timeLimit(5000000); + ConnectL(); + User::LeaveIfError(OpenPositioner()); + + TPositionInfo posInfo = TPositionInfo(); + _LIT(KService, "service"); + TInt err = PerformSyncRequest(KService, &posInfo); + + if (err != KErrNone) + { + _LIT(KErrorRequest, "The request was not completed with KErrorNone"); + LogErrorAndLeaveL(KErrorRequest); + } + ClosePositioner(); + Disconnect(); + //Cancel quick (most likely before the PSY gets involved + MakeCancelRequestL(TTimeIntervalMicroSeconds32(100), timeLimit ); + //Cancel after 1 second so that the PSY gets involved. + MakeCancelRequestL(TTimeIntervalMicroSeconds32(1000000), timeLimit); + + CheckCancelRequestL(); + + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp27::MakeCancelRequestL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp27::MakeCancelRequestL(TTimeIntervalMicroSeconds32 aCancelTime, TTimeIntervalMicroSeconds aTimeLimit) + { + const TInt KNrOfClients = 1; + CT_LbsPosClientHolder* clients = CT_LbsPosClientHolder::NewLC(KNrOfClients); + + clients->SetRequesterWillCancelL(); + clients ->SetCancelTime(aCancelTime); + clients->MakeRequests(); + + TInt status; + + TPositionInfo myModuleInfo; + TTimeIntervalMicroSeconds reqTime; + clients->GetResult(status, myModuleInfo, reqTime); + + if (status != KErrCancel) + { + _LIT(KReqWasNotCancelled, "The request was not cancelled, return code %d"); + TBuf<100> buf; + buf.Format(KReqWasNotCancelled, status); + LogErrorAndLeaveL(buf); + } + + if (reqTime > aTimeLimit) + { + _LIT(KError, "The request took too long, %d microsecs. It was probably never cancelled"); + TBuf<100> buf; + buf.Format(KError, reqTime.Int64()); + LogErrorAndLeaveL(buf); + } + + _LIT(KMsg, "The request was cancelled after %d microsecs."); + TBuf<100> buf; + buf.Format(KMsg, reqTime.Int64()); + INFO_PRINTF1(buf); + CleanupStack::PopAndDestroy(clients); //clients + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp27::MakeCancelRequest2L +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp27::MakeCancelRequest2L(TTimeIntervalMicroSeconds32 aCancelTime, TTimeIntervalMicroSeconds aTimeLimit) + { + _LIT(KCancelRequest,"MakeCancelRequest2L"); + INFO_PRINTF1(KCancelRequest); + + RFs fs; + TInt err = fs.Connect(); + CleanupClosePushL(fs); + + DisableAllPsyL(); + ConnectL(); + // TestPsy9 waits for 6 sec before returning a position + EnablePsyL(iUidTestPsy9); + err = OpenPositionerByName(iUidTestPsy9); + if (err != KErrNone) + { + TBuf<150> buf; + _LIT(KErr, "OpenPositionerByName failed with %d"); + buf.Format(KErr, err); + LogErrorAndLeaveL(buf); + } + + _LIT(KPerformRequest,"The request info"); + PerformRequestL(KPerformRequest, CRequestor::ERequestorService, CRequestor::EFormatApplication); + + const TInt KNrOfClients = 2; + // TestPsy6 waits for 5 sec before returning a position + EnablePsyL(iUidTestPsy6); + CT_LbsPosClientHolder* clients = CT_LbsPosClientHolder::NewLC(KNrOfClients, iUidTestPsy6, ETrue); + + clients->SetRequesterWillCancelL(); + clients->SetCancelTime(aCancelTime); + + clients->MakeRequests(); + CheckRequestResultL(KErrNone); + + TInt status; + TPositionInfo myModuleInfo; + TTimeIntervalMicroSeconds reqTime; + clients->GetResult(status, myModuleInfo, reqTime); + + if (status != KErrCancel) + { + _LIT(KReqWasNotCancelled, "The request was not cancelled, return code %d"); + TBuf<100> buf; + buf.Format(KReqWasNotCancelled, status); + LogErrorAndLeaveL(buf); + } + + if (reqTime > aTimeLimit) + { + _LIT(KError, "The request took too long, %d microsecs. It was probably never cancelled"); + TBuf<100> buf; + buf.Format(KError, reqTime.Int64()); + LogErrorAndLeaveL(buf); + } + + _LIT(KMsg, "The request was cancelled after %d microsecs."); + TBuf<100> buf; + buf.Format(KMsg, reqTime.Int64()); + INFO_PRINTF1(buf); + + ClosePositioner(); + Disconnect(); + + //Check request log + RArray arrayId; + CleanupClosePushL(arrayId); + err = KErrNone; + + if (err != KErrNone) + { + TBuf<150> buf; + _LIT(KErr, "GetLogEntryListL() returned error, %d"); + buf.Format(KErr, err); + LogErrorAndLeaveL(buf); + } + + // All requests should have been logged, including the cancelled requests + TInt numberOfElements = arrayId. Count(); + + if (numberOfElements != 3) + { + buf.Zero(); + _LIT(KErrLog,"ERROR: The log contains wrong number of entries, was %d"); + buf.Format(KErrLog, numberOfElements); + INFO_PRINTF1(buf); + _LIT(KErrAndLeave, "Cancelled request has not been logged!!!"); + LogErrorAndLeaveL(KErrAndLeave); + } + + CleanupStack::PopAndDestroy(&arrayId); + CleanupStack::PopAndDestroy(clients); //clients + CleanupStack::PopAndDestroy(1); // privCtrl + CleanupStack::PopAndDestroy(1); //fs + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp27::CheckCancelRequestL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp27::CheckCancelRequestL() + { + _LIT(KFunctionName, "We are inside CheckCancelRequestL"); + INFO_PRINTF1(KFunctionName); + + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + // TestPsy9 waits for 6 sec before returning a position + SetupPsyL(iUidTestPsy9); + TTimeIntervalMicroSeconds32 cancelTime(2000000); // 2 sec + const TInt KNrOfClients = 1; + CT_LbsPosClientHolder* clients = CT_LbsPosClientHolder::NewLC(KNrOfClients, iUidTestPsy9); + + clients->SetRequesterWillCancelL(); + clients->SetCancelTime(cancelTime); + clients->MakeRequests(); + + TInt status; + + TPositionInfo myModuleInfo; + TTimeIntervalMicroSeconds reqTime; + clients->GetResult(status, myModuleInfo, reqTime); + + if (status != KErrCancel) + { + _LIT(KReqWasNotCancelled, "The request was not cancelled, return code %d"); + TBuf<100> buf; + buf.Format(KReqWasNotCancelled, status); + LogErrorAndLeaveL(buf); + } + + _LIT(KMsg, "The request was cancelled after %d microsecs."); + TBuf<100> buf; + buf.Format(KMsg, reqTime.Int64()); + INFO_PRINTF1(buf); + + //Check request log + RArray arrayId; + CleanupClosePushL(arrayId); + + CleanupStack::PopAndDestroy(&arrayId); + CleanupStack::PopAndDestroy(clients); //clients + CleanupStack::PopAndDestroy(1); // privCtrl + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp27::DisableAllPsyL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp27::DisableAllPsyL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + // Disable PSY + moduleUpdate->SetUpdateAvailability(EFalse); + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + // Disable all PSY:s + for (TInt i = 0 ; i < prioList->Count(); i++) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp27::DisableAllPsyL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp27::EnablePsyL(const TUid aPsyUid) + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + // Enable the PSY that came as an in parameter + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(aPsyUid, *moduleUpdate); + + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp271.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp271.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,282 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp271.h" + +#include +#include +#include +#include +#include + +// CONSTANTS + +const TInt KUpdateInterval = 1000; +const TInt KUpdateInterval2 = 2000; + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp271::CT_LbsClientPosTp271(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName,"Tp271-Fallback in Default Proxy,Perodic Update"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp271::~CT_LbsClientPosTp271() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp271::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp271::StartL() + { + ConnectL(); + + SetupProxyPSYsL(); + + iModuleEvent.SetRequestedEvents(TPositionModuleStatusEvent::EEventAll); + + TInt err = OpenPositioner(); + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueSecL(err == KErrNone, KOpenErr, err); + + _LIT(KServiceName, "TP271"); + iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); + + TUint request = 20; + TPositionInfo posInfo; + ///////////////////////////////////////////// + // Request 1 + ///////////////////////////////////////////// + RequestL(posInfo, ++request, KEspectedErrorCodePSY2); + + // Used test PSYs reports ready when loaded, inactive when unloaded + VerifyPsyLoadedL(iUidTestProxyPsy1); + VerifyPsyLoadedL(iUidTestProxyPsy2); + + // Set periodic update + TPositionUpdateOptions updateOptions; + updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(KUpdateInterval)); + + err = iPositioner.SetUpdateOptions(updateOptions); + _LIT(KUpdateErr, "Error when setting update interval, %d"); + AssertTrueL(err == KErrNone, KUpdateErr, err); + + ///////////////////////////////////////////// + // Request 2 + ///////////////////////////////////////////// + RequestL(posInfo, ++request, KEspectedErrorCodePSY3); + + + ///////////////////////////////////////////// + // Request 3 + ///////////////////////////////////////////// + RequestL(posInfo, ++request, KEspectedErrorCodePSY2); + + VerifyPsyStartedTrackingL(iUidTestProxyPsy1); // Verify that still loaded, latest reported event + VerifyPsyStartedTrackingL(iUidTestProxyPsy2); // should still be the same + VerifyPsyStartedTrackingL(iUidTestProxyPsy3); + + ///////////////////////////////////////////// + // Request 4 + ///////////////////////////////////////////// + updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(KUpdateInterval2)); + err = iPositioner.SetUpdateOptions(updateOptions); + AssertTrueL(err == KErrNone, KUpdateErr, err); + + RequestL(posInfo, ++request, KEspectedErrorCodePSY2); + + VerifyPsyStartedTrackingL(iUidTestProxyPsy1); + VerifyPsyStartedTrackingL(iUidTestProxyPsy2); + + ///////////////////////////////////////////// + // Request 5 + ///////////////////////////////////////////// + updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(0)); + err = iPositioner.SetUpdateOptions(updateOptions); + AssertTrueL(err == KErrNone, KUpdateErr, err); + + VerifyPsyStoppedTrackingL(iUidTestProxyPsy1); + VerifyPsyStoppedTrackingL(iUidTestProxyPsy2); + + RequestL(posInfo, ++request, KEspectedErrorCodePSY3); + + VerifyPsyStoppedTrackingL(iUidTestProxyPsy1); // Verifies that still loaded, + VerifyPsyStoppedTrackingL(iUidTestProxyPsy2); // Verifies that still loaded, + + ///////////////////////////////////////////// + // Request 6 + ///////////////////////////////////////////// + updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(KUpdateInterval)); + err = iPositioner.SetUpdateOptions(updateOptions); + AssertTrueL(err == KErrNone, KUpdateErr, err); + + RequestL(posInfo, ++request, KEspectedErrorCodePSY1); + + iPositioner.Close(); + + VerifyPsyUnloadedL(iUidTestProxyPsy1); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp271::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp271::CloseTest() + { + iPositioner.Close(); + iPosServer.Close(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp271::AssertTrueSecL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp271::AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode) + { + if (!aCondition) + { + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + LogErrorAndLeaveL(buf); + } + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp271::SetupProxyPSYsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp271::SetupProxyPSYsL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(EFalse); + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + // Disable all PSY:s except PSYs used by this TP271, TP270 + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != iUidTestProxyPsy1 && + (*prioList)[i] != iUidTestProxyPsy2 && + (*prioList)[i] != iUidTestProxyPsy3) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestProxyPsy1, *moduleUpdate); + db->UpdateModuleL(iUidTestProxyPsy2, *moduleUpdate); + db->UpdateModuleL(iUidTestProxyPsy3, *moduleUpdate); + + db->SetModulePriorityL(iUidTestProxyPsy1, 0); + db->SetModulePriorityL(iUidTestProxyPsy2, 1); + db->SetModulePriorityL(iUidTestProxyPsy3, 2); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp271::VerifyPsyStartedUnloadedL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp271::VerifyPsyStartedTrackingL(TPositionModuleId& aUid) + { + _LIT(KPSYStatus,"Verifies if correct PSY is loaded by getting its status"); + INFO_PRINTF1(KPSYStatus); + + _LIT(KDeviceStatusErr, "The PSY has not reported expected Device Status and is not notified about start tracking"); + + TPositionModuleStatus moduleStatus; + iPosServer.GetModuleStatus(moduleStatus, aUid); + + AssertTrueL(TPositionModuleStatus::EDeviceInitialising == moduleStatus.DeviceStatus(), KDeviceStatusErr, KErrGeneral); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp271::VerifyPsyStoppedTrackingL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp271::VerifyPsyStoppedTrackingL(TPositionModuleId& /*aUid*/, TRequestStatus& aStatus) + { + _LIT(KPSYStatus,"Verifies that correct PSY has stopped tracking and is unloaded"); + INFO_PRINTF1(KPSYStatus); + + _LIT(KStoppedTrackingErr, "The PSY has not reported expected device status and has not stopped tracking"); + + TPositionModuleStatus moduleStatus; + + User::WaitForRequest(aStatus); + + iModuleEvent.GetModuleStatus(moduleStatus); + + AssertTrueL(TPositionModuleStatus::EDeviceStandBy == moduleStatus.DeviceStatus(), + KStoppedTrackingErr, + KErrGeneral); + + + } +// --------------------------------------------------------- +// CT_LbsClientPosTp271::VerifyPsyStoppedTrackingL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp271::VerifyPsyStoppedTrackingL(TPositionModuleId& aUid) + { + _LIT(KPSYStatus,"Verifies that correct PSY has stopped tracking and is unloaded"); + INFO_PRINTF1(KPSYStatus); + + _LIT(KStoppedTrackingErr, "The PSY has not reported expected device status and has not stopped tracking"); + + TPositionModuleStatus moduleStatus; + + iPosServer.GetModuleStatus(moduleStatus, aUid); + + AssertTrueL(TPositionModuleStatus::EDeviceStandBy == moduleStatus.DeviceStatus(), + KStoppedTrackingErr, + KErrGeneral); + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp272.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp272.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,196 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp272.h" + +#include + +// CONSTANTS +const TInt KUpdateInterval = 10000000; +const TInt KUpdateInterval2 = 15000000; +const TInt KUpdateInterval3 = 2000000; + +const TInt KMinTimeLimitRequest1 = 0; +const TInt KMaxTimeLimitRequest1 = 2000000; + +const TInt KMinTimeLimitRequest2 = 9000000; +const TInt KMaxTimeLimitRequest2 = 12000000; + +const TInt KMinTimeLimitRequest3 = 14000000; +const TInt KMaxTimeLimitRequest3 = 17000000; + +const TInt KMinTimeLimitRequest4 = 0; +const TInt KMaxTimeLimitRequest4 = 3000000;//200000; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp272::CT_LbsClientPosTp272(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName,"Tp272-Perodic Update, Changing the interval"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp272::~CT_LbsClientPosTp272() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp272::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp272::StartL() + { + _LIT(KOpenErr, "Error when opening MultiPSY, %d"); + _LIT(KServiceName, "TP272"); + + SetupPsyL(iUidMultiPsy); + + ConnectL(); + + TInt err = OpenPositionerByName(iUidMultiPsy); + AssertTrueSecL(err == KErrNone, KOpenErr, err); + + iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); + + SetPeriodicUpdateL(KUpdateInterval); + + TInt request=0; + // NotifyPositionUpdate should be called direct by the server on the first request + // even if update interval is used + RequestL(++request, KMinTimeLimitRequest1, KMaxTimeLimitRequest1); + + // Even if same update interval is set again should the first request complete direct + SetPeriodicUpdateL(KUpdateInterval); + RequestL(++request, KMinTimeLimitRequest2, KMaxTimeLimitRequest2); + + // NotifyPositionUpdate should be called after the update interval on the second request + // but when the update interval is changed should it be called direct + RequestL(++request, KMinTimeLimitRequest2, KMaxTimeLimitRequest2, KUpdateInterval2); + + // Now should the request time be about 10 sec + RequestL(++request, KMinTimeLimitRequest3, KMaxTimeLimitRequest3); + + SetPeriodicUpdateL(KUpdateInterval3); + + // Should return direct since update interval changed again + RequestL(++request, KMinTimeLimitRequest4, KMaxTimeLimitRequest4); + + + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp272::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp272::CloseTest() + { + iPositioner.Close(); + iPosServer.Close(); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp272::AssertTrueSecL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp272::AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode) + { + if (!aCondition) + { + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + LogErrorAndLeaveL(buf); + } + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp272::RequestL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp272::RequestL(const TInt& aRequestIndex, + const TInt64& aMinTimeLimit, + const TInt64& aMaxTimeLimit, + const TInt& aPeriodicUpdateInterval) + { + _LIT(KUnexpectedErrCode, "Unexpected error code %d returned by the used PSY"); + _LIT(KRequestMaxTimeErr, "Request took to long"); + _LIT(KRequestMinTimeErr, "Request was to fast"); + _LIT(KRequestTime, "Request took %d microsecs"); + + TBuf<100> info; + _LIT(KInfo, "Making request %d"); + info.Format(KInfo, aRequestIndex); + INFO_PRINTF1(info); + + TTime start, stop; + start.UniversalTime(); + + TPositionInfo posInfo; + TRequestStatus status; + iPositioner.NotifyPositionUpdate(posInfo, status); + + if (aPeriodicUpdateInterval != 0) + { + User::After(5000000); + SetPeriodicUpdateL(KUpdateInterval2); + } + + User::WaitForRequest(status); + stop.UniversalTime(); + + TInt64 usec = (stop.Int64() - start.Int64()); + info.Format(KRequestTime, usec); + INFO_PRINTF1(info); + + AssertTrueL(status.Int() == KErrNone, KUnexpectedErrCode, status.Int()); + + AssertTrueSecL(usec <= aMaxTimeLimit, KRequestMaxTimeErr); + AssertTrueSecL(usec >= aMinTimeLimit, KRequestMinTimeErr); + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp272::SetPeriodicUpdateL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp272::SetPeriodicUpdateL(const TInt& aUpdateInterval) + { + _LIT(KUpdateErr, "Error when setting update interval, %d"); + + TPositionUpdateOptions updateOptions; + updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(aUpdateInterval)); + TInt err = iPositioner.SetUpdateOptions(updateOptions); + AssertTrueL(err == KErrNone, KUpdateErr, err); + + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp274.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp274.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,88 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp274.h" + +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp274::CT_LbsClientPosTp274(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "Tp274-Disable PSY, Epos server crash (ESLI-649HQH)"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp274::~CT_LbsClientPosTp274() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp274::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp274::StartL() + { + ConnectL(); + + SetupPsyL(iUidMultiPsy); + + User::LeaveIfError(OpenPositionerByName(iUidMultiPsy)); + + RPositioner positioner; + User::LeaveIfError(positioner.Open(iPosServer, iUidMultiPsy)); + CleanupClosePushL(positioner); + + iPositioner.Close(); + + CPosModules* modulesDb = CPosModules::OpenL(); + CleanupStack::PushL(modulesDb); + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + moduleUpdate->SetUpdateAvailability(EFalse); + modulesDb->UpdateModuleL(iUidMultiPsy, *moduleUpdate); + CleanupStack::PopAndDestroy(2, modulesDb); + + CleanupStack::PopAndDestroy(&positioner); + + iPosServer.Close(); + + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp274::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp274::CloseTest() + { + iPositioner.Close(); + iPosServer.Close(); + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp275.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp275.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,75 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp275.h" +#include + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp275::CT_LbsClientPosTp275(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP275 - BackUpTest"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp275::~CT_LbsClientPosTp275() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp275::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp275::CloseTest() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp275::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp275::StartL() + { + /////////////////////////////// + CBaBackupSessionWrapper* backupWrapper = CBaBackupSessionWrapper::NewL(); + CleanupStack::PushL(backupWrapper); + TBackupOperationAttributes backStart(MBackupObserver::EReleaseLockReadOnly, + MBackupOperationObserver::EStart); + backupWrapper->NotifyBackupOperationL(backStart); + RPositionServer server; + CleanupClosePushL(server); + User::LeaveIfError(server.Connect()); + User::After(2000000); + + CleanupStack::PopAndDestroy(2, backupWrapper); + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4701.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4701.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,134 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp4701.h" +#include +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4701::CT_LbsClientPosTp4701(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP4701 - Default Proxy fallback-Active\\Ready Status1"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4701::~CT_LbsClientPosTp4701() + { + } + +// --------------------------------------------------------- +// CPosTp4701::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4701::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CPosTp4701::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4701::StartL() + { + ConnectL(); + + SetupProxyPSYsL(); + ResetDefaultPSYLastWorkingExtGPSPSYL(); + + User::After(4000000); + + TInt err = OpenPositioner(); + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueL(err == KErrNone, KOpenErr, err); + + _LIT(KServiceName, "TP4701"); + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KServiceName); + + ///////////////////////////////////////////// + // Request 1 + ///////////////////////////////////////////// + TInt request = 4701; + + TPositionInfo posInfo; + RequestL(posInfo, request, KEspectedErrorCodePSY1); + + VerifyPositionFromL(posInfo, iUidTestProxyPsy2); + VerifyRequestTimeLessThanL(8500000); + + // Default proxy fallbacks to testproxypsy2 + // because of time-shift,fix will + // be given by TestProxyPsy2 first. + VerifyPsyLoadedL(iUidTestProxyPsy1); + VerifyPsyLoadedL(iUidTestProxyPsy2); + + VerifyPositionL(posInfo, 10, 20, 30); + } + +// --------------------------------------------------------- +// CPosTp4701::SetupProxyPSYsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4701::SetupProxyPSYsL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + moduleUpdate->SetUpdateAvailability(EFalse); + + // Disable all PSY:s except PSYs used by this test case + CPosModuleIdList* prioList = db->ModuleIdListLC(); + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != iUidTestProxyPsy1 && + (*prioList)[i] != iUidTestProxyPsy2) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestProxyPsy1, *moduleUpdate); + db->UpdateModuleL(iUidTestProxyPsy2, *moduleUpdate); + + db->SetModulePriorityL(iUidTestProxyPsy1, 0); + db->SetModulePriorityL(iUidTestProxyPsy2, 1); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4702.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4702.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,131 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp4702.h" +#include +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4702::CT_LbsClientPosTp4702(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP4702 - Default Proxy fallback-Active\\Ready Status2"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4702::~CT_LbsClientPosTp4702() + { + } + +// --------------------------------------------------------- +// CPosTp4702::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4702::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CPosTp4702::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4702::StartL() + { + ConnectL(); + + SetupProxyPSYsL(); + + TInt err = OpenPositioner(); + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueL(err == KErrNone, KOpenErr, err); + + _LIT(KServiceName, "TP4702"); + iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); + + ///////////////////////////////////////////// + // Request 1 + ///////////////////////////////////////////// + TInt request = 4702; + TPositionInfo posInfo; + RequestL(posInfo, request, KEspectedErrorCodePSY1); + + VerifyPositionFromL(posInfo, iUidTestProxyPsy1); + VerifyRequestTimeLessThanL(7500000); + + /*Default proxy fallbacks to testproxypsy2 because of time-shift,fix will + be given by TestProxyPsy1 first.*/ + VerifyPsyLoadedL(iUidTestProxyPsy1); + VerifyPsyLoadedL(iUidTestProxyPsy2); + + VerifyPositionL(posInfo, 5, 15, 25); + } + +// --------------------------------------------------------- +// CPosTp4702::SetupProxyPSYsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4702::SetupProxyPSYsL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(EFalse); + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + // Disable all PSY:s except PSYs used by this test case + + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != iUidTestProxyPsy1 && + (*prioList)[i] != iUidTestProxyPsy2) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestProxyPsy1, *moduleUpdate); + db->UpdateModuleL(iUidTestProxyPsy2, *moduleUpdate); + + db->SetModulePriorityL(iUidTestProxyPsy1, 0); + db->SetModulePriorityL(iUidTestProxyPsy2, 1); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4703.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4703.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,132 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp4703.h" +#include +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4703::CT_LbsClientPosTp4703(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP4703 - Default Proxy fallback-other status1"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4703::~CT_LbsClientPosTp4703() + { + } + +// --------------------------------------------------------- +// CPosTp4703::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4703::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CPosTp4703::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4703::StartL() + { + ConnectL(); + + SetupProxyPSYsL(); + + TInt err = OpenPositioner(); + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueL(err == KErrNone, KOpenErr, err); + + _LIT(KServiceName, "TP4703"); + iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); + + // First request a pre position request + TInt request = 100; + TPositionInfo posInfo; + RequestL(posInfo, request, KEspectedErrorCodePSY1); + + ///////////////////////////////////////////// + // Request 1 + ///////////////////////////////////////////// + request = 4703; + RequestL(posInfo, request, KEspectedErrorCodePSY1); + + VerifyPositionFromL(posInfo, iUidTestProxyPsy2); + VerifyRequestTimeLessThanL(5001000); + + VerifyPositionL(posInfo, 10, 20, 30); + } + +// --------------------------------------------------------- +// CPosTp4703::SetupProxyPSYsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4703::SetupProxyPSYsL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(EFalse); + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + // Disable all PSY:s except PSYs used by this test case + + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != iUidTestProxyPsy1 && + (*prioList)[i] != iUidTestProxyPsy2) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestProxyPsy1, *moduleUpdate); + db->UpdateModuleL(iUidTestProxyPsy2, *moduleUpdate); + + db->SetModulePriorityL(iUidTestProxyPsy1, 0); + db->SetModulePriorityL(iUidTestProxyPsy2, 1); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// End of File + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4704.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4704.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,114 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp4704.h" +#include +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4704::CT_LbsClientPosTp4704(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP4704 - Default Proxy fallback-other status2"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4704::~CT_LbsClientPosTp4704() + { + } + +void CT_LbsClientPosTp4704::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +void CT_LbsClientPosTp4704::StartL() + { + ConnectL(); + + SetupProxyPSYsL(); + + TInt err = OpenPositioner(); + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueL(err == KErrNone, KOpenErr, err); + + _LIT(KServiceName, "TP4704"); + iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); + + // Requesting a pre position request + TInt request = 100; + TPositionInfo posInfo; + RequestL(posInfo, request, KEspectedErrorCodePSY1); + + ///////////////////////////////////////////// + // Request 1 + ///////////////////////////////////////////// + request = 4704; + RequestL(posInfo, request, KEspectedErrorCodePSY1); + + VerifyPositionFromL(posInfo, iUidTestProxyPsy1); + VerifyRequestTimeLessThanL(4001000); + + VerifyPositionL(posInfo, 5, 15, 25); + } + +void CT_LbsClientPosTp4704::SetupProxyPSYsL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(EFalse); + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + // Disable all PSY:s except PSYs used by this test case + + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != iUidTestProxyPsy1 && + (*prioList)[i] != iUidTestProxyPsy2) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestProxyPsy1, *moduleUpdate); + db->UpdateModuleL(iUidTestProxyPsy2, *moduleUpdate); + + db->SetModulePriorityL(iUidTestProxyPsy1, 0); + db->SetModulePriorityL(iUidTestProxyPsy2, 1); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// End of File + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4705.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4705.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,139 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp4705.h" +#include +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4705::CT_LbsClientPosTp4705(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP4705 - Default Proxy fallback-partial update1"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4705::~CT_LbsClientPosTp4705() + { + } + +// --------------------------------------------------------- +// CPosTp4705::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4705::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CPosTp4705::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4705::StartL() + { + ConnectL(); + + SetupProxyPSYsL(); + + TInt err = OpenPositioner(); + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueL(err == KErrNone, KOpenErr, err); + + _LIT(KServiceName, "TP4705"); + iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); + + ///////////////////////////////////////////// + // Request 1 + ///////////////////////////////////////////// + // Check that partial update is not supported + TPositionUpdateOptions updateOptions; + updateOptions.SetAcceptPartialUpdates(ETrue); + iPositioner.SetUpdateOptions(updateOptions); + + TInt request = 4705; + TPositionInfo posInfo; + RequestL(posInfo, request, KEspectedErrorCodePSY2); + + VerifyPositionFromL(posInfo, iUidTestPsyPartialUpdate); + VerifyRequestTimeLessThanL(8001000); + + /*Default proxy fallbacks to TestPsyPartialUpdate because of time-shift,partial + update will be given by TestPsyPartialUpdate.Request to TestProxyPsy1 + gets cancelled after cleanup time.*/ + VerifyPsyLoadedL(iUidTestProxyPsy1); + VerifyPsyLoadedL(iUidTestPsyPartialUpdate); + + VerifyPositionL(posInfo, 30, 40, 50); + } + +// --------------------------------------------------------- +// CPosTp4705::SetupProxyPSYsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4705::SetupProxyPSYsL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(EFalse); + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + // Disable all PSY:s except PSYs used by this test case + + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != iUidTestProxyPsy1 && + (*prioList)[i] != iUidTestPsyPartialUpdate) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestProxyPsy1, *moduleUpdate); + db->UpdateModuleL(iUidTestPsyPartialUpdate, *moduleUpdate); + + db->SetModulePriorityL(iUidTestProxyPsy1, 0); + db->SetModulePriorityL(iUidTestPsyPartialUpdate, 1); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// End of File + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4706.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4706.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,135 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp4706.h" +#include +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4706::CT_LbsClientPosTp4706(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP4706 - Default Proxy fallback-partial update2"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4706::~CT_LbsClientPosTp4706() + { + } + +// --------------------------------------------------------- +// CPosTp4706::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4706::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CPosTp4706::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4706::StartL() + { + ConnectL(); + + SetupProxyPSYsL(); + + TInt err = OpenPositioner(); + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueL(err == KErrNone, KOpenErr, err); + + _LIT(KServiceName, "TP4706"); + iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); + + // Issue a pre position request + TInt request=100; + TPositionInfo posInfo; + RequestL(posInfo, request, KEspectedErrorCodePSY1); + + ///////////////////////////////////////////// + // Request 1 + ///////////////////////////////////////////// + // Check that partial update is not supported + TPositionUpdateOptions updateOptions; + updateOptions.SetAcceptPartialUpdates(ETrue); + iPositioner.SetUpdateOptions(updateOptions); + + request = 4706; + RequestL(posInfo, request, KEspectedErrorCodePSY2); + + VerifyPositionFromL(posInfo, iUidPartialUpdate2); + VerifyRequestTimeLessThanL(5001000); + + VerifyPositionL(posInfo, 55, 65, 75); + } + +// --------------------------------------------------------- +// CPosTp4706::SetupProxyPSYsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4706::SetupProxyPSYsL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(EFalse); + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + // Disable all PSY:s except PSYs used by this test case + + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != iUidTestPsyPartialUpdate && + (*prioList)[i] != iUidPartialUpdate2) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestPsyPartialUpdate, *moduleUpdate); + db->UpdateModuleL(iUidPartialUpdate2, *moduleUpdate); + + db->SetModulePriorityL(iUidTestPsyPartialUpdate, 0); + db->SetModulePriorityL(iUidPartialUpdate2, 1); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4707.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4707.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,137 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp4707.h" +#include +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4707::CT_LbsClientPosTp4707(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP4707 - Default Proxy fallback-partial update3"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4707::~CT_LbsClientPosTp4707() + { + } + +// --------------------------------------------------------- +// CPosTp4707::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4707::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CPosTp4707::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4707::StartL() + { + ConnectL(); + + SetupProxyPSYsL(); + + TInt err = OpenPositioner(); + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueL(err == KErrNone, KOpenErr, err); + + _LIT(KServiceName, "TP4707"); + iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); + + // Issue a pre position request + TInt request = 100; + TPositionInfo posInfo; + RequestL(posInfo, request, KEspectedErrorCodePSY1); + + ///////////////////////////////////////////// + // Request 1 + ///////////////////////////////////////////// + // Check that partial update is not supported + TPositionUpdateOptions updateOptions; + updateOptions.SetAcceptPartialUpdates(ETrue); + iPositioner.SetUpdateOptions(updateOptions); + + request = 4707; + RequestL(posInfo, request, KEspectedErrorCodePSY2); + + VerifyPositionFromL(posInfo, iUidTestPsyPartialUpdate); + VerifyRequestTimeLessThanL(5001000); + + VerifyPositionL(posInfo, 30, 40, 50); + } + +// --------------------------------------------------------- +// CPosTp4707::SetupProxyPSYsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4707::SetupProxyPSYsL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(EFalse); + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + // Disable all PSY:s except PSYs used by this test case + + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != iUidTestProxyPsy1 && + (*prioList)[i] != iUidTestPsyPartialUpdate) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestProxyPsy1, *moduleUpdate); + db->UpdateModuleL(iUidTestPsyPartialUpdate, *moduleUpdate); + + db->SetModulePriorityL(iUidTestProxyPsy1, 0); + db->SetModulePriorityL(iUidTestPsyPartialUpdate, 1); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// End of File + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4708.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4708.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,144 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp4708.h" +#include +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4708::CT_LbsClientPosTp4708(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP4708 - Default Proxy-Configure time-shift values"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4708::~CT_LbsClientPosTp4708() + { + } + +// --------------------------------------------------------- +// CPosTp4708::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4708::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CPosTp4708::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4708::StartL() + { + ConnectL(); + + SetupProxyPSYsL(); + + TInt err = OpenPositioner(); + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueL(err == KErrNone, KOpenErr, err); + + _LIT(KServiceName, "TP4708"); + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KServiceName); + + ///////////////////////////////////////////// + // Request 1 + ///////////////////////////////////////////// + TInt request = 4708; + TPositionInfo posInfo; + RequestL(posInfo, request, KEspectedErrorCodePSY1); + + VerifyPositionFromL(posInfo, iUidTestProxyPsy2); + VerifyRequestTimeLessThanL(8000000); + + // Default proxy fallbacks to testproxypsy2 + // because of time-shift,fix will + // be given by TestProxyPsy2 first. + VerifyPsyLoadedL(iUidTestProxyPsy1); + VerifyPsyLoadedL(iUidTestProxyPsy2); + + VerifyPositionL(posInfo, 10, 20, 30); + + ///////////////////////////////////////////// + // Request 2 + ///////////////////////////////////////////// + request = 100; + RequestL(posInfo, request, KEspectedErrorCodePSY1); + + request = 4708; + RequestL(posInfo, request, KEspectedErrorCodePSY1); + + VerifyPositionFromL(posInfo, iUidTestProxyPsy2); + VerifyRequestTimeLessThanL(5001000); + + VerifyPositionL(posInfo, 10, 20, 30); + } + +// --------------------------------------------------------- +// CPosTp4708::SetupProxyPSYsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4708::SetupProxyPSYsL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + moduleUpdate->SetUpdateAvailability(EFalse); + + // Disable all PSY:s except PSYs used by this test case + CPosModuleIdList* prioList = db->ModuleIdListLC(); + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != iUidTestProxyPsy1 && + (*prioList)[i] != iUidTestProxyPsy2) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestProxyPsy1, *moduleUpdate); + db->UpdateModuleL(iUidTestProxyPsy2, *moduleUpdate); + + db->SetModulePriorityL(iUidTestProxyPsy1, 0); + db->SetModulePriorityL(iUidTestProxyPsy2, 1); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4709.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4709.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,138 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include +#include "ctlbsclientpostp4709.h" +#include +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4709::CT_LbsClientPosTp4709(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP4709 - Default Proxy-Configure Cleanup Timeout"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4709::~CT_LbsClientPosTp4709() + { + } + +// --------------------------------------------------------- +// CPosTp4709::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4709::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CPosTp4709::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4709::StartL() + { + ConnectL(); + + SetupProxyPSYsL(); + + TInt err = OpenPositioner(); + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueL(err == KErrNone, KOpenErr, err); + + _LIT(KServiceName, "TP4709"); + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KServiceName); + + ResetDefaultPSYLastWorkingExtGPSPSYL(); + + TInt request = 100; + TPositionInfo posInfo; + RequestL(posInfo, request, KEspectedErrorCodePSY1); + + ///////////////////////////////////////////// + // Request 1 + ///////////////////////////////////////////// + + // Check that partial update is not supported + // Check this with TP/TC document, Fredrik + // + TPositionUpdateOptions updateOptions; + updateOptions.SetAcceptPartialUpdates(ETrue); + TInt res = iPositioner.SetUpdateOptions(updateOptions); + User::LeaveIfError(res); + + request = 4709; + RequestL(posInfo, request, KEspectedErrorCodePSY2); + + VerifyPositionFromL(posInfo, iUidTestPsyPartialUpdate); + VerifyRequestTimeLessThanL(4400000); + + VerifyPositionL(posInfo, 30, 40, 50); + } + +// --------------------------------------------------------- +// CPosTp4709::SetupProxyPSYsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4709::SetupProxyPSYsL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + moduleUpdate->SetUpdateAvailability(EFalse); + + // Disable all PSY:s except PSYs used by this test case + CPosModuleIdList* prioList = db->ModuleIdListLC(); + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != iUidTestProxyPsy1 && + (*prioList)[i] != iUidTestPsyPartialUpdate) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidTestProxyPsy1, *moduleUpdate); + db->UpdateModuleL(iUidTestPsyPartialUpdate, *moduleUpdate); + + db->SetModulePriorityL(iUidTestProxyPsy1, 0); + db->SetModulePriorityL(iUidTestPsyPartialUpdate, 1); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4722.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4722.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,166 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp4722.h" +#include +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4722::CT_LbsClientPosTp4722(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP4722 - Default Proxy -Prefer working GPS PSY"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4722::~CT_LbsClientPosTp4722() + { + } + +// --------------------------------------------------------- +// CPosTp4722::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4722::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CPosTp4722::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4722::StartL() + { + ConnectL(); + + SetupProxyPSYsL(); + ResetDefaultPSYLastWorkingExtGPSPSYL(); + + TInt err = OpenPositioner(); + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueL(err == KErrNone, KOpenErr, err); + + _LIT(KServiceName, "TP4722"); + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KServiceName); + + TPositionSatelliteInfo posInfo; + + // Pre request + TInt request = 100; + RequestL(posInfo, request, KErrNone); + + ///////////////////////////////////////////// + // Request 1 + ///////////////////////////////////////////// + request = 4722; + RequestL(posInfo, request, KErrNone); + VerifyPositionFromL(posInfo, iUidSatInfoPsy); + VerifyRequestTimeLessThanL(4001000); + + VerifyPositionL(posInfo, 40, 50, 60); + + // Default PSY should pre-load SetInfo PSY since it is External and supports GPS + VerifyPsyLoadedL(iUidSatInfoPsy); + + ClosePositioner(); + Disconnect(); + + const TTimeIntervalMicroSeconds32 KPosWaitServerShutDown( 6000000 ); + User::After(KPosWaitServerShutDown); + + ConnectL(); + SetupProxyPSYsL(); + err = OpenPositioner(); + AssertTrueL(err == KErrNone, KOpenErr, err); + + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KServiceName); + + ///////////////////////////////////////////// + // Request 2 + ///////////////////////////////////////////// + RequestL(posInfo, request, KErrNone); + + VerifyPositionFromL(posInfo, iUidSatInfoPsy); + VerifyRequestTimeLessThanL(4001000); + + VerifyPositionL(posInfo, 40, 50, 60); + + // Default PSY won't pre-load Multi PSY since it is Internal + VerifyPsyUnloadedL(iUidMultiPsy); + // Default PSY should pre-load SetInfo PSY since it is External and supports GPS + VerifyPsyLoadedL(iUidSatInfoPsy); + } + +// --------------------------------------------------------- +// CPosTp4722::SetupProxyPSYsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4722::SetupProxyPSYsL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(EFalse); + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + // Disable all PSY:s except PSYs used by this test case + + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != iUidMultiPsy && + (*prioList)[i] != iUidSatInfoPsy) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidMultiPsy, *moduleUpdate); + db->UpdateModuleL(iUidSatInfoPsy, *moduleUpdate); + + db->SetModulePriorityL(iUidMultiPsy, 0); + db->SetModulePriorityL(iUidSatInfoPsy, 1); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// End of File + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4723.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp4723.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,144 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp4723.h" +#include +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4723::CT_LbsClientPosTp4723(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName, "TP4723 - Default Proxy -Configure working GPS PSY"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp4723::~CT_LbsClientPosTp4723() + { + } + +// --------------------------------------------------------- +// CPosTp4723::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4723::CloseTest() + { + ClosePositioner(); + Disconnect(); + } + +// --------------------------------------------------------- +// CPosTp4723::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4723::StartL() + { + ConnectL(); + SetupProxyPSYsL(); + + TPositionModuleId modId = iUidSatInfoPsy; + CRepository* repos = CRepository::NewL( KCRUidDefaultProxyConfiguration ); + TBuf<40> idBuf; + idBuf.AppendNumFixedWidth( modId.iUid, EHex, 8); + TInt error = repos->Set(KDefaultProxyLastWorkingGpsPsy, idBuf); + delete repos; + User::LeaveIfError(error); + + TInt err = OpenPositioner(); + _LIT(KOpenErr, "Error when opening positioner, %d"); + AssertTrueL(err == KErrNone, KOpenErr, err); + + _LIT(KServiceName, "TP4723"); + iPositioner.SetRequestor(CRequestor::ERequestorService, + CRequestor::EFormatApplication, KServiceName); + + TPositionSatelliteInfo posInfo; + // Request value should be 4722, even for TP4723... + TInt request = 4722; + + // Default PSY won't pre-load Multi PSY since it is Internal + VerifyPsyUnloadedL(iUidMultiPsy); + // Default PSY should pre-load SetInfo PSY since it is External and supports GPS + VerifyPsyLoadedL(iUidSatInfoPsy); + + ///////////////////////////////////////////// + // Request 1 + ///////////////////////////////////////////// + RequestL(posInfo, request, KEspectedErrorCodePSY1); + + VerifyPositionFromL(posInfo, iUidSatInfoPsy); + VerifyRequestTimeLessThanL(1200000); + + VerifyPsyLoadedL(iUidSatInfoPsy); + + VerifyPositionL(posInfo, 40, 50, 60); + } + +// --------------------------------------------------------- +// CPosTp4723::SetupProxyPSYsL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp4723::SetupProxyPSYsL() + { + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + + moduleUpdate->SetUpdateAvailability(EFalse); + + CPosModuleIdList* prioList = db->ModuleIdListLC(); + + // Disable all PSY:s except PSYs used by this test case + + for (TInt i = 0 ; i < prioList->Count(); i++) + { + if ((*prioList)[i] != iUidMultiPsy && + (*prioList)[i] != iUidSatInfoPsy) + { + db->UpdateModuleL((*prioList)[i], *moduleUpdate); + } + } + moduleUpdate->SetUpdateAvailability(ETrue); + db->UpdateModuleL(iUidMultiPsy, *moduleUpdate); + db->UpdateModuleL(iUidSatInfoPsy, *moduleUpdate); + + db->SetModulePriorityL(iUidMultiPsy, 0); + db->SetModulePriorityL(iUidSatInfoPsy, 1); + + CleanupStack::PopAndDestroy(prioList); + CleanupStack::PopAndDestroy(moduleUpdate); + CleanupStack::PopAndDestroy(db); + } + +// End of File + + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp76.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp76.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,261 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + + +// INCLUDES +#include "ctlbsclientpostp76.h" +#include +#include +#include +#include + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp76::CT_LbsClientPosTp76(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName,"TP76 - Get module data"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp76::~CT_LbsClientPosTp76() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp76::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp76::StartL() + { + // Open connection to Epos + RPositionServer posServer; + CleanupClosePushL(posServer); + TInt err = posServer.Connect(); + _LIT(KConnectError, "TP76. Unable to open connection to Epos, return code %d"); + AssertTrueSecL(err == KErrNone, KConnectError, err); + + // Set priority for those psys that will be used in this tp. + // The order will be testpsy1(externalgps),testpsy2,testpsy3 + TUid uidPsy1 = iUidTestPsy1; + TUid uidPsy2 = iUidTestPsy2; + TUid uidPsy3 = iUidTestPsy3; + + SetupPsyL(uidPsy1); // will disable all except uidPsy1 + + CPosModules* db = CPosModules::OpenL(); + CleanupStack::PushL(db); + + // Enable the PSY test psys + CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); + moduleUpdate -> SetUpdateAvailability(ETrue); + db->SetModulePriorityL(uidPsy1, 0); + db->SetModulePriorityL(uidPsy2, 1); + db->SetModulePriorityL(uidPsy3, 1); + db->UpdateModuleL(uidPsy1, *moduleUpdate); + db->UpdateModuleL(uidPsy2, *moduleUpdate); + db->UpdateModuleL(uidPsy3, *moduleUpdate); + CleanupStack::PopAndDestroy(moduleUpdate); + + // Setup the PSY:s in the correct order + CPosModuleIdList* prioList = db->ModuleIdListLC(); + TInt numModules = prioList->Count(); + TPositionModuleInfo modInfoPsy2; //used to comapre that the same result is returned. + db -> GetModuleInfoL(uidPsy2, modInfoPsy2); + CleanupStack::PopAndDestroy(2); // db, prioList + + // Get default positioning module info. (testpsy1 or externalgps) + TPositionModuleInfo modInfo; + TPositionModuleId defaultId; + err = posServer.GetDefaultModuleId(defaultId); + _LIT(KDefaultModuleId, "Not possible to get default module id"); + AssertTrueSecL(err == KErrNone, KDefaultModuleId, err); + // Check that the correct id was returned. + if (defaultId != uidPsy1) + { + _LIT(KErrorWrongModule, "Default module was not returned in GetDefaultModuleId()"); + LogErrorAndLeaveL(KErrorWrongModule); + } + + // Get default module info by using the id returned. + err = posServer.GetModuleInfoById(defaultId, modInfo); + _LIT(KGetDefPosModInfoError, + "TP76. Error occured at GetModuleInfoById, return code %d"); + AssertTrueSecL(err == KErrNone, KGetDefPosModInfoError, err); + // Check if the received psy is the right one + _LIT(KIncorrectPsyError, + "TP76. Incorrect PSY returned from Epos."); + AssertTrueL(uidPsy1 == modInfo.ModuleId(), KIncorrectPsyError); + /////END TEST DEFAULT///// + + ///////////////////////////////// + ///// TestGetModuleInfoById ///// + ///////////////////////////////// + + // Get info from specific psy (testpsy2) + _LIT(KGetPosModInfoError, "Wrong data received from Epos"); + err = posServer.GetModuleInfoById(uidPsy2, modInfo); + AssertTrueSecL(err == 0, KGetPosModInfoError, err); + AssertTrueL(modInfo.ModuleId() == uidPsy2, KGetPosModInfoError); + CheckModuleInfoL(modInfoPsy2, modInfo); + /////END TEST GetModuleInfoById///// + + ///////////////////////////////////// + ///// Test GetModuleInfoByIndex ///// + ///////////////////////////////////// + + // Get info from the testpsys (testpsy1, testpsy2, testpsy3) + TPositionModuleId id1; + TPositionModuleId id2; + TPositionModuleId id3; + TUint count; + err = posServer.GetNumModules(count); + _LIT(KNumPosModInfoError, + "TP76. Error occured at GetNumModules error code returned, return code %d"); + AssertTrueSecL(err == 0,KNumPosModInfoError,err); + _LIT(KIncorrectNoOfModules, + "TP76. Incorrect number of modules."); + TUint no = (TUint) numModules; //Bad API implementation + AssertTrueL(count == no, KIncorrectNoOfModules); + + err = posServer.GetModuleInfoByIndex(0, modInfo); + AssertTrueSecL(err == KErrNone, KGetDefPosModInfoError, err); + id1 = modInfo.ModuleId(); + if (!(id1 == uidPsy1 || + id1 == uidPsy2 || + id1 == uidPsy3)) + { + LogErrorAndLeaveL(KGetPosModInfoError); + } + + err = posServer.GetModuleInfoByIndex(1, modInfo); + AssertTrueSecL(err == 0, KGetDefPosModInfoError, err); + id2 = modInfo.ModuleId(); + if (!(id2 == uidPsy1 || + id2 == uidPsy2 || + id2 == uidPsy3)) + { + LogErrorAndLeaveL(KGetPosModInfoError); + } + + err = posServer.GetModuleInfoByIndex(2, modInfo); + AssertTrueSecL(err == 0, KGetDefPosModInfoError, err); + id3 = modInfo.ModuleId(); + if (!(id3 == uidPsy1 || + id3 == uidPsy2 || + id3 == uidPsy3)) + { + LogErrorAndLeaveL(KGetPosModInfoError); + } + + // Assuming that only 3 PSYs are installed + err = posServer.GetModuleInfoByIndex(3, modInfo); + AssertTrueSecL(err == 0, KGetDefPosModInfoError, err); + + ///// END TEST GetModuleInfoByIndex ///// + + CleanupStack::PopAndDestroy(); //posServer + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp76::CheckModuleInfoL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp76::CheckModuleInfoL(const TPositionModuleInfo& dbInfo, + const TPositionModuleInfo& clientInfo) + { + _LIT(KNotSame, "Module Info from settings is not the same as when read by GetModuleInfoById"); + if (dbInfo.IsAvailable() != clientInfo.IsAvailable() || + dbInfo.ModuleId() != clientInfo.ModuleId() || + dbInfo.DeviceLocation() != clientInfo.DeviceLocation() || + dbInfo.Capabilities() != clientInfo.Capabilities() || + dbInfo.TechnologyType() != clientInfo.TechnologyType() || + dbInfo.Version().iBuild != clientInfo.Version().iBuild || + dbInfo.Version().iMajor != clientInfo.Version().iMajor || + dbInfo.Version().iMinor != clientInfo.Version().iMinor || + dbInfo.Version().Name() != clientInfo.Version().Name() || + dbInfo.ClassesSupported(EPositionInfoFamily) != clientInfo.ClassesSupported(EPositionInfoFamily)) + { + LogErrorAndLeaveL(KNotSame); + } + TPositionQuality dbQuality; + TPositionQuality clientQuality; + dbInfo.GetPositionQuality(dbQuality); + clientInfo.GetPositionQuality(clientQuality); + if (dbQuality.TimeToFirstFix() != clientQuality.TimeToFirstFix() || + dbQuality.TimeToNextFix() != clientQuality.TimeToNextFix() || + dbQuality.HorizontalAccuracy() != clientQuality.HorizontalAccuracy() || + dbQuality.VerticalAccuracy() != clientQuality.VerticalAccuracy() || + dbQuality.CostIndicator() != clientQuality.CostIndicator() || + dbQuality.PowerConsumption() != clientQuality.PowerConsumption() ) + { + LogErrorAndLeaveL(KNotSame); + } + + + TBuf<30> name1; + TBuf<30> name2; + dbInfo.GetModuleName(name1); + clientInfo.GetModuleName(name2); + if (name1 != name2) + { + LogErrorAndLeaveL(KNotSame); + } + } + + +// --------------------------------------------------------- +// CT_LbsClientPosTp76::AssertTrueL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp76::AssertTrueL(TBool aCondition, const TDesC& aErrorMsg) + { + if (!aCondition) + { + LogErrorAndLeaveL(aErrorMsg); + } + } + + +// --------------------------------------------------------- +// CT_LbsClientPosTp76::AssertTrueSecL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp76::AssertTrueSecL(TBool aCondition, const TDesC& aErrorMsg, TInt aErrorCode) + { + if (!aCondition) + { + TBuf<100> buf; + buf.Format(aErrorMsg, aErrorCode); + LogErrorAndLeaveL(buf); + } + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp93.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp93.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,229 @@ +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +// INCLUDES +#include "ctlbsclientpostp93.h" +#include "ctlbsclientperiodictester.h" + +// CONSTANTS +_LIT(KServiceName1, " aaaaaaaaaaa"); +_LIT(KServiceName2, " bbbbbbbbbbb"); +_LIT(KServiceName3, " ccccccccccc"); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor. +// --------------------------------------------------------- +CT_LbsClientPosTp93::CT_LbsClientPosTp93(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) + { + _LIT(KTestName,"TP93 - Periodic Updates, Multiple clients"); + SetTestStepName(KTestName); + } + +// --------------------------------------------------------- +// Destructor. +// --------------------------------------------------------- +CT_LbsClientPosTp93::~CT_LbsClientPosTp93() + { + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp93::CloseTest +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp93::CloseTest() + { + iRequestArray.Reset(); + iNameArray.Reset(); + iRequestArray.Close(); + iNameArray.Close(); + + } + +// --------------------------------------------------------- +// CT_LbsClientPosTp93::StartL +// +// (other items were commented in a header). +// --------------------------------------------------------- +// +void CT_LbsClientPosTp93::StartL() + { + SetupPsyL(iUidMultiPsy); + + TPtrC name1(KServiceName1); + TPtrC name2(KServiceName2); + TPtrC name3(KServiceName3); + + iNameArray.Append(name1); + iNameArray.Append(name2); + iNameArray.Append(name3); + + TInt numberOfRuns = 25; + TTimeIntervalMicroSeconds interval1 = TTimeIntervalMicroSeconds(1000000); + TTimeIntervalMicroSeconds interval3 = TTimeIntervalMicroSeconds(3000000); + TTimeIntervalMicroSeconds interval5 = TTimeIntervalMicroSeconds(5000000); + TTimeIntervalMicroSeconds interval11 = TTimeIntervalMicroSeconds(11000000); + TTimeIntervalMicroSeconds interval13 = TTimeIntervalMicroSeconds(13000000); + TTimeIntervalMicroSeconds interval17 = TTimeIntervalMicroSeconds(17000000); + + + TUid uid = iUidMultiPsy; + TInt errorsFound = KErrNone; + + CT_LbsClientPeriodicTester* periodicTester1 = + CT_LbsClientPeriodicTester::NewL(interval1, + KServiceName1, + iLog, + uid, + numberOfRuns); + CleanupStack::PushL(periodicTester1); + + CT_LbsClientPeriodicTester* periodicTester2 = + CT_LbsClientPeriodicTester::NewL(interval3, + KServiceName2, + iLog, + uid, + numberOfRuns); + CleanupStack::PushL(periodicTester2); + + CT_LbsClientPeriodicTester* periodicTester3 = + CT_LbsClientPeriodicTester::NewL(interval5, + KServiceName3, + iLog, + uid, + numberOfRuns); + CleanupStack::PushL(periodicTester3); + + periodicTester1->RequestNotification(); + periodicTester2->RequestNotification(); + periodicTester3->RequestNotification(); + + // Active scheduler is stopped three times. + CActiveScheduler::Start(); + CActiveScheduler::Start(); + CActiveScheduler::Start(); + + if (!periodicTester1->IsCompletedOK() || + !periodicTester2->IsCompletedOK() || + !periodicTester3->IsCompletedOK()) + { + _LIT(KErr, "ERROR: periodicTester1-3 returned error"); + INFO_PRINTF1(KErr); + errorsFound++; + } + + CleanupStack::PopAndDestroy(3, periodicTester1); + + CT_LbsClientPeriodicTester* periodicTester4 = + CT_LbsClientPeriodicTester::NewL(interval3, + KServiceName1, + iLog, + uid, + numberOfRuns); + CleanupStack::PushL(periodicTester4); + + CT_LbsClientPeriodicTester* periodicTester5 = + CT_LbsClientPeriodicTester::NewL(interval3, + KServiceName2, + iLog, + uid, + numberOfRuns); + CleanupStack::PushL(periodicTester5); + + CT_LbsClientPeriodicTester* periodicTester6 = + CT_LbsClientPeriodicTester::NewL(interval3, + KServiceName3, + iLog, + uid, + numberOfRuns); + CleanupStack::PushL(periodicTester6); + + periodicTester4->RequestNotification(); + periodicTester5->RequestNotification(); + periodicTester6->RequestNotification(); + + // Active scheduler is stopped three times. + CActiveScheduler::Start(); + CActiveScheduler::Start(); + CActiveScheduler::Start(); + + if (!periodicTester4->IsCompletedOK() || + !periodicTester5->IsCompletedOK() || + !periodicTester6->IsCompletedOK()) + { + _LIT(KErr, "ERROR: periodicTester4-6 returned error"); + INFO_PRINTF1(KErr); + errorsFound++; + } + + CleanupStack::PopAndDestroy(3, periodicTester4); + + CT_LbsClientPeriodicTester* periodicTester7 = + CT_LbsClientPeriodicTester::NewL(interval11, + KServiceName1, + iLog, + uid, + numberOfRuns); + CleanupStack::PushL(periodicTester7); + + CT_LbsClientPeriodicTester* periodicTester8 = + CT_LbsClientPeriodicTester::NewL(interval13, + KServiceName2, + iLog, + uid, + numberOfRuns); + CleanupStack::PushL(periodicTester8); + + CT_LbsClientPeriodicTester* periodicTester9 = + CT_LbsClientPeriodicTester::NewL(interval17, + KServiceName3, + iLog, + uid, + numberOfRuns); + CleanupStack::PushL(periodicTester9); + + periodicTester7->RequestNotification(); + periodicTester8->RequestNotification(); + periodicTester9->RequestNotification(); + + // Active scheduler is stopped three times. + CActiveScheduler::Start(); + CActiveScheduler::Start(); + CActiveScheduler::Start(); + + if (!periodicTester7->IsCompletedOK() || + !periodicTester8->IsCompletedOK() || + !periodicTester9->IsCompletedOK()) + { + _LIT(KErr, "ERROR : periodicTester7-9 returned error"); + INFO_PRINTF1(KErr); + errorsFound++; + } + + CleanupStack::PopAndDestroy(3, periodicTester7); + + if (errorsFound != KErrNone) + { + _LIT(KErr, "Errors returned from some periodicTester"); + LogErrorAndLeaveL(KErr); + } + } + +// End of File diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientserver.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,281 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsClientServer.cpp +// This is the class implementation for the LBS Client Test Server +// +// + +// User includes +#include "ctlbsclientserver.h" + +// System includes +#include +#include + +// Header files of LBS Client API Test Steps +#include "ctlbsstepconfighybridmodule.h" +#include "ctlbsclientstepsrvconnectclose.h" +#include "ctlbsclientstepnotifyposupdate.h" +#include "ctlbsclientstepcellbasednpud.h" +#include "ctlbsclientstepopenclose.h" +#include "ctlbsclientstepsrvversion.h" +#include "ctlbsclientstepmodselect.h" +#include "ctlbsclientstepmodinfo.h" +#include "ctlbsclientsteplastknownpos.h" +#include "ctlbsclientstepmultireq.h" +#include "ctlbsclientstepmodstatus.h" +#include "ctlbsclientstepupdateoptions.h" +#include "ctlbsclientstepassistance.h" +#include "ctlbsclientsteppartialupdate.h" +#include "ctlbsclientsteptracking.h" +#include "ctlbsclientstepignoreaccurracysetting.h" +#include "ctlbsclientstepignoreaccurracysettingtracking.h" +#include "ctlbsclientstep_reset_assistance.h" + +/** + MainL() + Description : This is the main function which installs the + active scheduler and creates an object of the Email server + @internalTechnology + @param none + @return none + @pre None + @post None +*/ +LOCAL_C void MainL() + { + __UHEAP_MARK; + CActiveScheduler* sched = new (ELeave) CActiveScheduler; + CleanupStack::PushL(sched); + CActiveScheduler::Install(sched); + + __UHEAP_MARK; + // this registers the server with the active scheduler and calls SetActive + CT_LbsClientServer* server = CT_LbsClientServer::NewL(); + + // signal to the client that we are ready by + // rendevousing process + RProcess::Rendezvous(KErrNone); + + // run the active scheduler + sched->Start(); + + // clean up + delete server; + + __UHEAP_MARKEND; + + CleanupStack::PopAndDestroy(sched); + __UHEAP_MARKEND; + } + + + + +/** + E32Main() + Description : It is the entry point + @internalTechnology + @param none + @return Returns the error code + @pre None + @post None +*/ +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + if(cleanup == NULL) + { + return KErrNoMemory; + } + + TRAPD(err, MainL()); + + delete cleanup; + __UHEAP_MARKEND; + + return err; + } + + + +/** + NewL() + Constructs a CT_LbsClientServer object. + Uses two phase construction and leaves nothing on the CleanupStack. + @internalTechnology + @param none + @return Created object of type CT_LbsClientServer + @pre None + @post None +*/ +CT_LbsClientServer* CT_LbsClientServer::NewL() + { + CT_LbsClientServer*server = new(ELeave) CT_LbsClientServer(); + CleanupStack::PushL(server); + server->ConstructL(KLbsClientTestServer); + CleanupStack::Pop(server); + return server; + } + + +CT_LbsClientServer::~CT_LbsClientServer() + { + // DELETE EVERYTHIGN THAT IS ALLOCATED IN THE ConstructL(!) + delete iSharedData; + iSharedData = NULL; + } + + +/** + Function : CT_LbsClientServer + Description : Constructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +CT_LbsClientServer::CT_LbsClientServer() + { + } + +/** + Function : ConstructL + Description : + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +void CT_LbsClientServer::ConstructL(const TDesC& aName) + { + CT_LbsServer::ConstructL(aName); + + iSharedData = CT_LbsSharedData::NewL(); + } + + +/** + Function : CreateTestStep + Description : Creates a test step based on the step name read from the script file + @internalTechnology + @param : aStepName The step name which needs to be created + @return : Created object of type CTestStep + @precondition : none + @postcondition : none +*/ +CTestStep* CT_LbsClientServer::CreateTestStep(const TDesC& aStepName) + { + // NULL if insufficient memory. This suits the API. + + // Test case test steps, each test step supports one or more test cases. + if(aStepName == KLbsStep_ConfigHybridModule) + { + return CT_LbsStep_ConfigHybridModule::New(*this); + } + + if(aStepName == KLbsClientStep_SrvConnectClose) + { + return CT_LbsClientStep_SrvConnectClose::New(*this); + } + + if(aStepName == KLbsClientStep_OpenClose) + { + return CT_LbsClientStep_OpenClose::New(*this); + } + + if(aStepName == KLbsClientStep_SrvVersion) + { + return CT_LbsClientStep_SrvVersion::New(*this); + } + + if(aStepName == KLbsClientStep_NotifyPosUpdate) + { + return CT_LbsClientStep_NotifyPosUpdate::New(*this); + } + + if(aStepName == KLbsClientStep_CellBasedNotifyPosUpdate) + { + return CT_LbsClientStep_CellBasedNotifyPosUpdate::New(*this); + } + + if(aStepName == KLbsClientStep_ModSelect) + { + return CT_LbsClientStep_ModSelect::New(*this); + } + + if(aStepName == KLbsClientStep_ModInfo) + { + return CT_LbsClientStep_ModInfo::New(*this); + } + + if(aStepName == KLbsClientStep_LastKnownPos) + { + return CT_LbsClientStep_LastKnownPos::New(*this); + } + + if(aStepName == KLbsClientStep_MultiReq) + { + return CT_LbsClientStep_MultiReq::New(*this); + } + + if(aStepName == KLbsClientStep_ModStatus) + { + return CT_LbsClientStep_ModStat::New(*this); + } + + if(aStepName == KLbsClientStep_UpdateOptions) + { + return CT_LbsClientStep_UpdateOptions::New(*this); + } + + if(aStepName == KLbsClientStep_Assistance) + { + return CT_LbsClientStep_Assistance::New(*this); + } + + if(aStepName == KLbsClientStep_PartialUpdate) + { + return CT_LbsClientStep_PartialUpdate::New(*this); + } + if(aStepName == KLbsClientStep_IgnoreAccuracySetting) + { + return CT_LbsClientStep_IgnoreAccuracySetting::New(*this); + } + if(aStepName == KLbsClientStep_IgnoreAccuracySettingTracking) + { + return CT_LbsClientStep_IgnoreAccuracySettingTracking::New(*this); + } + + if (aStepName == KLbsClientStep_Tracking) + { + return CT_LbsClientStep_Tracking::New(*this); + } + + if (aStepName == KLbsClientStep_Tracking) + { + return CT_LbsClientStep_Tracking::New(*this); + } + + if (aStepName == KLbsClientStep_ResetAssistance) + { + return CT_LbsClientStep_ResetAssistance::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 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientshareddata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientshareddata.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,89 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsClientSharedData.cpp +// This file contains the shared data class for the Lbs Client Test server +// +// + + +#include "ctlbsclientshareddata.h" + + +/** + Function : NewL + Description : Constructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +CT_LbsClientSharedData* CT_LbsClientSharedData::NewL() + { + CT_LbsClientSharedData* sharedData=new(ELeave) CT_LbsClientSharedData(); + CleanupStack::PushL(sharedData); + sharedData->ConstructL(); + CleanupStack::Pop(sharedData); + + return sharedData; + } + + +/** + Function : ConstructL + Description : Constructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +void CT_LbsClientSharedData::ConstructL() + { + } + + +/** + Function : CT_LbsClientSharedData + Description : Constructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +CT_LbsClientSharedData::CT_LbsClientSharedData() + { + } + +/** + Function : ~CT_LbsClientSharedData + Description : Destructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +CT_LbsClientSharedData::~CT_LbsClientSharedData() + { + // Clear arrays. + for (TInt i = 0; i < iVerifyPosInfoArr.Count(); ++i) + delete iVerifyPosInfoArr[i]; + iVerifyPosInfoArr.Close(); + + for (TInt i = 0; i < iCurrentPosInfoArr.Count(); ++i) + delete iCurrentPosInfoArr[i]; + iCurrentPosInfoArr.Close(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstep.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstep.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,202 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsClientStep.cpp +// This is the class implementation for the LBS Client Test Step Base +// +// + +#include "ctlbsclientstep.h" + +#include "tlbsutils.h" +#include "ctlbsasyncwaiter.h" + + +#define REFPOS_LAT 52.2 +#define REFPOS_LONG 0.2 +#define REFPOS_ALT 10 +#define REFPOS_HORZ_ACCURACY 100 +#define REFPOS_VERT_ACCURACY 100 + +/** + * @return - TVerdict + * Implementation of CTestStep base class virtual + * It is used for doing all initialisation common to derived classes in here. + * Make it being able to leave if there are any errors here as there's no point in + * trying to run a test step if anything fails. + * The leave will be picked up by the framework. + */ +TVerdict CT_LbsClientStep::doTestStepPreambleL() + { + // Process some common pre setting to test steps then set SetTestStepResult to EFail or Epass. + INFO_PRINTF1(_L(">>CT_LbsClientStep::doTestStepPreambleL()")); + SetTestStepResult(EPass); + + return TestStepResult(); + } + + +/** + * @return - TVerdict + * Implementation of CTestStep base class virtual + * It is used for doing all after test treatment common to derived classes in here. + * Make it being able to leave + * The leave will be picked up by the framework. + */ +TVerdict CT_LbsClientStep::doTestStepPostambleL() + { + // Process some common post setting to test steps then set SetTestStepResult to EFail or Epass. + INFO_PRINTF1(_L(">>CT_LbsClientStep::doTestStepPostabmleL()")); + + //SetTestStepResult(EPass); // or EFail + return TestStepResult(); + } + + +CT_LbsClientStep::~CT_LbsClientStep() + { + } + + +CT_LbsClientStep::CT_LbsClientStep(CT_LbsClientServer& aParent) : iParent(aParent) + { + } + + +TInt CT_LbsClientStep::DoNotifyUpdateL(TPositionInfoBase& aPosInfo) +{ + return GetLocationL(aPosInfo, EDoNotifyPosUpdate); +} + +TInt CT_LbsClientStep::DoLastKnownPosL(TPositionInfoBase& aPosInfo) +{ + return GetLocationL(aPosInfo, EDoLastKnownPos); +} + + +TInt CT_LbsClientStep::GetLocationL(TPositionInfoBase& aPosInfo, TUint32 aNotifyCallType) +{ + // Use wrapper active object for the async call below. + CT_LbsAsyncWaiter* waiter = CT_LbsAsyncWaiter::NewL(); + CleanupStack::PushL(waiter); + + // Set requestor, note we use the same values as DUMMY_REQUESTOR so we don't have + // to include the header file from the test server, to keep code generic when test pos server goes. + + // TODO: NOTE for the new server, there is no requirement to SetRequestor so we can + // remove later. + User::LeaveIfError(iPositioner.SetRequestor( CRequestor::ERequestorService, + CRequestor::EFormatApplication, + _L("Tom Tom"))); + + // Determine the position function to call and get the actual position + if (EDoNotifyPosUpdate == aNotifyCallType) + { + iPositioner.NotifyPositionUpdate(aPosInfo, waiter->iStatus); + } + else if (EDoLastKnownPos == aNotifyCallType) + { + iPositioner.GetLastKnownPosition(aPosInfo, waiter->iStatus); + } + + else + User::LeaveIfError(KErrArgument); + + // Wait for and process the result. + waiter->StartAndWait(); + + TInt err = waiter->Result(); + if (KErrNone == err) + { + INFO_PRINTF1(_L("position obtained successfully")); + + const TPositionInfo& posInfo = reinterpret_cast(aPosInfo); + + + TPosition pos; + posInfo.GetPosition(pos); + TReal32 lat = pos.Latitude(); + TReal32 lng = pos.Longitude(); + TReal32 hac = pos.HorizontalAccuracy(); + TReal vac = pos.VerticalAccuracy(); + + INFO_PRINTF2(_L("lat: %f"),lat); + INFO_PRINTF2(_L("lng: %f"),lng); + INFO_PRINTF2(_L("hac: %f"),hac); + INFO_PRINTF2(_L("vac: %f"),vac); + + } + else + { + INFO_PRINTF2(_L("position update failed with error %d"), err); + } + + CleanupStack::PopAndDestroy(waiter); + + return err; +} + + + +TInt CT_LbsClientStep::OpenNetSim() + { + // Connect to net sim. + TInt err = iNetSim.ConnectL(NULL); + if (err) + { + return err; + } + + + // Set the reference position, which also be used for any required verification. + iRefPos.SetCoordinate(REFPOS_LAT, REFPOS_LONG, REFPOS_ALT); + iRefPos.SetAccuracy(REFPOS_HORZ_ACCURACY, REFPOS_VERT_ACCURACY); + iRefPos.SetCurrentTime(); + + if (!iNetSim.SetReferenceLocation(iRefPos)) + { + iNetSim.Close(); + + return KErrGeneral; + } + + + // Set plugin to use. + TUid pluginUid; + if(iParent.iSharedData->iTestModuleInUse) + { + pluginUid = TUid::Uid(KSimpleAssistanceDataProviderPluginUidValue); + } + else + { + pluginUid = TUid::Uid(KSuplAssistanceDataProviderPluginUidValue); + } + if (!iNetSim.SetAssistanceDataProvider(pluginUid)) + { + iNetSim.Close(); + + return KErrGeneral; + } + + return err; + } + +void CT_LbsClientStep::SendResetAssistanceData(TLbsAssistanceDataGroup aMask) + { + iNetSim.SendResetAssistanceData(aMask); + } + +void CT_LbsClientStep::CloseNetSim() + { + iNetSim.Close(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstep_reset_assistance.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstep_reset_assistance.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,258 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This is the class implementation for the Notify Position Update Tests +// +// + +#include "ctlbsclientstep_reset_assistance.h" + +#include +#include + +#include "tlbsutils.h" +#include "ctlbsasyncwaiter.h" + + +const TTimeIntervalMicroSeconds KModuleTimeout = 6000000;//makes test module time out(which should be more than the Maxtime in lbsprofile.ini) + +const TInt KNumberOfRequests = 10; // the number of requests to do to be near the average + +const TInt KWaitTimeForCoolDown = 10 * 1000 * 1000; // how long to wait to make sure the integration module gets turned off + +/** + * Sets a Requestor for now - TODO will be removed with new location server + */ +void CT_LbsClientStep_ResetAssistance::TempSetRequestorL() + { + User::LeaveIfError(iPositioner.SetRequestor( CRequestor::ERequestorService, + CRequestor::EFormatApplication, + _L("Tom Tom"))); + } + + +/** + * Destructor + */ +CT_LbsClientStep_ResetAssistance::~CT_LbsClientStep_ResetAssistance() + { + delete iLbsAdmin; + } + + +/** + * Constructor + */ +CT_LbsClientStep_ResetAssistance::CT_LbsClientStep_ResetAssistance(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent),iLbsAdmin(NULL),iRequestedAssData(FALSE), iReceivedAssData(FALSE) + { + + SetTestStepName(KLbsClientStep_ResetAssistance); + } + + +/** +Static Constructor +*/ +CT_LbsClientStep_ResetAssistance* CT_LbsClientStep_ResetAssistance::New(CT_LbsClientServer& aParent) + { + + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + + CT_LbsClientStep_ResetAssistance* testStep = new CT_LbsClientStep_ResetAssistance(aParent); + if (testStep) + { + TInt err = KErrNone; + + TRAP(err, testStep->ConstructL()); + if (err) + { + delete testStep; + testStep = NULL; + } + } + return testStep; + } + + +void CT_LbsClientStep_ResetAssistance::ConstructL() + { + // create the admin + iLbsAdmin = CLbsAdmin::NewL(); + + } + +//from MT_NotifyPosUpdateObserver: +/** + * Callback - called when NotifyPositionUpdate request completes + */ + +void CT_LbsClientStep_ResetAssistance::NotifyPositionUpdateCallback(TRequestStatus& aStatus) + { + TInt err = aStatus.Int(); + if (KErrCancel != err) + { + SetTestStepResult(EFail); // the request always gets cancelled (see test 0122) + } + CActiveScheduler::Stop(); + } + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_ResetAssistance::doTestStepL() + { + // Generic test step used to test the LBS Client Notify position update API. + INFO_PRINTF1(_L(">>CT_LbsClientStep_ResetAssistance::doTestStepL()")); + + if (TestStepResult()==EPass) + { + TInt err = KErrNone; + + iParent.iSharedData->iTestModuleInUse = EFalse; + + // Connect to self locate server. + err = iServer.Connect(); + User::LeaveIfError(err); + CleanupClosePushL(iServer); + + // Setup netsim. + User::LeaveIfError(OpenNetSim()); + + TTimeIntervalMicroSeconds resetRequestTime; + resetRequestTime = DoRequests(EFalse, ETrue); + INFO_PRINTF2(_L("Requests from warm with reset assistance data took on average %d miliseconds to complete."), (resetRequestTime.Int64()/KNumberOfRequests)/1000); + + + TTimeIntervalMicroSeconds coldRequestTime; + coldRequestTime = DoRequests(ETrue, EFalse); + INFO_PRINTF2(_L("Requests from cold took on average %d miliseconds to complete."), (coldRequestTime.Int64()/KNumberOfRequests)/1000); + + TTimeIntervalMicroSeconds warmRequestTime; + warmRequestTime = DoRequests(EFalse, EFalse); + INFO_PRINTF2(_L("Requests from warm took on average %d miliseconds to complete."), (warmRequestTime.Int64()/KNumberOfRequests)/1000); + + INFO_PRINTF2(_L("Requests from warm with reset assistance data took on average %d miliseconds to complete."), (resetRequestTime.Int64()/KNumberOfRequests)/1000); + INFO_PRINTF2(_L("Requests from cold took on average %d miliseconds to complete."), (coldRequestTime.Int64()/KNumberOfRequests)/1000); +/* if(warmRequestTime >= resetRequestTime/2 || resetRequestTime < (coldRequestTime*3)/4) + { + INFO_PRINTF1(_L("Reseting assistance data didn't fit into the right time frame")); + SetTestStepResult(EFail); + } +*/ + CloseNetSim(); + + // All done, clean up. + CleanupStack::PopAndDestroy(&iServer); + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_ResetAssistance::doTestStepL()")); + + return TestStepResult(); + } + +TInt64 CT_LbsClientStep_ResetAssistance::DoRequests(TBool aCold, TBool aReset) + { + if(!aCold) + { + // *** Warming up module + // Open positioner. + TInt err = iPositioner.Open(iServer); + User::LeaveIfError(err); + CleanupClosePushL(iPositioner); + + // Request notify for the expected reference position. + TPositionInfo actualRefPosInfo; + err = DoNotifyUpdateL(actualRefPosInfo); + if (KErrNone != err) + { + INFO_PRINTF2(_L("Failed test, reference position request returned err %d."), err); + SetTestStepResult(EFail); + } + + TPositionInfo posInfo; + // Get the actual position + err = DoNotifyUpdateL(posInfo); + if (KErrNone != err) + { + INFO_PRINTF2(_L("Failed test, position request returned err %d."), err); + SetTestStepResult(EFail); + } + } + + TTimeIntervalMicroSeconds requestTime; + requestTime = 0; + // *** Doing the repeated requests with reset assistance data in between if it's requested so + for(TInt count = 0; count < KNumberOfRequests; ++count) + { + if(aReset) + { + SendResetAssistanceData(0xFFFFFFFF); + } + + if(aCold) + { + // Open positioner. + TInt err = iPositioner.Open(iServer); + User::LeaveIfError(err); + CleanupClosePushL(iPositioner); + } + + TTime startTime; + startTime.UniversalTime(); // start the clock + + if(aCold) + { + // Request notify for the expected reference position. + TPositionInfo actualRefPosInfo; + TInt err = DoNotifyUpdateL(actualRefPosInfo); + if (KErrNone != err) + { + INFO_PRINTF2(_L("Failed test, reference position request returned err %d."), err); + SetTestStepResult(EFail); + } + } + TPositionInfo posInfo; + // Get the actual position + TInt err = DoNotifyUpdateL(posInfo); + if (KErrNone != err) + { + INFO_PRINTF2(_L("Failed test, position request returned err %d."), err); + SetTestStepResult(EFail); + } + + TTime endTime; + endTime.UniversalTime(); // stop the clock + TTimeIntervalMicroSeconds interval; + interval = endTime.MicroSecondsFrom(startTime); + INFO_PRINTF2(_L("Request took %d microseconds to complete."), interval.Int64()); + requestTime = requestTime.Int64() + interval.Int64(); + + if(aCold) + { + CleanupStack::PopAndDestroy(&iPositioner); + User::After(KWaitTimeForCoolDown); + } + } + + if(!aCold) + { + // Cleanup. + CleanupStack::PopAndDestroy(&iPositioner); + User::After(KWaitTimeForCoolDown); + } + return requestTime.Int64(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepassistance.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepassistance.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,432 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_LbsClientStepAssistance.cpp +// This is the class implementation for the LBS Client Step Assistance +// +// + +//LBS includes. +#include +#include +#include + +// LBS test includes. +#include "ctlbsclientstepassistance.h" +#include "tlbsutils.h" + + +const TInt KAssistanceDataProviderPluginUidValue = 0x1028225B; + + +/** +Static Constructor +*/ +CT_LbsClientStep_Assistance* CT_LbsClientStep_Assistance::New(CT_LbsClientServer& aParent) + { + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + CT_LbsClientStep_Assistance* testStep = new CT_LbsClientStep_Assistance(aParent); + if (testStep) + { + TInt err = KErrNone; + + TRAP(err, testStep->ConstructL()); + if (err) + { + delete testStep; + testStep = NULL; + } + } + return testStep; + } + +/** + * Constructor + */ +CT_LbsClientStep_Assistance::CT_LbsClientStep_Assistance(CT_LbsClientServer& aParent) : CT_LbsNetSimStep(), iParent(aParent),iLbsAdmin(NULL) + { + SetTestStepName(KLbsClientStep_Assistance); + } + + +void CT_LbsClientStep_Assistance::ConstructL() + { + // Create the base class objects. + CT_LbsNetSimStep::ConstructL(); + + // and the active object wrapper for the notify position update. + iDoPosUpdate = CT_LbsDoPosUpdate::NewL(this); + + // create the admin + iLbsAdmin = CLbsAdmin::NewL(); + } + +/** + * Destructor + */ +CT_LbsClientStep_Assistance::~CT_LbsClientStep_Assistance() + { + delete iLbsAdmin; + + iDoPosUpdate->Cancel(); + delete iDoPosUpdate; + + } + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_Assistance::doTestStepL() + { + // Generic test step used to test the LBS Client Notify position update API with assistant data. + INFO_PRINTF1(_L(">> CT_LbsClientStep_Assistance::doTestStepL()")); + + if (TestStepResult() == EPass) + { + + // Expected callbacks flags, most test steps require MO-LR. + iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | // Net Sim callback events. + KLbsCallback_MoLr | + KLbsCallback_Got_NotifyUpdate; // notifypositionupdate completed. + + // Carry out unique test actions. + if (GetIntFromConfig(ConfigSection(), KTestCaseId, iTestCaseId)) + { + switch (iTestCaseId) + { + + case 16: + { + + // Set 'assisted-if-possible' (EGpsPreferTerminalBased) mode + + CLbsAdmin::TGpsMode mode; + + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsPreferTerminalBased)); + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingHomeGpsMode, mode)); + + if(mode != CLbsAdmin::EGpsPreferTerminalBased) + { + SetTestStepResult(EFail); + } + + } + break; + + + case 18: + { + + + // Set 'assisted-if-possible' (EGpsPreferTerminalBased) mode + + CLbsAdmin::TGpsMode mode; + + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsPreferTerminalBased)); + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingHomeGpsMode, mode)); + + if(mode != CLbsAdmin::EGpsPreferTerminalBased) + { + SetTestStepResult(EFail); + } + } + break; + + // Test case LBS-NotifyPosUpdate-0020 + case 20: + { + + // Set 'assisted-if-possible' (EGpsPreferTerminalBased) mode + + CLbsAdmin::TGpsMode mode; + + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsPreferTerminalBased)); + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingHomeGpsMode, mode)); + // TO DO - ideally we should wait for the admin callback for this change here instead of pausing: + User::After(5000000); + if(mode != CLbsAdmin::EGpsPreferTerminalBased) + { + SetTestStepResult(EFail); + } + } + break; + + default: + { + User::Panic(KLbsClientStep_Assistance, KErrUnknown); + } + } + } + + + // Inform the test module of the required test mode - will block. + + // TODO remove modDataIn stuff all of it +// utils.NotifyModuleOfConfigChangeL(modDataIn); + + // Connect to net sim. + + iNetSim.ConnectL(/*(MLbsNetSimTestObserver*)*/this); + + // Setup net sim's assistance data. + + // Create reference location. The test step will verify this is returned correctly + // in the netsim callbacks only, it will not be used by the test assistance data provider. + + // Location to use. + RPointerArray& srcPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr; + TPositionInfo* srcPosInfo = reinterpret_cast(srcPosInfoArr[0]); + TPosition srcPos; + srcPosInfo->GetPosition(srcPos); + + if (!iNetSim.SetReferenceLocation(srcPos)) + { + INFO_PRINTF1(_L("Failed test, can't set NetSim's reference location.")); + SetTestStepResult(EFail); + + iNetSim.Close(); + + return TestStepResult(); + } + // Set plugin to use. + TUid pluginUid = TUid::Uid(KAssistanceDataProviderPluginUidValue); + if (!iNetSim.SetAssistanceDataProvider(pluginUid)) + { + INFO_PRINTF1(_L("Failed test, can't set NetSim's assistance data plugin uid.")); + SetTestStepResult(EFail); + + iNetSim.Close(); + + return TestStepResult(); + } + + + // Kick off the keep alive timer - do last to ensure NetSim is ready otherwise the + // timer callback may start a MO-LR if the NetSim connected to early. + TTimeIntervalMicroSeconds32 interval(KLbsKeepAlivePeriod); + + iKeepAliveTimer->SetTimer(interval); + + + // Kick off test. + CActiveScheduler::Start(); + + + // Clean up. + + //iNetSim.ClearAssistanceDataFilters(); + iNetSim.Close(); + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_Assistance::doTestStepL()")); + + return TestStepResult(); + } + + /** NetSim callbacks given for a MoLr, which we invoke as a result of the notify position update. +*/ + +// This method called when a client connects to the gateway API + +void CT_LbsClientStep_Assistance::Connected() + { + // Call base implementation. + CT_LbsNetSimStep::Connected(); + + switch (iTestCaseId) + { + + case 16: + { + //Configure network simulation to ensure it does not deliver assistance data. + //need to be changed + TBool ret = iNetSim.SetResponseError(KErrNotReady, ETrue); + } + break; + + // All other test cases required a MO-LR. + default: + { + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + posInfoArr.Append(posInfo); + + // Kick off pos update - this will invoke the assistance data processing + // within the test module. The result of this will be reported back to + // the test step via the module data bus monitor. + iDoPosUpdate->StartL(*posInfo); + + // Move to the waiting state. + iState = CT_LbsNetSimStep::EWaiting; + } + } + } + + +//called when a client disconnects to the gateway API +void CT_LbsClientStep_Assistance::Disconnected() + { + // Call base implementation. + CT_LbsNetSimStep::Disconnected(); + } + +// The data to start MoLr . If this blank then we are starting an MoLr, if not then X3P +void CT_LbsClientStep_Assistance::NotifyRegisterLcsMoLr(const TDesC& aData) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyRegisterLcsMoLr(aData); + + // Verify the aData is blank to indicate this is a MOLR. + if (aData != KNullDesC) + { + INFO_PRINTF1(_L("Failed test, register contains data.")); + SetTestStepResult(EFail); + } + } +// The reason the MoLr ended +void CT_LbsClientStep_Assistance::NotifyReleaseLcsMoLr(TInt aReason) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyReleaseLcsMoLr(aReason); + + if (aReason != KErrNone) + { + INFO_PRINTF2(_L("Failed test, bad release reason %d."), aReason); + SetTestStepResult(EFail); + } + + } +// A measurement control + +void CT_LbsClientStep_Assistance::NotifyMeasurementControlLocation(const TPositionInfo& aPosition, + const RLbsAssistanceDataBuilderSet& aData, + const TLbsNetPosRequestQuality& aQuality) + + { + T_LbsUtils utils; + + // Call base implementation. + CT_LbsNetSimStep::NotifyMeasurementControlLocation(aPosition, aData, aQuality); + + // Verify the reference position - use the entry in the verify pos info array. + RPointerArray& verifyPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr; + TPositionInfo* verifyPosInfo = reinterpret_cast(verifyPosInfoArr[0]); + + if (!utils.Compare_PosInfo(*verifyPosInfo, aPosition, T_LbsUtils::ERoughAccuracy)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + +// TODO: Check if we can verify aQuality in any way. + (void)aQuality; + } + + +void CT_LbsClientStep_Assistance::NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyFacilityLcsMoLrResult(aReason, aPosition); + + if (aReason != KErrNone) + { + INFO_PRINTF2(_L("Failed test, bad release reason %d."), aReason); + SetTestStepResult(EFail); + } + + // Verify the position returned from the network, this will be the same position + // we sent to the network as the result of the MO-LR, thus use the entry given by + // the test module. + T_LbsUtils utils; + RPointerArray& verifyPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr; + TPositionInfo* verifyPosInfo = reinterpret_cast(verifyPosInfoArr[0]); + + if (!utils.Compare_PosInfo(*verifyPosInfo, aPosition, T_LbsUtils::ERoughAccuracy)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + } + +void CT_LbsClientStep_Assistance::NotifyMeasurementReportLocation(const TPositionInfo& aPosition) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyMeasurementReportLocation(aPosition); + + // Verify the position given to the network, this will be the same position + // returned as the result of the MO-LR, thus use the entry given by + // the test module. + T_LbsUtils utils; + RPointerArray& verifyPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr; + TPositionInfo* verifyPosInfo = reinterpret_cast(verifyPosInfoArr[0]); + + if (!utils.Compare_PosInfo(*verifyPosInfo, aPosition, T_LbsUtils::ERoughAccuracy)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + } + +void CT_LbsClientStep_Assistance::NotifyMeasurementReportControlFailure(TInt aReason) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyMeasurementReportControlFailure(aReason); + + INFO_PRINTF2(_L("Failed test, got un-expected control failure with reason code = %d."), aReason); + SetTestStepResult(EFail); + + } + +void CT_LbsClientStep_Assistance::NotifyMeasurementReportRequestMoreAssistanceData(const TLbsAssistanceDataGroup& aFilter) + { + (void)aFilter; + + INFO_PRINTF1(_L("Got - Net Sim Notify Measurement Report Request More Assistance Data - Callback Event.")); + + // Note that we do NOT set the callback flag here (since it may not be set and the base class does an equivalence test, so we don't test for it) + } + +/** Notify position update callback. + + The notify position update as completed. We can mark as done in the callback flags. +*/ +void CT_LbsClientStep_Assistance::MT_LbsDoPosUpdateCallback(TRequestStatus& aStatus) + { + INFO_PRINTF1(_L("Got - Notify Update - Callback Event.")); + + SetCallbackFlag(KLbsCallback_Got_NotifyUpdate); + + if (KErrNone != aStatus.Int()) + { + INFO_PRINTF2(_L("Failed test, pos info request err = %d."), aStatus.Int()); + SetTestStepResult(EFail); + } + +// TODO also we expect this to happen before the last netsim callbacks happen if not +// we can't use current pos in those funcs maybe have to use the verify one not as nice. + + + } + + +//END diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepcellbasednpud.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepcellbasednpud.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,474 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstep_cellbasednpud.cpp +// This is the class implementation for the Notify Position Update Tests +// +// + +#include "ctlbsclientstepcellbasednpud.h" + +#include +#include + +#include "tlbsutils.h" +#include "ctlbsasyncwaiter.h" + + +// constant definitions + +_LIT(KLbsClientStepCellBasedNotifyPosUpdate, "LbsClientStepCellBasedNotifyPosUpdate"); + +// by default, a test case will abort after this time if all callbacks not completed: +// Note that this must be less than the TEF timeout in the script to be of any value +TTimeIntervalMicroSeconds32 KDefaultAbortTimerPeriod = 90*1000000; // 1.5 mins + +// by default, a test case running with real gps hardware will abort after this time +// Note that this must be less than the TEF timeout in the script to be of any value +TTimeIntervalMicroSeconds32 KDefaultAbortTimerPeriod_real = 100*1000000; // 5 mins + + +/** + * Destructor + */ +CT_LbsClientStep_CellBasedNotifyPosUpdate::~CT_LbsClientStep_CellBasedNotifyPosUpdate() + { + iDoPosUpdate->Cancel(); + delete iDoPosUpdate; + } + + +/** + * Constructor + */ +CT_LbsClientStep_CellBasedNotifyPosUpdate::CT_LbsClientStep_CellBasedNotifyPosUpdate(CT_LbsClientServer& aParent) : iParent(aParent) + { + SetTestStepName(KLbsClientStep_CellBasedNotifyPosUpdate); + } + + +/** +Static Constructor +*/ +CT_LbsClientStep_CellBasedNotifyPosUpdate* CT_LbsClientStep_CellBasedNotifyPosUpdate::New(CT_LbsClientServer& aParent) + { + // Can't leave, so return NULL if insufficient memory + CT_LbsClientStep_CellBasedNotifyPosUpdate* testStep = new CT_LbsClientStep_CellBasedNotifyPosUpdate(aParent); + if (testStep) + { + TInt err = KErrNone; + + TRAP(err, testStep->ConstructL()); + if (err) + { + delete testStep; + testStep = NULL; + } + } + return testStep; + + } + +void CT_LbsClientStep_CellBasedNotifyPosUpdate::ConstructL() + { + // Create the base class object. + CT_LbsNetSimStep::ConstructL(); + + // Active object wrapper for the notify position update. + iDoPosUpdate = CT_LbsDoPosUpdate::NewL(this, TPositionModuleInfo::ETechnologyNetwork); + + } + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_CellBasedNotifyPosUpdate::doTestStepL() + { + // Generic test step used to test the LBS Client Notify position update API. + INFO_PRINTF1(_L(">>CT_LbsClientStep_CellBasedNotifyPosUpdate::doTestStepL()")); + + if (TestStepResult()==EPass) // TODO still don't see why we need this... + { + iNetworkUnavailable = FALSE; + iIsCancelTest = FALSE; + iCancel = FALSE; + iCancelOnPosUpdate = FALSE; + iCancelBeforePosUpdate = FALSE; + iMultiReq = EFalse; + iNumNPUDs = iParent.iSharedData->iVerifyPosInfoArr.Count(); // how many NPUDs to do + + // Expected callbacks flags + iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | + KLbsCallback_NetworkBasedLocation | + KLbsCallback_Got_NotifyPositionUpdate; // notifypositionupdate completed. + + + TTimeIntervalMicroSeconds32 abortInterval; + if(iParent.iSharedData->iTestModuleInUse) + { + abortInterval = KDefaultAbortTimerPeriod; + } + else + { + abortInterval = KDefaultAbortTimerPeriod_real; + } + + // Carryout unique test actions. + TInt testCaseId; + if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId)) + { + switch (testCaseId) + { + case 1: // LBS-NotifyPosUpdateCellBased-0001 Request a cell-based location + { + // nothing to do + } + break; + + case 2: // LBS-NotifyPosUpdateCellBased-0002 Request a cell-based location and cancel before it completes + { + iCancel = ETrue; + iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | + KLbsCallback_Got_NotifyPositionUpdate; + } + break; + + case 3: // LBS-NotifyPosUpdateCellBased-0003 Request a cell-based location, when network unavailable + { + iNetworkUnavailable = ETrue; + // TO DO - are these the right flags (get NO NetSIm callbacks while network unavailable)? + iFlagsToHaltOn &= ~KLbsCallback_NetworkBasedLocation; + } + break; + + case 4: // LBS-NotifyPosUpdateCellBased-0004 multiple sequential npuds + { + iMultiReq = ETrue; + } + break; + + case 5: // LBS-NotifyPosUpdateCellBased-0005 Request a cell-based location and attempt to cancel when the update is received + { + iCancelOnPosUpdate = ETrue; + iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | + KLbsCallback_Got_NotifyPositionUpdate; + } + break; + + case 6: // LBS-NotifyPosUpdateCellBased-0006 Request a cell-based location and cancel before a position update is generated + { + iCancelBeforePosUpdate = ETrue; + iFlagsToHaltOn = KLbsCallback_NetSim_Got_Connect | + KLbsCallback_Got_NotifyPositionUpdate; + } + + break; + + default: + User::Panic(KLbsClientStepCellBasedNotifyPosUpdate, KErrUnknown); + } + } + else + { + User::Panic(KLbsClientStepCellBasedNotifyPosUpdate, KErrUnknown); + } + + iIsCancelTest = (iCancel || iCancelBeforePosUpdate || iCancelOnPosUpdate); + + // Steps common to all tests: + + // Connect to net sim + iNetSim.ConnectL(this); + + // Configure NetSim: + // Set reference location: + RPointerArray& srcPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr; + TPositionInfo* srcPosInfo = reinterpret_cast(srcPosInfoArr[0]); + TPosition srcPos; + srcPosInfo->GetPosition(srcPos); + if (!iNetSim.SetReferenceLocation(srcPos)) + { + INFO_PRINTF1(_L("CT_LbsClientStep_CellBasedNotifyPosUpdate::doTestStepL() Failed: Can't set NetSim's reference location.")); + SetTestStepResult(EFail); + } + + // Set plugin to use for getting assistance data: + TUid pluginUid; + if(iParent.iSharedData->iTestModuleInUse) + { + pluginUid = TUid::Uid(KSimpleAssistanceDataProviderPluginUidValue); + } + else + { + pluginUid = TUid::Uid(KSuplAssistanceDataProviderPluginUidValue); + } + if (!iNetSim.SetAssistanceDataProvider(pluginUid)) + { + INFO_PRINTF1(_L("Can't set NetSim's assistance data plugin uid.")); + SetTestStepResult(EFail); + } + + // make network unavailable if appropriate: + if(iNetworkUnavailable) + { + // Tell netsim to make network unavailable until further notice: + if(!iNetSim.SetResponseError(RLbsNetSimTest::KNetSimNetworkNotAvailable, ETrue)) //sticky + { + INFO_PRINTF1(_L("CT_LbsClientStep_CellBasedNotifyPosUpdate::doTestStepL() Failed: Can't set NetSim's response error.")); + SetTestStepResult(EFail); + } + } + + // Kick off the keep alive timer - do last to ensure NetSim is ready otherwise the + // timer callback may start a MO-LR if the NetSim connected too early. + TTimeIntervalMicroSeconds32 interval(KLbsKeepAlivePeriod); + + iKeepAliveTimer->SetTimer(interval); + + // don't wait for TEF to timeout and abort + iAbortTimer->SetTimer(abortInterval); + + // Kick off test. + CActiveScheduler::Start(); + + if(EDone != iState) + { + INFO_PRINTF2(_L("Failed test, finished in state %d"), iState); + INFO_PRINTF3(_L("Callback flags currently set = 0x%x. Expecting 0x%x"), iCallbackFlags, iFlagsToHaltOn); + SetTestStepResult(EFail); + } + else + { + INFO_PRINTF2(_L("Got all expected callbacks (0x%x)"), iCallbackFlags); + } + + iNetSim.Close(); + + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_CellBasedNotifyPosUpdate::doTestStepL()")); + + return TestStepResult(); + } + + +void CT_LbsClientStep_CellBasedNotifyPosUpdate::Connected() + { + // Call base implementation. + CT_LbsNetSimStep::Connected(); + + if(iCancelBeforePosUpdate) + { + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + iDoPosUpdate->StartL(*posInfo); + + iNumNPUDs--; + + // Wait for all expected callback flags to be set: + iState = CT_LbsNetSimStep::EWaiting; + + // Cancel the request for the cancel test. + iDoPosUpdate->CancelRequest(); + delete posInfo; + } + else + { + T_LbsUtils utils; + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + posInfoArr.Append(posInfo); + + iDoPosUpdate->StartL(*posInfo); + + iNumNPUDs--; + + // Wait for all expected callback flags to be set: + iState = CT_LbsNetSimStep::EWaiting; + + // Cancel the request for the cancel test. + if(iCancel) + { + User::After((TTimeIntervalMicroSeconds32)100000); // arbitrary delay as workaround for DEF107349 + iDoPosUpdate->CancelRequest(); + } + } + } + +void CT_LbsClientStep_CellBasedNotifyPosUpdate::Disconnected() + { + // Call base implementation. + CT_LbsNetSimStep::Disconnected(); + } + +void CT_LbsClientStep_CellBasedNotifyPosUpdate::NotifyRegisterLcsMoLr(const TDesC& aData) + { + if (!iIsCancelTest) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyRegisterLcsMoLr(aData); + } + } + +void CT_LbsClientStep_CellBasedNotifyPosUpdate::NotifyReleaseLcsMoLr(TInt aReason) + { + if (!iIsCancelTest) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyReleaseLcsMoLr(aReason); + } + } + +// Measurement Control has been received from Network: +void CT_LbsClientStep_CellBasedNotifyPosUpdate::NotifyMeasurementControlLocation(const TPositionInfo& aPosition, const RLbsAssistanceDataBuilderSet& aData, const TLbsNetPosRequestQuality& aQuality) + { + if (!iIsCancelTest) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyMeasurementControlLocation(aPosition, aData, aQuality); + } + } + +void CT_LbsClientStep_CellBasedNotifyPosUpdate::NotifyReleaseLcsLocationNotification(const CLbsNetworkProtocolBase::TLbsPrivacyResponse& aResult) + { + if (!iIsCancelTest) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyReleaseLcsLocationNotification(aResult); + } + } + +void CT_LbsClientStep_CellBasedNotifyPosUpdate::NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition) + { + if (!iIsCancelTest) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyFacilityLcsMoLrResult(aReason, aPosition); + } + } + +// Our position has been reported to network +void CT_LbsClientStep_CellBasedNotifyPosUpdate::NotifyMeasurementReportLocation(const TPositionInfo& aPosition) + { + if(iCancelOnPosUpdate) + { + iDoPosUpdate->CancelRequest(); + } + if (!iIsCancelTest) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyMeasurementReportLocation(aPosition); + } + } + +void CT_LbsClientStep_CellBasedNotifyPosUpdate::NotifyMeasurementReportRequestMoreAssistanceData(const TLbsAssistanceDataGroup& aFilter) + { + if (!iIsCancelTest) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyMeasurementReportRequestMoreAssistanceData(aFilter); + } + } + +void CT_LbsClientStep_CellBasedNotifyPosUpdate::NotifyMeasurementReportControlFailure(TInt aReason) + { + if (!iIsCancelTest && !iMultiReq) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyMeasurementReportControlFailure(aReason); + } + else if (iMultiReq && ! ((aReason == KErrPositionHighPriorityReceive) || (aReason == KErrServerBusy))) + { + INFO_PRINTF2(_L("FAILED: NotifyMeasurementReportControlFailure with reason = %d"), aReason); + SetTestStepResult(EFail); + } + } + +void CT_LbsClientStep_CellBasedNotifyPosUpdate::NotifyError(MLbsNetSimTestObserver::EFunction aFunction, int aError) + { + // Call base implementation. + CT_LbsNetSimStep::NotifyError(aFunction, aError); + } + +void CT_LbsClientStep_CellBasedNotifyPosUpdate::ProcessMeasurementControlLocationError(TInt aError) + { + // Call base implementation. + CT_LbsNetSimStep::ProcessMeasurementControlLocationError(aError); + } + +/** Notify position update callback. +*/ +void CT_LbsClientStep_CellBasedNotifyPosUpdate::MT_LbsDoPosUpdateCallback(TRequestStatus& aStatus) + { + TInt err = aStatus.Int(); + + INFO_PRINTF2(_L("CT_LbsClientStep_CellBasedNotifyPosUpdate::MT_LbsDoPosUpdateCallback: Got - Notify Update - Callback Event. Error = %d"), err); + + if(!iNumNPUDs) // only set the flag when we've got them all + { + SetCallbackFlag(KLbsCallback_Got_NotifyPositionUpdate); + } + + if(iNetworkUnavailable) + { + if(KErrTimedOut != err && KErrDisconnected != err) + { + INFO_PRINTF2(_L("FAILED: MT_LbsDoPosUpdateCallback with error %d, expecting KErrTimedOut"), err); + SetTestStepResult(EFail); + } + } + else + { + if(iCancel) + { + if(KErrCancel != err && KErrNone != err) + { + INFO_PRINTF2(_L("FAILED: MT_LbsDoPosUpdateCallback with error = %d"), err); + SetTestStepResult(EFail); + } + } + else + { + if(iCancelBeforePosUpdate) + { + if(KErrCancel != err) + { + INFO_PRINTF2(_L("FAILED: MT_LbsDoPosUpdateCallback with error = %d"), err); + SetTestStepResult(EFail); + } + } + else + { + if(KErrNone != err) + { + INFO_PRINTF2(_L("FAILED: MT_LbsDoPosUpdateCallback with error = %d"), err); + SetTestStepResult(EFail); + } + } + } + } + + if(iNumNPUDs--) + { + // Create another posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + posInfoArr.Append(posInfo); + + iDoPosUpdate->StartL(*posInfo); + } + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepignoreaccurracysetting.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepignoreaccurracysetting.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,450 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepignoreaccurracysetting.cpp +// +// + +#include "ctlbsclientstepignoreaccurracysetting.h" + +#include +#include +#include + +#include "tlbsutils.h" +#include "ctlbsasyncwaiter.h" + +#define EXPECTED_GPS_ACCURACY_HORIZONTAL 10 +#define EXPECTED_GPS_ACCURACY_VERTICAL 10 + +const TTimeIntervalMicroSeconds KModuleTimeout = 5000000;//makes test module time out(which should be more than the Maxtime in lbsprofile.ini) + +/** + * Construction. + */ +CT_LbsClientStep_IgnoreAccuracySetting* CT_LbsClientStep_IgnoreAccuracySetting::New(CT_LbsClientServer& aParent) + { + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + CT_LbsClientStep_IgnoreAccuracySetting* testStep = new CT_LbsClientStep_IgnoreAccuracySetting(aParent); + if (testStep) + { + TInt err = KErrNone; + + TRAP(err, testStep->ConstructL()); + if (err) + { + delete testStep; + testStep = NULL; + } + } + + return testStep; + } + + +CT_LbsClientStep_IgnoreAccuracySetting::CT_LbsClientStep_IgnoreAccuracySetting(CT_LbsClientServer& aParent) + : CT_LbsClientStep(aParent), iTestCaseId(0) + { + SetTestStepName(KLbsClientStep_IgnoreAccuracySetting); + } + + +void CT_LbsClientStep_IgnoreAccuracySetting::ConstructL() + { + // Connect server. + User::LeaveIfError(iServer.Connect()); + } + + +/** + * Destructor + */ +CT_LbsClientStep_IgnoreAccuracySetting::~CT_LbsClientStep_IgnoreAccuracySetting() + { + iPositioner.Close(); + CloseNetSim(); + iServer.Close(); + } +/** + * The set-up for the tests open the net sim, where required (the terminal based + * tests) and open the connection to the server. Also it sets the update options + * for the requests with those in the ini file. RPositioner is open through one + * of the three APIs, depending on the tests + */ +TVerdict CT_LbsClientStep_IgnoreAccuracySetting::doTestStepPreambleL() + { + // Process some common pre setting to test steps then set SetTestStepResult to EFail or Epass. + INFO_PRINTF1(_L(">>CT_LbsClientStep::doTestStepPreambleL()")); + SetTestStepResult(EPass); + T_LbsUtils utils; + + if(GetIntFromConfig(ConfigSection(), KTestCaseId, iTestCaseId)) + { + switch(iTestCaseId) + { // open the network simulator for the tests that run in terminal based + case 151: // LBS-IGNORE-ACCURACY-ON-TERMINAL-BASED-001 + case 152: // LBS-IGNORE-ACCURACY-ON-TERMINAL-BASED-002 + case 153: // LBS-IGNORE-ACCURACY-ON-TERMINAL-BASED-003 + { + CloseNetSim(); + User::LeaveIfError(OpenNetSim()); + break; + } + default: + { + } + } + + switch(iTestCaseId) + { // open the positioner for the tests that are doing a position update + // the positioner is opened through the required API for each test + case 1: // LBS-IGNORE-ACCURACY-ENABLED-001 + case 2: // LBS-IGNORE-ACCURACY-DISABLED-001 + { // do nothing, these tests don't ask for a position update + break; + } + case 3: // LBS-IGNORE-ACCURACY-ABSENT-001 + case 101: // LBS-MOLR-IGNORE-ACCURACY-ON-ACCURATE-001 + case 104: // LBS-MOLR-IGNORE-ACCURACY-ON-INACCURATE-001 + case 107: // LBS-MOLR-IGNORE-ACCURACY-ON-TIMEOUT-001 + case 110: // LBS-IGNORE-ACCURACY-ON-PARTIAL-UPDATE-001 + case 111: // LBS-IGNORE-ACCURACY-ON-PARTIAL-UPDATE-002 + case 114: // LBS-IGNORE-ACCURACY-ON-EARLY-COMPLETE-001 + case 151: // LBS-IGNORE-ACCURACY-ON-TERMINAL-BASED-001 + case 201: // LBS-MOLR-IGNORE-ACCURACY-OFF-ACCURATE-001 + case 204: // LBS-MOLR-IGNORE-ACCURACY-OFF-INACCURATE-001 + case 207: // LBS-MOLR-IGNORE-ACCURACY-OFF-TIMEOUT-001 + case 210: // LBS-IGNORE-ACCURACY-OFF-PARTIAL-UPDATE-001 + case 211: // LBS-IGNORE-ACCURACY-OFF-PARTIAL-UPDATE-002 + case 214: // LBS-IGNORE-ACCURACY-OFF-EARLY-COMPLETE-001 + { + User::LeaveIfError(iPositioner.Open(iServer)); + break; + } + case 102: // LBS-MOLR-IGNORE-ACCURACY-ON-ACCURATE-002 + case 105: // LBS-MOLR-IGNORE-ACCURACY-ON-INACCURATE-002 + case 108: // LBS-MOLR-IGNORE-ACCURACY-ON-TIMEOUT-002 + case 152: // LBS-IGNORE-ACCURACY-ON-TERMINAL-BASED-002 + case 202: // LBS-MOLR-IGNORE-ACCURACY-OFF-ACCURATE-002 + case 205: // LBS-MOLR-IGNORE-ACCURACY-OFF-INACCURATE-002 + case 208: // LBS-MOLR-IGNORE-ACCURACY-OFF-TIMEOUT-002 + { + TPositionModuleId networkModuleId = utils.GetAGpsModuleIdL(iServer); + User::LeaveIfError(iPositioner.Open(iServer, networkModuleId)); + break; + } + case 103: // LBS-MOLR-IGNORE-ACCURACY-ON-ACCURATE-003 + case 106: // LBS-MOLR-IGNORE-ACCURACY-ON-INACCURATE-003 + case 109: // LBS-MOLR-IGNORE-ACCURACY-ON-TIMEOUT-003 + case 153: // LBS-IGNORE-ACCURACY-ON-TERMINAL-BASED-003 + case 203: // LBS-MOLR-IGNORE-ACCURACY-OFF-ACCURATE-003 + case 206: // LBS-MOLR-IGNORE-ACCURACY-OFF-INACCURATE-003 + case 209: // LBS-MOLR-IGNORE-ACCURACY-OFF-TIMEOUT-003 + { + TPositionCriteria criteria; + TPositionQuality quality; + // set up the required accuracy + quality.SetHorizontalAccuracy(EXPECTED_GPS_ACCURACY_HORIZONTAL); + quality.SetVerticalAccuracy(EXPECTED_GPS_ACCURACY_VERTICAL); + criteria.SetRequiredQuality(quality); + User::LeaveIfError(iPositioner.Open(iServer, criteria)); + break; + } + default: + { + SetTestStepResult(EFail); + } + } + if(iTestCaseId != 1 && iTestCaseId !=2) + { // Loading the update options for all tests, except those that + // don't request a position update + TPtrC configFileName; + _LIT(KUpdateOptionsFile, "pos_infos_file"); + + GetStringFromConfig(ConfigSection(), KUpdateOptionsFile, configFileName); + + TPositionUpdateOptions updateOpts; + + utils.GetConfigured_ModuleUpdateOptionsL(configFileName, ConfigSection(), updateOpts); + iPositioner.SetUpdateOptions(updateOpts); + } + } + else + { + SetTestStepResult(EFail); + } + + return TestStepResult(); + } + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_IgnoreAccuracySetting::doTestStepL() + { + // Generic test step used to test the LBS SetUpdateOptions API. + INFO_PRINTF1(_L(">>CT_LbsClientStep_IgnoreAccuracySetting::doTestStepL()")); + + if(iTestCaseId == 1 || iTestCaseId == 2) + { // Testing the ignore accuracy setting is as required + CLbsAdmin* lbsAdmin = CLbsAdmin::NewL(); + CleanupStack::PushL(lbsAdmin); + CLbsAdmin::TSpecialFeature ignoreAccuracySetting; + TInt err = lbsAdmin->Get(KLbsSpecialFeatureIgnoreAccuracy, ignoreAccuracySetting); + if(err != KErrNone) + { + SetTestStepResult(EFail); + } + else + { + switch(iTestCaseId) + { + case 1: // LBS-IGNORE-ACCURACY-ENABLED-001 + { + if(ignoreAccuracySetting != CLbsAdmin::ESpecialFeatureOn) + { + SetTestStepResult(EFail); + } + break; + } + case 2: // LBS-IGNORE-ACCURACY-DISABLED-001 + { + if(ignoreAccuracySetting != CLbsAdmin::ESpecialFeatureOff) + { + SetTestStepResult(EFail); + } + break; + } + default: + { + SetTestStepResult(EFail); + } + } + } + + CleanupStack::PopAndDestroy(lbsAdmin); + } + else + { + // Testing the ignore accuracy setting is absent + if(iTestCaseId == 3) + { // Testing the ignore accuracy setting is absent + CLbsAdmin* lbsAdmin = CLbsAdmin::NewL(); + CleanupStack::PushL(lbsAdmin); + TInt err(KErrNone); + CLbsAdmin::TSpecialFeature ignoreAccuracySetting; + err = lbsAdmin->Get(KLbsSpecialFeatureIgnoreAccuracy, ignoreAccuracySetting); + if(err != KErrNone || ignoreAccuracySetting != CLbsAdmin::ESpecialFeatureOff) + { + SetTestStepResult(EFail); + } + CleanupStack::PopAndDestroy(lbsAdmin); + } + + switch(iTestCaseId) + { // Requesting the module to delay it's response so we get a time-out + case 107: // LBS-MOLR-IGNORE-ACCURACY-ON-TIMEOUT-001 + case 108: // LBS-MOLR-IGNORE-ACCURACY-ON-TIMEOUT-002 + case 109: // LBS-MOLR-IGNORE-ACCURACY-ON-TIMEOUT-003 + case 207: // LBS-MOLR-IGNORE-ACCURACY-OFF-TIMEOUT-001 + case 208: // LBS-MOLR-IGNORE-ACCURACY-OFF-TIMEOUT-002 + case 209: // LBS-MOLR-IGNORE-ACCURACY-OFF-TIMEOUT-003 + { + if (iParent.iSharedData->iTestModuleInUse) + { + T_LbsUtils utils; + TModuleDataIn modDataIn; + + modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut; + modDataIn.iTimeOut = KModuleTimeout; + + utils.NotifyModuleOfConfigChangeL(modDataIn); // This will block. + } + else + { + SetTestStepResult(EFail); + } + break; + } + default: + { + break; + } + } + + if (TestStepResult()==EPass) + { + T_LbsUtils utils; + + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + // The posInfo shouldn't be put on the cleanup stack because ownership is passed to the parent + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + posInfoArr.Append(posInfo); + TInt err; + + // Request a position update + switch(iTestCaseId) + { + case 114: // LBS-IGNORE-ACCURACY-ON-EARLY-COMPLETE-001 + case 214: // LBS-IGNORE-ACCURACY-OFF-EARLY-COMPLETE-001 + { // In the early complete tests we request for a position + // update in a different way so the client can complete + // the request early + err = DoNotifyUpdateL(*posInfo); + if(err != KPositionPartialUpdate) + { + SetTestStepResult(EFail); + break; + } + + TRequestStatus status; + iPositioner.NotifyPositionUpdate(*posInfo, status); + + err = iPositioner.CompleteRequest(EPositionerNotifyPositionUpdate); + if(err != KErrNone) + { + SetTestStepResult(EFail); + } + // this should complete with either KErrNone or KErrCancel + User::WaitForRequest(status); + + err = status.Int(); + break; + } + default: + { + // Get the actual position + err = DoNotifyUpdateL(*posInfo); + } + } + + if(iTestCaseId == 151 || iTestCaseId == 153) + { // expect reference position in the appropiate terminal based tests + if(KErrNone != err) + { + SetTestStepResult(EFail); + } + else + { + // Verify reference position. + TPositionInfo verifyRefPosInfo; + verifyRefPosInfo.SetPosition(iRefPos); + + if (!utils.Compare_PosInfo(verifyRefPosInfo, *posInfo)) + { + if(!iParent.iSharedData->iTestModuleInUse) + { + WARN_PRINTF1(_L("WARNING: position received was not reference position")); + } + else + { + INFO_PRINTF1(_L("Failed test, reference position incorrect.")); + SetTestStepResult(EFail); + } + } + } + err = DoNotifyUpdateL(*posInfo); + } + + // check we receive the appropiate error code from the request we made + switch(iTestCaseId) + { + case 101: // LBS-MOLR-IGNORE-ACCURACY-ON-ACCURATE-001 + case 104: // LBS-MOLR-IGNORE-ACCURACY-ON-INACCURATE-001 + case 201: // LBS-MOLR-IGNORE-ACCURACY-OFF-ACCURATE-001 + case 102: // LBS-MOLR-IGNORE-ACCURACY-ON-ACCURATE-002 + case 105: // LBS-MOLR-IGNORE-ACCURACY-ON-INACCURATE-002 + case 151: // LBS-IGNORE-ACCURACY-ON-TERMINAL-BASED-001 + case 152: // LBS-IGNORE-ACCURACY-ON-TERMINAL-BASED-002 + case 153: // LBS-IGNORE-ACCURACY-ON-TERMINAL-BASED-003 + case 202: // LBS-MOLR-IGNORE-ACCURACY-OFF-ACCURATE-002 + case 103: // LBS-MOLR-IGNORE-ACCURACY-ON-ACCURATE-003 + case 106: // LBS-MOLR-IGNORE-ACCURACY-ON-INACCURATE-003 + case 203: // LBS-MOLR-IGNORE-ACCURACY-OFF-ACCURATE-003 + { + if (KErrNone != err) + { + INFO_PRINTF2(_L("Failed test, error = %d."), err); + SetTestStepResult(EFail); + } + break; + } + case 107: // LBS-MOLR-IGNORE-ACCURACY-ON-TIMEOUT-001 + case 108: // LBS-MOLR-IGNORE-ACCURACY-ON-TIMEOUT-002 + case 109: // LBS-MOLR-IGNORE-ACCURACY-ON-TIMEOUT-003 + case 207: // LBS-MOLR-IGNORE-ACCURACY-OFF-TIMEOUT-001 + case 208: // LBS-MOLR-IGNORE-ACCURACY-OFF-TIMEOUT-002 + case 209: // LBS-MOLR-IGNORE-ACCURACY-OFF-TIMEOUT-003 + { + if (KErrTimedOut != err) + { + INFO_PRINTF2(_L("Failed test, expected KErrTimedOut, got error = %d."), err); + SetTestStepResult(EFail); + } + break; + } + case 3: // LBS-IGNORE-ACCURACY-ABSENT-001 + case 110: // LBS-IGNORE-ACCURACY-ON-PARTIAL-UPDATE-001 + case 204: // LBS-MOLR-IGNORE-ACCURACY-OFF-INACCURATE-001 + case 205: // LBS-MOLR-IGNORE-ACCURACY-OFF-INACCURATE-002 + case 206: // LBS-MOLR-IGNORE-ACCURACY-OFF-INACCURATE-003 + case 210: // LBS-IGNORE-ACCURACY-OFF-PARTIAL-UPDATE-001 + { + if (KPositionQualityLoss != err) + { + INFO_PRINTF2(_L("Failed test, expected KPositionQualityLoss, got error = %d."), err); + SetTestStepResult(EFail); + } + break; + } + case 111: // LBS-IGNORE-ACCURACY-ON-PARTIAL-UPDATE-002 + case 211: // LBS-IGNORE-ACCURACY-OFF-PARTIAL-UPDATE-002 + { + if (KPositionPartialUpdate != err) + { + INFO_PRINTF2(_L("Failed test, expected KPositionPartialUpdate, got error = %d."), err); + SetTestStepResult(EFail); + } + break; + } + case 114: // LBS-IGNORE-ACCURACY-ON-EARLY-COMPLETE-001 + case 214: // LBS-IGNORE-ACCURACY-OFF-EARLY-COMPLETE-001 + { + if (KPositionEarlyComplete != err) + { + INFO_PRINTF2(_L("Failed test, expected KPositionEarlyComplete, got error = %d."), err); + SetTestStepResult(EFail); + } + break; + } + default: + { + INFO_PRINTF2(_L("Failed test, unexpected Test Case Id %d"), iTestCaseId); + SetTestStepResult(EFail); + } + } + } + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_IgnoreAccuracySetting::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepignoreaccurracysettingtracking.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepignoreaccurracysettingtracking.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,219 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepignoreaccurracysetting.cpp +// +// + +#include "ctlbsclientstepignoreaccurracysettingtracking.h" + +#include +#include + +#include "tlbsutils.h" +#include "ctlbsasyncwaiter.h" + +_LIT(KUpdateArraySection, "update_array_section"); + +/** + * Construction. + */ +CT_LbsClientStep_IgnoreAccuracySettingTracking* CT_LbsClientStep_IgnoreAccuracySettingTracking::New(CT_LbsClientServer& aParent) + { + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + CT_LbsClientStep_IgnoreAccuracySettingTracking* testStep = new CT_LbsClientStep_IgnoreAccuracySettingTracking(aParent); + if (testStep) + { + TInt err = KErrNone; + + TRAP(err, testStep->ConstructL()); + if (err) + { + delete testStep; + testStep = NULL; + } + } + + return testStep; + } + + +CT_LbsClientStep_IgnoreAccuracySettingTracking::CT_LbsClientStep_IgnoreAccuracySettingTracking(CT_LbsClientServer& aParent) + : CT_LbsClientStep(aParent), iTestCaseId(0) + { + SetTestStepName(KLbsClientStep_IgnoreAccuracySettingTracking); + } + + +void CT_LbsClientStep_IgnoreAccuracySettingTracking::ConstructL() + { + // Connect server. + User::LeaveIfError(iServer.Connect()); + } + + +/** + * Destructor + */ +CT_LbsClientStep_IgnoreAccuracySettingTracking::~CT_LbsClientStep_IgnoreAccuracySettingTracking() + { + for(TInt index = 0; index < iExpectedUpdateArray.Count(); ++index) + { + delete iExpectedUpdateArray[index]; + } + iExpectedUpdateArray.Close(); + iPositioner.Close(); + iServer.Close(); + } + +TVerdict CT_LbsClientStep_IgnoreAccuracySettingTracking::doTestStepPreambleL() + { + // Process some common pre setting to test steps then set SetTestStepResult to EFail or Epass. + INFO_PRINTF1(_L(">>CT_LbsClientStep::doTestStepPreambleL()")); + SetTestStepResult(EPass); + + if(GetIntFromConfig(ConfigSection(), KTestCaseId, iTestCaseId)) + { + switch(iTestCaseId) + { + case 112: // LBS-IGNORE-ACCURACY-ON-TRACKING-001 + case 212: // LBS-IGNORE-ACCURACY-OFF-TRACKING-001 + { // do nothing + User::LeaveIfError(iPositioner.Open(iServer)); + + T_LbsUtils utils; + TPtrC configFileName; + _LIT(KUpdateOptionsFile, "pos_infos_file"); + + GetStringFromConfig(ConfigSection(), KUpdateOptionsFile, configFileName); + + TPositionUpdateOptions updateOpts; + + utils.GetConfigured_ModuleUpdateOptionsL(configFileName, ConfigSection(), updateOpts); + iPositioner.SetUpdateOptions(updateOpts); + + TPtrC updateArraySection; + GetStringFromConfig(ConfigSection(), KUpdateArraySection, updateArraySection); + + utils.GetConfigured_PosInfosL(configFileName, updateArraySection, iExpectedUpdateArray); + + break; + } + default: + { + SetTestStepResult(EFail); + } + } + } + else + { + SetTestStepResult(EFail); + } + + return TestStepResult(); + } + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_IgnoreAccuracySettingTracking::doTestStepL() + { + // Generic test step used to test the LBS SetUpdateOptions API. + INFO_PRINTF1(_L(">>CT_LbsClientStep_IgnoreAccuracySettingTracking::doTestStepL()")); + + if (TestStepResult()==EPass) + { + T_LbsUtils utils; + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + CleanupStack::PushL(posInfo); + + // Perfom test. + TInt err = KErrNone; + TPosition pos; + TInt numOfPosInfos = 5; + + for(TInt updateIndex = 0 ; TestStepResult()==EPass && updateIndex < numOfPosInfos; + ++updateIndex) + { + // Do request to position update. + err = DoNotifyUpdateL(*posInfo); + + switch(iTestCaseId) + { + case 212: // LBS-IGNORE-ACCURACY-OFF-TRACKING-001 + { + switch(updateIndex) + { + case 0: + case 1: + case 3: + { + if(KPositionQualityLoss != err) + { + SetTestStepResult(EFail); + } + break; + } + case 2: + case 4: + { + if(KErrNone != err) + { + SetTestStepResult(EFail); + } + break; + } + default: + { + SetTestStepResult(EFail); + } + } + TPositionInfoBase* expectedPosition = + static_cast(iExpectedUpdateArray[updateIndex]); + if(!utils.Compare_PosInfo(*posInfo, *expectedPosition)) + { + SetTestStepResult(EFail); + } + break; + } + case 112: // LBS-IGNORE-ACCURACY-ON-TRACKING-001 + { + if(KErrNone != err) + { + SetTestStepResult(EFail); + } + TPositionInfoBase* expectedPosition = + static_cast(iExpectedUpdateArray[updateIndex]); + if(!utils.Compare_PosInfo(*posInfo, *expectedPosition)) + { + SetTestStepResult(EFail); + } + break; + } + default: + { + SetTestStepResult(EFail); + } + } + } + CleanupStack::PopAndDestroy(posInfo); + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_IgnoreAccuracySettingTracking::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientsteplastknownpos.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientsteplastknownpos.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,728 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstep_lastknownpos.cpp +// This is the class implementation for the Last Known Position Tests +// +// + +#include "ctlbsclientsteplastknownpos.h" + +#include +#include "lbsadmin.h" +#include "lbssatellite.h" +#include "tlbsutils.h" +#include "ctlbsasyncwaiter.h" + +/** + * Destructor + */ +CT_LbsClientStep_LastKnownPos::~CT_LbsClientStep_LastKnownPos() + { + } + + +/** + * Constructor + */ +CT_LbsClientStep_LastKnownPos::CT_LbsClientStep_LastKnownPos(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent) + { + SetTestStepName(KLbsClientStep_LastKnownPos); + } + + +/** +Static Constructor +*/ +CT_LbsClientStep_LastKnownPos* CT_LbsClientStep_LastKnownPos::New(CT_LbsClientServer& aParent) + { + return new CT_LbsClientStep_LastKnownPos(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +void CT_LbsClientStep_LastKnownPos::SwitchOnselfLocateAPIL() + { + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + adminApi->Set(KLbsSettingHomeSelfLocate, CLbsAdmin::ESelfLocateOn); + CleanupStack::PopAndDestroy(adminApi); + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_LastKnownPos::doTestStepL() + { + // Generic test step used to test the LBS Client Notify position update API. + INFO_PRINTF1(_L(">>CT_LbsClientStep_LastKnownPos::doTestStepL()")); + + if (TestStepResult() == EPass) + { + TInt err = KErrNone; + + // Wait for server to cease to be - thus ensuring cache is empty + //User::After(10000000); //Not needed + + // Carryout unique test actions. + TInt testCaseId; + if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId)) + { + if(testCaseId == 2) + { + //The delay below is to make sure that there is no request to server for at least 200 seconds + //so that it will shutdown and clear cache. + + User::After(3*1000*1000); + } + + // Connect to self locate server. + User::LeaveIfError(iServer.Connect()); + CleanupClosePushL(iServer); + + switch (testCaseId) + { + // Test case LBS-LastKnownPos-0001 + case 1: + // Test case LBS-LastKnownPos-0101 + case 101: + { + T_LbsUtils utils; + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + if(testCaseId==101) + { + // For this test an additional reference position will be returned. + + // Setup netsim. + User::LeaveIfError(OpenNetSim()); + + // Request notify for the expected reference position. + TPositionInfo actualRefPosInfo; + + err = DoNotifyUpdateL(actualRefPosInfo); + if (err) + { + INFO_PRINTF2(_L("Failed test, reference position request returned err %d."), err); + SetTestStepResult(EFail); + } + + // Verify reference position. + TPositionInfo verifyRefPosInfo; + + verifyRefPosInfo.SetPosition(iRefPos); + if (!utils.Compare_PosInfo(verifyRefPosInfo, actualRefPosInfo)) + { + INFO_PRINTF1(_L("Failed test, reference position incorrect.")); + SetTestStepResult(EFail); + } + } + + + TPosition pos; // original position + TTime timeStamp; // timestamp inside original received position + + // Carry out a notify update to ensure last known cache is filled. + TPositionInfo notifyPosInfo; + User::LeaveIfError(DoNotifyUpdateL(notifyPosInfo)); + + // get the position data: + notifyPosInfo.GetPosition(pos); + + timeStamp = pos.Time(); + INFO_PRINTF1(_L("Original position timeStamp: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeStamp.DateTime().Day() + 1, timeStamp.DateTime().Month() + 1, timeStamp.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeStamp.DateTime().Hour(), timeStamp.DateTime().Minute(), timeStamp.DateTime().Second(), timeStamp.DateTime().Second()); + + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + posInfoArr.Append(posInfo); + + // Get the last known position + err = DoLastKnownPosL(*posInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + else + { + TTime timeStamp_cached; + posInfo->GetPosition(pos); + timeStamp_cached = pos.Time(); + + timeStamp = pos.Time(); + INFO_PRINTF1(_L("Cached position timeStamp: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeStamp_cached.DateTime().Day() + 1, timeStamp_cached.DateTime().Month() + 1, timeStamp_cached.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeStamp_cached.DateTime().Hour(), timeStamp_cached.DateTime().Minute(), timeStamp_cached.DateTime().Second(), timeStamp_cached.DateTime().Second()); + + // verify that the timestamp matches the original one: + if(timeStamp_cached != timeStamp) + { + SetTestStepResult(EFail); + } + + } + CleanupStack::PopAndDestroy(&iPositioner); + if (testCaseId == 101) + { + CloseNetSim(); + } + break; + } + + // NEGATIVE TEST + // Test case LBS-LastKnownPos-0002 + case 2: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + // DONT carry out a notify update to ensure last known cache is filled. + + // Create a posinfo to store position info from LastKnownPosition method. + TPositionInfo posInfo; + + // Get the last known position + err = DoLastKnownPosL(posInfo); + if (KErrUnknown != err) + { + INFO_PRINTF2(_L("Failed with error %d when expecting error KErrUnknown, indicating no position in cache"), err); + SetTestStepResult(EFail); + } + + // Wait for a time period and verify that location info is not published. + // 10seconds + User::After(10000000); + + // Get the last known position + err = DoLastKnownPosL(posInfo); + if (KErrUnknown != err) + { + INFO_PRINTF2(_L("Failed with error %d when expecting error KErrUnknown, indicating no position in cache"), err); + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + break; + } + + + // NEGATIVE TEST + // Test case LBS-LastKnownPos-0004 + case 4: + { + T_LbsUtils utils; + TPositionModuleId networkModuleId = utils.GetNetworkModuleIdL(iServer); + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer, networkModuleId)); + CleanupClosePushL(iPositioner); + + // Setup netsim. + User::LeaveIfError(OpenNetSim()); + + // Carry out a notify update to ensure last known cache is filled. + TPositionInfo actualRefPosInfo; + + err = DoNotifyUpdateL(actualRefPosInfo); + + if (err) + { + INFO_PRINTF2(_L("Failed test, reference position request returned err %d."), err); + SetTestStepResult(EFail); + } + + // Verify reference position. + TPositionInfo verifyRefPosInfo; + verifyRefPosInfo.SetPosition(iRefPos); + if (!utils.Compare_PosInfo(verifyRefPosInfo, actualRefPosInfo)) + { + INFO_PRINTF1(_L("Failed test, reference position incorrect.")); + SetTestStepResult(EFail); + } + + // ** Create a position info which is not supported by the network module ** + TPositionSatelliteInfo positionSatelliteInfo; + + // Get the last known position + err = DoLastKnownPosL(positionSatelliteInfo); + if (KErrArgument != err) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + // Close netsim. + CloseNetSim(); + break; + } + + // Test case LBS-LastKnownPos-0006 + case 6: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + CLbsAdmin* adminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(adminApi); + + adminApi->Set(KLbsSettingHomeSelfLocate, CLbsAdmin::ESelfLocateOff); + + TPositionInfo posInfo; + + // Get the last known position + err = DoLastKnownPosL(posInfo); + if (KErrAccessDenied != err) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(adminApi); + CleanupStack::PopAndDestroy(&iPositioner); + + SwitchOnselfLocateAPIL(); + + break; + } + + // Test case LBS-LastKnownPos-0007 + case 7: + // Test case LBS-LastKnownPos-0102 + case 102: + { + T_LbsUtils utils; + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + if(testCaseId==102) + { + // For this test an additional reference position will be returned. + + // Setup netsim. + User::LeaveIfError(OpenNetSim()); + + // Request notify for the expected reference position. + TPositionInfo actualRefPosInfo; + + err = DoNotifyUpdateL(actualRefPosInfo); + if (err) + { + INFO_PRINTF2(_L("Failed test, reference position request returned err %d."), err); + SetTestStepResult(EFail); + } + + // Verify reference position. + TPositionInfo verifyRefPosInfo; + + verifyRefPosInfo.SetPosition(iRefPos); + if (!utils.Compare_PosInfo(verifyRefPosInfo, actualRefPosInfo)) + { + INFO_PRINTF1(_L("Failed test, reference position incorrect.")); + SetTestStepResult(EFail); + } + } + + // Carry out a notify update to ensure last known cache is filled. + TPositionInfo notifyPosInfo; + TInt err = DoNotifyUpdateL(notifyPosInfo); + User::LeaveIfError(err); + + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + + + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + posInfoArr.Append(posInfo); + + // Get the last known position + CT_LbsAsyncWaiter* waiter = CT_LbsAsyncWaiter::NewL(); + CleanupStack::PushL(waiter); + + User::LeaveIfError(iPositioner.SetRequestor( CRequestor::ERequestorService, + CRequestor::EFormatApplication, + _L("Tom Tom"))); + + iPositioner.GetLastKnownPosition(*posInfo, waiter->iStatus); + + TInt errCancel = iPositioner.CancelRequest(EPositionerGetLastKnownPosition); + + waiter->StartAndWait(); + + TInt errLkp = waiter->Result(); + + CleanupStack::PopAndDestroy(waiter); + + // Sync Cancel() call returns either KErrNone or KErrNotFound. + if ( errCancel != KErrNone && errCancel != KErrNotFound ) + { + INFO_PRINTF1(_L("Cancel must return KErrNone or KErrNotFound")); + SetTestStepResult(EFail); + } + // If Cancel() returns KErrNone, then the original request may complete with KErrCancel. + if (errCancel != KErrNone && (errLkp != KErrCancel && errLkp != KErrNone ) ) + { + INFO_PRINTF1(_L("Cancel must return KErrCancel or KErrNone")); + SetTestStepResult(EFail); + } + + + CleanupStack::PopAndDestroy(&iPositioner); + if (testCaseId == 102) + { + CloseNetSim(); + } + break; + } + + // Test case LBS-LastKnownPos-0008 + case 8: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + // DONT get the last known position, but DO cancel + err = iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); + + if (KErrNotFound != err) + { + //Didnt cancel or complete successfully. + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + + // Test case LBS-LastKnownPos-0009 + case 9: + { + //DONT open connection to Position Server + + TPositionInfo posInfo; + + // Get the last known position, THIS SHOULD PANIC WITH EPositionServerBadHandle + TRequestStatus status; + iPositioner.GetLastKnownPosition(posInfo, status); + err = iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); + + if (KErrNone == err) + { + //Completed Successfully. + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + + SwitchOnselfLocateAPIL(); + + break; + } + + + // Test case LBS-LastKnownPos-0012 + case 12: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + // Carry out a notify update to ensure last known cache is filled. + TPositionInfo notifyPosInfo; + User::LeaveIfError(DoNotifyUpdateL(notifyPosInfo)); + + TPositionInfo posInfo; + + // Get the last known position while self Locate Server is busy + err = DoLastKnownPosL(posInfo); + + if (KErrServerBusy != err) + { + // Completed successfully. + INFO_PRINTF1(_L("**Test should pass if GetLastKnownPosition() fails with KErrServerBusy **")); + SetTestStepResult(EFail); + } + CleanupStack::PopAndDestroy(&iPositioner); + break; + } + + + // Test case LBS-LastKnownPos-0014 + case 14: + { + // Testcase placeholder + // Request multiples LKPs from different clients concurrently + SetTestStepResult(EFail); + break; + } + + + // Test case LBS-LastKnownPos-0015 + case 15: + // Test case LBS-LastKnownPos-0103 + case 103: + { + T_LbsUtils utils; + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + if(testCaseId==103) + { + // For this test an additional reference position will be returned. + + // Setup netsim. + User::LeaveIfError(OpenNetSim()); + + // Request notify for the expected reference position. + TPositionInfo actualRefPosInfo; + + err = DoNotifyUpdateL(actualRefPosInfo); + if (err) + { + INFO_PRINTF2(_L("Failed test, reference position request returned err %d."), err); + SetTestStepResult(EFail); + } + + // Verify reference position. + TPositionInfo verifyRefPosInfo; + + verifyRefPosInfo.SetPosition(iRefPos); + if (!utils.Compare_PosInfo(verifyRefPosInfo, actualRefPosInfo)) + { + INFO_PRINTF1(_L("Failed test, reference position incorrect.")); + SetTestStepResult(EFail); + } + } + + // Carry out a notify update to ensure last known cache is filled. + TPositionInfo notifyPosInfo; + TInt err = DoNotifyUpdateL(notifyPosInfo); + User::LeaveIfError(err); + + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + + + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + CT_LbsAsyncWaiter* waiter = CT_LbsAsyncWaiter::NewL(); + CleanupStack::PushL(waiter); + + TInt numpositions = iParent.iSharedData->iVerifyPosInfoArr.Count(); + while(numpositions--) + { + RPositioner positioner; + // Open positioner. + User::LeaveIfError(positioner.Open(iServer)); + CleanupClosePushL(positioner); + + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + posInfoArr.Append(posInfo); + + // LastKnownPosition from multiple sub sessions + + User::LeaveIfError(positioner.SetRequestor( CRequestor::ERequestorService, + CRequestor::EFormatApplication, + _L("Tom Tom"))); + + positioner.GetLastKnownPosition(*posInfo, waiter->iStatus); + waiter->StartAndWait(); + TInt res = waiter->Result(); + + if(KErrNone != res) + { + //One of the LKPs failed, so test fails. + SetTestStepResult(EFail); + } + CleanupStack::PopAndDestroy(&positioner); + } + + CleanupStack::PopAndDestroy(waiter); + CleanupStack::PopAndDestroy(&iPositioner); + if (testCaseId == 103) + { + CloseNetSim(); + } + break; + } + // Test case LBS-LastKnownPos-0016 + case 16: + // Test case LBS-LastKnownPos-0104 + case 104: + { + T_LbsUtils utils; + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + if(testCaseId==104) + { + // For this test an additional reference position will be returned. + + // Setup netsim. + User::LeaveIfError(OpenNetSim()); + + // Request notify for the expected reference position. + TPositionInfo actualRefPosInfo; + + err = DoNotifyUpdateL(actualRefPosInfo); + if (err) + { + INFO_PRINTF2(_L("Failed test, reference position request returned err %d."), err); + SetTestStepResult(EFail); + } + + // Verify reference position. + TPositionInfo verifyRefPosInfo; + + verifyRefPosInfo.SetPosition(iRefPos); + if (!utils.Compare_PosInfo(verifyRefPosInfo, actualRefPosInfo)) + { + INFO_PRINTF1(_L("Failed test, reference position incorrect.")); + SetTestStepResult(EFail); + } + } + + // Carry out a notify update to ensure last known cache is filled. + TPositionInfo notifyPosInfo; + User::LeaveIfError(DoNotifyUpdateL(notifyPosInfo)); + + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + + + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + TInt numPositions = iParent.iSharedData->iVerifyPosInfoArr.Count(); + while(numPositions--) + { + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + posInfoArr.Append(posInfo); + + err = DoLastKnownPosL(*posInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + } + + CleanupStack::PopAndDestroy(&iPositioner); + if (testCaseId == 104) + { + CloseNetSim(); + } + break; + } + // Test case LBS-LastKnownPos-0105 + case 105: + { + T_LbsUtils utils; + TPositionModuleId networkModuleId = utils.GetNetworkModuleIdL(iServer); + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer, networkModuleId)); + CleanupClosePushL(iPositioner); + + // Setup netsim. + User::LeaveIfError(OpenNetSim()); + + TPosition pos; // original position + TTime timeStamp; // timestamp inside original received position + + // Carry out a notify update to ensure last known cache is filled. + TPositionInfo actualRefPosInfo; + + err = DoNotifyUpdateL(actualRefPosInfo); + + if (err) + { + INFO_PRINTF2(_L("Failed test, reference position request returned err %d."), err); + SetTestStepResult(EFail); + } + + // get the position data: + actualRefPosInfo.GetPosition(pos); + + timeStamp = pos.Time(); + INFO_PRINTF1(_L("Original position timeStamp: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeStamp.DateTime().Day() + 1, timeStamp.DateTime().Month() + 1, timeStamp.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeStamp.DateTime().Hour(), timeStamp.DateTime().Minute(), timeStamp.DateTime().Second(), timeStamp.DateTime().Second()); + + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + posInfoArr.Append(posInfo); + + // Get the last known position + err = DoLastKnownPosL(*posInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + else + { + TTime timeStamp_cached; + posInfo->GetPosition(pos); + timeStamp_cached = pos.Time(); + + timeStamp = pos.Time(); + INFO_PRINTF1(_L("Cached position timeStamp: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeStamp_cached.DateTime().Day() + 1, timeStamp_cached.DateTime().Month() + 1, timeStamp_cached.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeStamp_cached.DateTime().Hour(), timeStamp_cached.DateTime().Minute(), timeStamp_cached.DateTime().Second(), timeStamp_cached.DateTime().Second()); + + // verify that the timestamp matches the original one: + if(timeStamp_cached != timeStamp) + { + SetTestStepResult(EFail); + } + + } + + CleanupStack::PopAndDestroy(&iPositioner); + // Close netsim. + CloseNetSim(); + break; + } + + default: + { + User::Leave(KErrArgument); + } + } + } + + // All done, clean up. + + CleanupStack::PopAndDestroy(&iServer); + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_LastKnownPos::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepmodinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepmodinfo.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,377 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepmodinfo.cpp +// This is the class implementation for the Module Information Tests +// +// + +#include "ctlbsclientstepmodinfo.h" + +#include + +#include "tlbsutils.h" + +/** "num_of_mods" = the expected number (TUint) of modules returned from RPositionServer::GetNumModules(). +*/ +_LIT(KNumOfMods, "num_of_mods"); + +/** "default_mod_id" = the expected module id returned from RPositionServer::GetDefaultModuleId(), + value is decimal. +*/ +_LIT(KDefaultModId, "default_mod_id"); + + + +/** + * Destructor + */ +CT_LbsClientStep_ModInfo::~CT_LbsClientStep_ModInfo() + { + } + + +/** + * Constructor + */ +CT_LbsClientStep_ModInfo::CT_LbsClientStep_ModInfo(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent) + { + SetTestStepName(KLbsClientStep_ModInfo); + } + + +/** +Static Constructor +*/ +CT_LbsClientStep_ModInfo* CT_LbsClientStep_ModInfo::New(CT_LbsClientServer& aParent) + { + return new CT_LbsClientStep_ModInfo(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_ModInfo::doTestStepL() + { + // Generic test step used to test the LBS Client Notify position update API. + INFO_PRINTF1(_L(">>CT_LbsClientStep_ModInfo::doTestStepL()")); + + if (TestStepResult() == EPass) + { + TInt err = KErrNone; + TUint numOfMods; + TInt modIndex; + TPositionModuleId modId; + TPositionModuleInfo& currentModInfo = iParent.iSharedData->iCurrentModuleInfo; + + // Connect to self locate server. + User::LeaveIfError(iServer.Connect()); + CleanupClosePushL(iServer); + + // Carryout unique test actions. + TInt testCaseId; + if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId)) + { + switch (testCaseId) + { + // Test case LBS-ModCnt-0001 + case 1: + { + // Find the number of modules installed. + TUint verifyNumOfMods; + + if (GetIntFromConfig(ConfigSection(), KNumOfMods, reinterpret_cast(verifyNumOfMods))) + { + err = iServer.GetNumModules(numOfMods); + if ((KErrNone != err) || (verifyNumOfMods != numOfMods)) + { + INFO_PRINTF4(_L("Incorrect err = %d, or num of modules %d should be %d"), err, numOfMods, verifyNumOfMods); + SetTestStepResult(EFail); + } + } + else + { + INFO_PRINTF1(_L("No num_of_mods variable set in .ini file")); + SetTestStepResult(EFail); + } + break; + } + + // Test case LBS-ModCnt-0002 + case 2: + { + + // Call GetNumModules with no connection to server. + RPositionServer server; // Don't use iServer as it's open for every test. + + server.GetNumModules(numOfMods); // No need to check err, call will panic. + break; + } + + // Test case LBS-ModCnt-0003 + // Test case LBS-ModCnt-0004 + case 3: + case 4: + { + // Find the number of modules installed. + TUint verifyNumOfMods; + + if (GetIntFromConfig(ConfigSection(), KNumOfMods, reinterpret_cast(verifyNumOfMods))) + { + err = iServer.GetNumModules(numOfMods); + if ((KErrNone != err) || (verifyNumOfMods != numOfMods)) + { + INFO_PRINTF4(_L("Incorrect err = %d, or num of modules %d should be %d"), err, numOfMods, verifyNumOfMods); + SetTestStepResult(EFail); + } + } + else + { + INFO_PRINTF1(_L("No num_of_mods variable set in .ini file")); + SetTestStepResult(EFail); + } + + // Setup verification data + const TInt KNumModules = 3; + _LIT(KLitModName1, "OtherModule"); + _LIT(KLitModName2, "SIRF_Loc_AGPS_Module"); + _LIT(KLitModName2_C, "C_Drive_SIRF_Module"); + _LIT(KLitModName3, "TEST_Loc_AGPS_Module"); + TPositionModuleId modId; + TPositionModuleInfo modInfArray[KNumModules]; + modId.iUid = 271064389; // othermodule.ini + modInfArray[0].SetModuleId(modId); + modInfArray[0].SetModuleName(KLitModName1); + modInfArray[0].SetIsAvailable(ETrue); + modId.iUid = 271064388; // sirfdatasource.ini + modInfArray[1].SetModuleId(modId); + if (testCaseId == 3) + modInfArray[1].SetModuleName(KLitModName2); + else + modInfArray[1].SetModuleName(KLitModName2_C); + modInfArray[1].SetIsAvailable(ETrue); + modId.iUid = 271064388; // xtestmodule.ini + modInfArray[2].SetModuleId(modId); + modInfArray[2].SetModuleName(KLitModName3); + modInfArray[2].SetIsAvailable(ETrue); + + if (err == KErrNone) + { + // Verify the expected modules were returned + for (TInt i=0; i < numOfMods; i++) + { + TPositionModuleInfo modInfo; + err = iServer.GetModuleInfoByIndex(i, modInfo); + if (err == KErrNone) + { + // Check module info is as expected + for (TInt j=0; j < KNumModules; j++) + { + // Check module info + if (!modInfArray[j].IsAvailable()) + continue; + // Check ID + if (modInfo.ModuleId() != modInfArray[j].ModuleId()) + continue; + // Check name + TBuf<32> modName, verifyName; + modInfo.GetModuleName(modName); + modInfArray[j].GetModuleName(verifyName); + if (modName.Compare(verifyName) == 0) + { + // Use the available to flag module info already + // seen in modInfArray. + modInfArray[j].SetIsAvailable(EFalse); + break; + } + } + } + else + { + INFO_PRINTF3(_L("Error getting module info %d (%d)"), i, err); + SetTestStepResult(EFail); + } + } + + // Check that all modules were seen + for (TInt k=0; k < KNumModules; k++) + { + if (modInfArray[k].IsAvailable()) + { + INFO_PRINTF2(_L("Expected module %d not found"), k); + SetTestStepResult(EFail); + } + } + } + break; + } + + + // TODO: + // how do we compare the mod info items, will have to read the ini file ourselfs + // no point in having our own ini file type like we have for posinfo + // have a test step does the reading of the standard modinfo ini file + // have a test step to install the modinfo ini file + + + // Test case LBS-ModInfo-0001 + case 11: + { + // Get mod info, normal functional test. + //iServer.GetNumModules(numOfMods); + + //err = iServer.GetModuleInfoByIndex(numOfMods-1, currentModInfo); + err = iServer.GetModuleInfoByIndex(0, currentModInfo); + if (KErrNone != err) + { + INFO_PRINTF2(_L("Incorrect err = %d"), err); + SetTestStepResult(EFail); + } + break; + } + + // Test case LBS-ModInfo-0002 + case 12: + { + // Get mod info using a invalid index. + modIndex = -1; + + err = iServer.GetModuleInfoByIndex(modIndex, currentModInfo); + if (KErrNotFound != err) + { + INFO_PRINTF3(_L("Incorrect err = %d, should be %d"), err, KErrNotFound); + SetTestStepResult(EFail); + } + break; + } + + // Test case LBS-ModInfo-0003 + case 13: + { + // Get mod info using a invalid index. + User::LeaveIfError(iServer.GetNumModules(numOfMods)); + modIndex = numOfMods + 1; // This will give us a invalid index. + + err = iServer.GetModuleInfoByIndex(modIndex, currentModInfo); + if (KErrNotFound != err) + { + INFO_PRINTF3(_L("Incorrect err = %d, should be %d"), err, KErrNotFound); + SetTestStepResult(EFail); + } + break; + } + + // Test case LBS-ModInfo-0004 + case 14: + { + // Get mod info with no connection to the server. + RPositionServer server; // Don't use iServer as it's open for every test. + + server.GetModuleInfoByIndex(0, currentModInfo); // No need to check err, call will panic. + break; + } + + // Test case LBS-ModInfo-0005 + case 15: + { + // Get mod info using a valid id. + TPositionModuleInfo modInfo; + + // Determine a valid module id, use get mod by index + User::LeaveIfError(iServer.GetModuleInfoByIndex(0, modInfo)); + modId = modInfo.ModuleId(); + + // Carry out test of a valid id + err = iServer.GetModuleInfoById(modId, currentModInfo); + if (KErrNone != err) + { + INFO_PRINTF2(_L("Incorrect err = %d"), err); + SetTestStepResult(EFail); + } + break; + } + + // Test case LBS-ModInfo-0006 + case 16: + { + // Get mod info with invalid id. + modId = KPositionNullModuleId; + + err = iServer.GetModuleInfoById(modId, currentModInfo); + if (KErrNotFound != err) + { + INFO_PRINTF3(_L("Incorrect err = %d, should be %d"), err, KErrNotFound); + SetTestStepResult(EFail); + } + break; + } + + // Test case LBS-ModInfo-0007 + case 17: + { + // Get mod info with no connection to the server. + RPositionServer server; // Don't use iServer as it's open for every test. + + server.GetModuleInfoById(KPositionNullModuleId, currentModInfo); // No need to check err, call will panic. + break; + } + + // Test case LBS-ModInfo-0008 + case 18: + { + // Get default mod id. + TPositionModuleId verifyModId; + if (GetIntFromConfig(ConfigSection(), KDefaultModId, reinterpret_cast(verifyModId))) + { + err = iServer.GetDefaultModuleId(modId); + if ((KErrNone != err) || (verifyModId != modId)) + { + INFO_PRINTF4(_L("Incorrect err = %d, or default module id %d should be %d"), err, modId, verifyModId); + SetTestStepResult(EFail); + } + } + + else + { + INFO_PRINTF1(_L("No default_mod_id variable set in .ini file")); + SetTestStepResult(EFail); + } + break; + } + + // Test case LBS-ModInfo-0009 + case 19: + { + // Get default mod id with no connection to server. + RPositionServer server; // Don't use iServer as it's open for every test. + + server.GetDefaultModuleId(modId); // No need to check err, call will panic. + break; + } + } + } + + // All done, clean up. + CleanupStack::PopAndDestroy(&iServer); + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_ModInfo::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepmodselect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepmodselect.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,603 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepmodselect.cpp +// This is the class implementation for the Module Selection Tests +// +// + +#include "ctlbsclientstepmodselect.h" + +#include "tlbsutils.h" + +/** + * Destructor + */ +CT_LbsClientStep_ModSelect::~CT_LbsClientStep_ModSelect() + { + } + + +/** + * Constructor + */ +CT_LbsClientStep_ModSelect::CT_LbsClientStep_ModSelect(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent) + { + iModuleId=TUid::Null(); + SetTestStepName(KLbsClientStep_ModSelect); + } + +/** +Static Constructor +*/ +CT_LbsClientStep_ModSelect* CT_LbsClientStep_ModSelect::New(CT_LbsClientServer& aParent) + { + return new CT_LbsClientStep_ModSelect(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + * Verifies that the last position retrieved was from the a-gps module + */ +TBool CT_LbsClientStep_ModSelect::VerifyLastModuleIdWasAGpsL() + { + TPositionInfo* posInfo = static_cast(iParent.iSharedData->iCurrentPosInfoArr[iParent.iSharedData->iCurrentPosInfoArr.Count()-1]); + TPositionModuleId checkModId = posInfo->ModuleId(); + TPositionModuleId verifyModId; + + T_LbsUtils utils; + + verifyModId = utils.GetAGpsModuleIdL(iServer); + + if(checkModId == verifyModId) + { + INFO_PRINTF2(_L("Module IDs Match: Get AGPS Module Id %d"), checkModId.iUid); + return ETrue; + } + else + { + INFO_PRINTF3(_L("Module IDs Do Not Match: Expected %d, Receive %d"), verifyModId.iUid, checkModId.iUid); + return EFalse; + } + } + +/** + * Verifies that the last position retrieved was from the network module + */ +TBool CT_LbsClientStep_ModSelect::VerifyLastModuleIdWasNetworkL() + { + TPositionInfo* posInfo = static_cast(iParent.iSharedData->iCurrentPosInfoArr[iParent.iSharedData->iCurrentPosInfoArr.Count()-1]); + TPositionModuleId checkModId = posInfo->ModuleId(); + TPositionModuleId verifyModId; + + T_LbsUtils utils; + verifyModId = utils.GetNetworkModuleIdL(iServer); + + if(checkModId == verifyModId) + { + INFO_PRINTF2(_L("Module IDs Match: Get Network Module Id %d"), checkModId.iUid); + return ETrue; + } + else + { + INFO_PRINTF3(_L("Module IDs Do Not Match: Expected %d, Receive %d"), verifyModId, checkModId); + return EFalse; + } + + } + +TInt CT_LbsClientStep_ModSelect::Blocking_NotifyUpdateL() + { + + TInt err; + + User::LeaveIfError(iPositioner.Open(iServer)); + INFO_PRINTF1(_L("Opened RPositioner successfully with RPositionServer")); + CleanupClosePushL(iPositioner); + + err = Blocking_NotifyUpdateCommonL(); + + CleanupStack::PopAndDestroy(&iPositioner); + + return err; + } + +TInt CT_LbsClientStep_ModSelect::Blocking_NotifyUpdateWithModuleIdL(TPositionModuleId aModuleId) + { + TInt err; + + User::LeaveIfError(iPositioner.Open(iServer, aModuleId)); + INFO_PRINTF1(_L("Opened RPositioner successfully with RPositionServer and TPositionModuleId")); + CleanupClosePushL(iPositioner); + + err = Blocking_NotifyUpdateCommonL(); + + CleanupStack::PopAndDestroy(&iPositioner); + + return err; + } + + +/** + * Opens a subsession with the requested criteria and retrieves a location update + * which it appends to the current array of positions + */ +TInt CT_LbsClientStep_ModSelect::Blocking_NofifyUpdateWithCriteriaL(TPositionCriteria aCriteria) + { + TInt err; + + User::LeaveIfError(iPositioner.Open(iServer, aCriteria)); + INFO_PRINTF1(_L("Opened RPositioner successfully with RPositionServer and TPositionCriteria")); + CleanupClosePushL(iPositioner); + + err = Blocking_NotifyUpdateCommonL(); + + CleanupStack::PopAndDestroy(&iPositioner); + + return err; + } + + +TInt CT_LbsClientStep_ModSelect::Blocking_NotifyUpdateCommonL() + { + TInt err = KErrNone; + + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + posInfoArr.Append(posInfo); + + err = DoNotifyUpdateL(*posInfo); + + return err; + } + +/** + * Connect to netsim and set up reference position + * return KErrNone if successful + */ +TInt CT_LbsClientStep_ModSelect::SetupNetSimL() + { + TInt err = iNetSim.ConnectL(NULL); //connect to netsim but ingnore the callbacks + if (err != KErrNone) + { + INFO_PRINTF2(_L("Cannot connect to netsim, return with error %d"), err); + return err; + } + else + { + //set up reference position + RPointerArray& srcPosInfoArr = iParent.iSharedData->iVerifyPosInfoArr; + TPositionInfo* srcPosInfo = reinterpret_cast(srcPosInfoArr[0]); + TPosition srcPos; + srcPosInfo->GetPosition(srcPos); + + if (!iNetSim.SetReferenceLocation(srcPos)) + { + INFO_PRINTF1(_L("Test Failed: can't set NetSim's reference location.")); + iNetSim.Close(); + return KErrGeneral; + } + // Set plugin to use for getting assistance data: + TUid pluginUid; + if(iParent.iSharedData->iTestModuleInUse) + { + pluginUid = TUid::Uid(KSimpleAssistanceDataProviderPluginUidValue); + } + else + { + pluginUid = TUid::Uid(KSuplAssistanceDataProviderPluginUidValue); + } + if (!iNetSim.SetAssistanceDataProvider(pluginUid)) + { + INFO_PRINTF1(_L("Test Failed: Can't set NetSim's assistance data plugin uid.")); + SetTestStepResult(EFail); + iNetSim.Close(); + return KErrGeneral; + } + } + return KErrNone; + } + +/** + * do notify position update with required postion criteria and verify the position + * received is from expected module + */ +void CT_LbsClientStep_ModSelect::DoModuleSelectionL(TOpenSesstionMethod aMethod, TModuleType aModuleType) + { + TInt err = KErrNone; + + //do netsim connection and configure reference position + err = SetupNetSimL(); + if (err !=KErrNone) + { + SetTestStepResult(EFail); + return; + } + + switch (aMethod) + { + case EWithCriteria: + err = Blocking_NofifyUpdateWithCriteriaL(iCriteria); + break; + + case EWithModuleId: + err = Blocking_NotifyUpdateWithModuleIdL(iModuleId); + break; + + case ENone: + err = Blocking_NotifyUpdateL(); + break; + + default: + break; + } + + + if(KErrNone == err) + { + // Verify that the last position was + // retrieved by the expected module: module ids not defined yet + switch (aModuleType) + { + case EAGPSModule: + if(!VerifyLastModuleIdWasAGpsL()) + { + SetTestStepResult(EFail); + } + break; + + case ENetworkModule: + if (!VerifyLastModuleIdWasNetworkL()) + { + SetTestStepResult(EFail); + break; + } + break; + + case ERandomModule: + if (!VerifyLastModuleIdWasNetworkL() && !VerifyLastModuleIdWasAGpsL()) + { + SetTestStepResult(EFail); + } + break; + + default: + break; + } + + } + else + { + SetTestStepResult(EFail); + } + + iNetSim.Close(); + } + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_ModSelect::doTestStepL() + { + // Generic test step used to test the LBS Client Notify position update API. + INFO_PRINTF1(_L(">>CT_LbsClientStep_ModSelect::doTestStepL()")); + + if (TestStepResult()==EPass) + { + + TInt err = KErrNone; + + // Connect to self locate server. + User::LeaveIfError(iServer.Connect()); + CleanupClosePushL(iServer); + + //reset the default value + iCriteria.ClearCriteria(); + iQuality = TPositionQuality(); + iSelectOrder.ClearSelectionOrder(); + + TInt testCaseId; + if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId)) + { + switch (testCaseId) + { + case 01: // test module selection by capabilities + // LBS-Capability-0001 + { + iCriteria.AddRequiredCapabilities(TPositionModuleInfo::ECapabilitySatellite); + DoModuleSelectionL(EWithCriteria, EAGPSModule); + } + break; + + case 03: // test module selection by unsupported capabilities + // LBS-Capability-0003 + { + // Set capabilities not supported by either (gps/network) module: + iCriteria.AddRequiredCapabilities(TPositionModuleInfo::ECapabilityMedia); + err = iPositioner.Open(iServer, iCriteria); + if(KErrNotFound != err) + { + INFO_PRINTF2(_L("Test failed: wrong error returned %d"), err); + SetTestStepResult(EFail); + if(KErrNone == err) + { + iPositioner.Close(); + } + } + + iCriteria.ClearCriteria(); + User::LeaveIfError(iPositioner.Open(iServer, iCriteria)); + iPositioner.Close(); + } + break; + + case 04: //required more than one capability + //LBS-Capability-0004 + { + iCriteria.AddRequiredCapabilities(TPositionModuleInfo::ECapabilityHorizontal); + iCriteria.AddRequiredCapabilities(TPositionModuleInfo::ECapabilitySatellite); + DoModuleSelectionL(EWithCriteria, EAGPSModule); + } + break; + + case 11: // test module selection by horizontal/vertical accuracy + // LBS-Quality-0001 + { + // set up the required accuracy + iQuality.SetHorizontalAccuracy(AGPS_MODINFO_HORIZONTAL_ACCURACY); + iQuality.SetVerticalAccuracy(AGPS_MODINFO_VERTICAL_ACCURACY); + + iCriteria.SetRequiredQuality(iQuality); + + DoModuleSelectionL(EWithCriteria, EAGPSModule); + } + break; + + case 12: // test module selection by time to first fix + // LBS-Quality-0002 + { + TTimeIntervalMicroSeconds timetofirstfix(NETWORK_MODINFO_TIME_TO_FIRST_FIX); + + // set up the required TTFF + iQuality.SetTimeToFirstFix(timetofirstfix); + + iCriteria.SetRequiredQuality(iQuality); + + DoModuleSelectionL(EWithCriteria, ENetworkModule); + } + break; + + case 13: // test module selection by power consumption + // LBS-Quality-0003 + // this test case can only be run in test module + // in xtestmodule.ini powerconsumption need to be changed to 1 + { + if (!iParent.iSharedData->iTestModuleInUse) + { + INFO_PRINTF1(_L("This test case can ONLY be run with Test A-GPS Module")); + User::Panic(_L("Client Module Selection"), 1); + } + iQuality.SetPowerConsumption(TPositionQuality::EPowerLow); + iCriteria.SetRequiredQuality(iQuality); + + //because both modules have the same power consumption value + //agps module will be selected by default + DoModuleSelectionL(EWithCriteria, ENetworkModule); + } + break; + + case 14: // test module selection by cost limit + // LBS-Quality-0004 + { + iQuality.SetCostIndicator(AGPS_MODINFO_COST_INDICATOR); + iCriteria.SetRequiredQuality(iQuality); + + DoModuleSelectionL(EWithCriteria, EAGPSModule); + } + break; + + case 15: // setting a higher accuracy than all existing modules for module selection + // LBS-Quality-0005 + { + //set an required horizontal accuracy as 1 meter + iQuality.SetHorizontalAccuracy(1); + iCriteria.SetRequiredQuality(iQuality); + err = iPositioner.Open(iServer, iCriteria); + if(KErrNotFound != err) + { + INFO_PRINTF2(_L("Test failed: wrong error returned %d"), err); + SetTestStepResult(EFail); + if(KErrNone == err) + { + iPositioner.Close(); + } + } + } + break; + + case 16: + // LBS-Quality-0006 - TTFF lower than module's and H-Acc lower (more accurate) than module's. Specified V-Acc is met by module. + { + //set required TTFF=20s, TTNF=1, H-Acc=10m, V-Acc=200m + iQuality.SetTimeToFirstFix(10000000); + iQuality.SetTimeToNextFix(1000000); + iQuality.SetHorizontalAccuracy(10); + iQuality.SetVerticalAccuracy(200); + + iCriteria.SetRequiredQuality(iQuality); + err = iPositioner.Open(iServer, iCriteria); + if(KErrNotFound != err) + { + INFO_PRINTF2(_L("Test failed: wrong error returned %d"), err); + SetTestStepResult(EFail); + if(KErrNone == err) + { + iPositioner.Close(); + } + } + } + break; + + case 17: + // LBS-Quality-0007 - TTFF lower than module's and H-Acc/V-Acc lower than module's. Power and Cost match module's + { + //set required TTFF=20s, TTNF=1, H-Acc=10m, V-Acc=10m + iQuality.SetTimeToFirstFix(10000000); + iQuality.SetTimeToNextFix(1000000); + iQuality.SetHorizontalAccuracy(10); + iQuality.SetVerticalAccuracy(10); + + iQuality.SetCostIndicator(TPositionQuality::ECostCharge); + iQuality.SetPowerConsumption(TPositionQuality::EPowerMedium); + + iCriteria.SetRequiredQuality(iQuality); + err = iPositioner.Open(iServer, iCriteria); + if(KErrNotFound != err) + { + INFO_PRINTF2(_L("Test failed: wrong error returned %d"), err); + SetTestStepResult(EFail); + if(KErrNone == err) + { + iPositioner.Close(); + } + } + } + break; + + case 21: // Request Location update with default request ordering + // LBS-SelectionOrder-0001 + { + DoModuleSelectionL(ENone,EAGPSModule); + } + break; + + case 22: // Request location update with cost/time/accuracy/power mgmt in order of importance + { // LBS-SelectionOrder-0002 + User::LeaveIfError(iSelectOrder.SetOrderCostIndicator(TPositionSelectionOrder::EOrderVeryHigh)); + User::LeaveIfError(iSelectOrder.SetOrderTimeToFirstFix(TPositionSelectionOrder::EOrderHigh)); + User::LeaveIfError(iSelectOrder.SetOrderHorizontalAccuracy(TPositionSelectionOrder::EOrderFairlyHigh)); + User::LeaveIfError(iSelectOrder.SetOrderPowerConsumption(TPositionSelectionOrder::EOrderMedium)); + + iCriteria.SetSelectionOrder(iSelectOrder); + + DoModuleSelectionL(EWithCriteria, EAGPSModule); + } + break; + + // Test requires test A-GPS module to have accuracy of <100m. This must be better than Network Module. + case 32: // Check that we can fall back on the selection order process (stage 3) when capabilities and qualities of both modules are equal. + { // LBS-ModuleSelection-0002 + iQuality.SetHorizontalAccuracy(500); + iCriteria.SetRequiredQuality(iQuality); + + DoModuleSelectionL(EWithCriteria, EAGPSModule); + } + break; + + // Test requires test A-GPS module and Network Module to have equal horizontal accuracy + case 33: // Check that we can ack on the Rpositioner Framework when both modules appear identical. + { // LBS-ModuleSelection-0003 + if (!iParent.iSharedData->iTestModuleInUse) + { + INFO_PRINTF1(_L("This test case can ONLY be run with Test A-GPS Module")); + User::Panic(_L("Client Module Selection"), 1); + } + iQuality.SetHorizontalAccuracy(100); + iCriteria.SetRequiredQuality(iQuality); + + User::LeaveIfError(iSelectOrder.SetOrderHorizontalAccuracy(TPositionSelectionOrder::EOrderVeryHigh)); + iCriteria.SetSelectionOrder(iSelectOrder); + + DoModuleSelectionL(EWithCriteria, ERandomModule); + } + break; + + case 34: // Select default module on connecting to the RPositioner + { // LBS-ModuleSelection-0004 + DoModuleSelectionL(EWithCriteria, EAGPSModule); + } + break; + + + case 35: // Select A-GPS module by its ID + { // LBS-ModuleSelection-0005 + iModuleId.iUid = APGS_MODINFO_MODULE_ID; + DoModuleSelectionL(EWithModuleId, EAGPSModule); + } + break; + + + case 36: // Select Network module by its ID + { // LBS-ModuleSelection-0006 + iModuleId.iUid = NETWORK_MODINFO_MODULE_ID; + DoModuleSelectionL(EWithModuleId, ENetworkModule); + } + break; + + case 37: // Test requires test A-GPS module and Network Module to have equal power consumption + // when both modules match the iCriteria, check default module is used for position update + // LBS-ModuleSelection-0007 + { + iQuality.SetPowerConsumption(TPositionQuality::EPowerLow); + iCriteria.SetRequiredQuality(iQuality); + + User::LeaveIfError(iSelectOrder.SetOrderPowerConsumption(TPositionSelectionOrder::EOrderVeryHigh)); + iCriteria.SetSelectionOrder(iSelectOrder); + + DoModuleSelectionL(EWithCriteria, ERandomModule); + } + break; + + case 38: + //LBS-ModuleSelection-0008 + { + if (!iParent.iSharedData->iTestModuleInUse) + { + INFO_PRINTF1(_L("This test case can ONLY be run with Test A-GPS Module")); + User::Panic(_L("Client Module Selection"), 1); + } + iQuality.SetHorizontalAccuracy(100); + iCriteria.SetRequiredQuality(iQuality); + + User::LeaveIfError(iSelectOrder.SetOrderHorizontalAccuracy(TPositionSelectionOrder::EOrderVeryHigh)); + User::LeaveIfError(iSelectOrder.SetOrderPowerConsumption(TPositionSelectionOrder::EOrderVeryHigh)); + iCriteria.SetSelectionOrder(iSelectOrder); + + // Verify that the last position was retrieved by a-gps module, which has lower power consumption. + DoModuleSelectionL(EWithCriteria, ENetworkModule); + } + break; + + default: + { + INFO_PRINTF1(_L("Invalid Test Case")); + User::Leave(KErrArgument); + } + } + } + CleanupStack::PopAndDestroy(&iServer); + } // end if TestStepResult + INFO_PRINTF1(_L("<<CT_LbsClientStep_ModSelect::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepmodstatus.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepmodstatus.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,567 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepmodstatus.cpp +// This is the class implementation for the Module Information Tests +// +// + +#include "ctlbsclientstepmodstatus.h" +#include "ctlbsclientstep.h" + +#include +#include + +#include "tlbsutils.h" +#include "ctlbsasyncwaiter.h" + +/** + * Destructor + */ +CT_LbsClientStep_ModStat::~CT_LbsClientStep_ModStat() + { + } + + +/** + * Constructor + */ +CT_LbsClientStep_ModStat::CT_LbsClientStep_ModStat(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent) + { + SetTestStepName(KLbsClientStep_ModStatus); + } + + +/** +Static Constructor +*/ +CT_LbsClientStep_ModStat* CT_LbsClientStep_ModStat::New(CT_LbsClientServer& aParent) + { + return new CT_LbsClientStep_ModStat(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + +/** + * Sets requested event mask as specified for supplied module. + * Kicks test module to cause events requested then waits for event(s) + * Updates the supplied module status + * returns TRUE if everything went as expected, FALSE otherwise + */ + /** + * Sets requested event mask as specified for supplied module. + * Kicks test module to cause events requested then waits for event(s) + * Updates the supplied module status + * returns TRUE if everything went as expected, FALSE otherwise + */ + TBool CT_LbsClientStep_ModStat::DoRequestAndVerifyModStatusEventsL(TPositionModuleStatusEvent::TModuleEvent aReqEventsMask, TPositionModuleStatus& aModStatus, TPositionModuleId aModId = KPositionNullModuleId ) + { + TBool result = TRUE; + TPositionModuleStatusEvent statusEvent; + TPositionModuleId agpsmodId; + + // we're interested in the agps module id + T_LbsUtils utils; + agpsmodId = utils.GetAGpsModuleIdL(iServer); + + // Set event mask to select requested status events + statusEvent.SetRequestedEvents(aReqEventsMask); + + // verify the set worked + if(statusEvent.RequestedEvents() != aReqEventsMask) + { + INFO_PRINTF2(_L("Requested Events don't match. Got0x%x"), statusEvent.RequestedEvents()); + return FALSE; + } + + CT_LbsAsyncWaiter* waiter = CT_LbsAsyncWaiter::NewL(); + + // Request module status event using supplied module id + iServer.NotifyModuleStatusEvent(statusEvent, waiter->iStatus, aModId); + + TPositionModuleStatusEvent::TModuleEvent eventsExpected = 0; + + // assume we are interested in the agps module since we can't control events from network module + ASSERT(aModId == agpsmodId || aModId == KPositionNullModuleId); + + // kick the test agps module to cause the requested status event(s) + TPckgBuf modDataInBuf; + TModuleDataIn& modDataIn = modDataInBuf(); + + modDataIn.iRequestType = TModuleDataIn::EModuleRequestEventKickOff; + modDataIn.iKickOffEventType = 0; + if(aReqEventsMask & TPositionModuleStatusEvent::EEventDeviceStatus) + { + modDataIn.iKickOffEventType |= TModuleDataIn::EKickOffEventTypeDevice; + eventsExpected |= TPositionModuleStatusEvent::EEventDeviceStatus; + } + + if(aReqEventsMask & TPositionModuleStatusEvent::EEventDataQualityStatus) + { + modDataIn.iKickOffEventType |= TModuleDataIn::EKickOffEventTypeDataQuality; + eventsExpected |= TPositionModuleStatusEvent::EEventDataQualityStatus; + } + + User::LeaveIfError(RProperty::Set(KUidSystemCategory, ELbsTestAGpsModuleIn, modDataInBuf)); + + + // Wait for event(s) + while(result && eventsExpected) + { + waiter->StartAndWait(); + User::LeaveIfError(waiter->Result()); + + + TInt result = waiter->Result(); + + TPositionModuleStatusEvent::TModuleEvent eventsOccurred = statusEvent.OccurredEvents(); + + ASSERT(eventsOccurred); + + if(result) + { + INFO_PRINTF2(_L("Unexpected error returned %d"), result); + result = FALSE; + } + // Verify correct event(s) happenned + else + { + + if(eventsOccurred & ~(eventsExpected)) + { + INFO_PRINTF2(_L("Unexpected event received 0x%x"), statusEvent.OccurredEvents()); + result = FALSE; + } + + if(statusEvent.ModuleId() == agpsmodId) + { + eventsExpected &= ~eventsOccurred; + } + + // Request next module status event + if (eventsExpected) + { + iServer.NotifyModuleStatusEvent(statusEvent, waiter->iStatus/*request*/, aModId); + } + } + } + + // TODO - appropriate to do this here? + // device status event happened. Read in new status (this will be verified in future test step): + statusEvent.GetModuleStatus(aModStatus); + + delete waiter; + + return result; + } + +/** + * Sets requested event mask as specified for agps module. + * Kicks test module to cause events requested then waits for event(s) + * Updates the supplied module status + * returns TRUE if everything went as expected, FALSE otherwise + */ + TBool CT_LbsClientStep_ModStat::DoRequestAndVerifyAGPSModStatusEventsL(TPositionModuleStatusEvent::TModuleEvent aReqEventsMask, TPositionModuleStatus& aModStatus) + { + TPositionModuleId modId; + + // we're interested in the agps module id + T_LbsUtils utils; + modId = utils.GetAGpsModuleIdL(iServer); + + return DoRequestAndVerifyModStatusEventsL(aReqEventsMask, aModStatus, modId); + } + + +/** + * Sets requested event mask as specified for supplied module and asks to be notified of events + * (note does not kick test module to cause events; use only if expect error to be returned) + * Waits for event and returns error + */ +TInt CT_LbsClientStep_ModStat::DoRequestModStatusEventsWithError(TPositionModuleStatusEvent::TModuleEvent aReqEventsMask, TPositionModuleId aModId) + { + //TRequestStatus request; + TPositionModuleStatusEvent statusEvent; + + statusEvent.SetRequestedEvents(aReqEventsMask); + + CT_LbsAsyncWaiter* waiter = CT_LbsAsyncWaiter::NewL(); + + iServer.NotifyModuleStatusEvent(statusEvent, waiter->iStatus, aModId); + + waiter->StartAndWait(); + + TInt result = waiter->Result(); + + //User::WaitForRequest(request); + delete waiter; + + return result; + + } + +TBool CT_LbsClientStep_ModStat::DoVerifyModStatus(TPositionModuleStatusEvent::TModuleEvent aExpectedModStatus,TPositionModuleId aModId) + { + // Initialise current module status. + TPositionModuleStatus& currentModStatus = iParent.iSharedData->iCurrentModuleStatus; + iServer.GetModuleStatus(currentModStatus,aModId); + + if(currentModStatus.DeviceStatus()!=aExpectedModStatus) + { + INFO_PRINTF3(_L("Module in Unexpected State - %d and not %d"),currentModStatus.DeviceStatus(),aExpectedModStatus); + SetTestStepResult(EFail); + return EFalse; + } + else + { + INFO_PRINTF2(_L("Module in Expected State %d"),aExpectedModStatus); + return ETrue; + } + } + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_ModStat::doTestStepL() + { + // Generic test step used to test the LBS Client Notify position update API. + INFO_PRINTF1(_L(">>CT_LbsClientStep_ModStat::doTestStepL()")); + + if (TestStepResult() == EPass) + { + TInt err = KErrNone; + + // Connect to self locate server. + User::LeaveIfError(iServer.Connect()); + CleanupClosePushL(iServer); + + // Carryout unique test actions. + TInt testCaseId; + if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId)) + { + switch (testCaseId) + { + // Test case LBS-ModStatus-0001 to 0004 + case 01: + case 02: + case 03: + case 04: + { + TPositionModuleId testmodId; + + T_LbsUtils utils; + testmodId = utils.GetAGpsModuleIdL(iServer); + + // Get the module device status. + TPositionModuleStatus& modStatus = iParent.iSharedData->iCurrentModuleStatus; + err = iServer.GetModuleStatus(modStatus, testmodId); + if(KErrNone != err) + { + INFO_PRINTF2(_L("Failed with err %d"), err); + SetTestStepResult(EFail); + } + } + break; + + // Test case LBS-ModStatus-0005 + case 05: + { + TPositionModuleId badmodId; + T_LbsUtils utils; + badmodId = utils.GetBadModuleId(); + + // Get the module device status. + TPositionModuleStatus moduleStatus; + + err = iServer.GetModuleStatus(moduleStatus, badmodId); + if(KErrNotFound != err) + { + INFO_PRINTF2(_L("Failed with err %d. Should have been KErrNotFound(-1)"), err); + SetTestStepResult(EFail); + } + } + break; + + // LBS-Mod-Status-Event-0002 + case 22: + { + TPositionModuleStatus& testmodStatus = iParent.iSharedData->iCurrentModuleStatus; + + // Get device status events for any module: + if(!DoRequestAndVerifyModStatusEventsL(TPositionModuleStatusEvent::EEventDeviceStatus, testmodStatus)) + { + SetTestStepResult(EFail); + } + } + break; + + // LBS-Mod-Status-Event-0003 + case 23: + { + TPositionModuleStatus& testmodStatus = iParent.iSharedData->iCurrentModuleStatus; + + // Get device status events for (test) agps module + if(!DoRequestAndVerifyAGPSModStatusEventsL(TPositionModuleStatusEvent::EEventDeviceStatus, testmodStatus)) + { + SetTestStepResult(EFail); + } + + // Get device status events again + if(!DoRequestAndVerifyModStatusEventsL(TPositionModuleStatusEvent::EEventDeviceStatus, testmodStatus)) + { + SetTestStepResult(EFail); + } + } + break; + + // LBS-Mod-Status-Event-0004 + case 24: + { + TPositionModuleStatus& testmodStatus = iParent.iSharedData->iCurrentModuleStatus; + + // Get device status events + if(!DoRequestAndVerifyAGPSModStatusEventsL(TPositionModuleStatusEvent::EEventDeviceStatus, testmodStatus)) + { + SetTestStepResult(EFail); + } + } + break; + + // LBS-Mod-Status-Event-0005 + case 25: + { + TPositionModuleStatus& testmodStatus = iParent.iSharedData->iCurrentModuleStatus; + // Get device status events + if(!DoRequestAndVerifyAGPSModStatusEventsL(TPositionModuleStatusEvent::EEventDataQualityStatus, testmodStatus)) + { + SetTestStepResult(EFail); + } + } + break; + + // LBS-Mod-Status-Event-0009 + case 29: + { + TPositionModuleStatus& testmodStatus = iParent.iSharedData->iCurrentModuleStatus; + + //In feature when system events support, change TPositionModuleStatusEvent::EEventAll + // Get device status events + if(!DoRequestAndVerifyAGPSModStatusEventsL(((TPositionModuleStatusEvent::EEventDeviceStatus)|(TPositionModuleStatusEvent::EEventDataQualityStatus)), testmodStatus)) + { + SetTestStepResult(EFail); + } + } + break; + + // LBS-Mod-Status-Event-0010 + case 30: + { + TPositionModuleId modId; + TInt err; + + // use bad module id + T_LbsUtils utils; + modId = utils.GetBadModuleId(); + + err = DoRequestModStatusEventsWithError(TPositionModuleStatusEvent::EEventDataQualityStatus, modId); + if(KErrNotFound != err) + { + SetTestStepResult(EFail); + } + } + break; + + // LBS-Mod-Status-Event-0011 + case 31: + { + TPositionModuleId modId; + TInt err; + + // use agps module id + T_LbsUtils utils; + modId = utils.GetAGpsModuleIdL(iServer); + + err = DoRequestModStatusEventsWithError(0, modId); + if(KErrArgument != err) + { + SetTestStepResult(EFail); + } + } + break; + + // LBS-Mod-Status-Event-0012 + case 32: + { + TPositionModuleId modId; + TRequestStatus request; + TPositionModuleStatusEvent statusEvent; + + // use agps module id + T_LbsUtils utils; + modId = utils.GetAGpsModuleIdL(iServer); + + statusEvent.SetRequestedEvents(TPositionModuleStatusEvent::EEventDeviceStatus); + + iServer.NotifyModuleStatusEvent(statusEvent, request, modId); + + TInt err = iServer.CancelRequest(EPositionServerNotifyModuleStatusEvent); + if(KErrNone == err) + { + User::WaitForRequest(request); + if(KErrCancel != request.Int()) + { + INFO_PRINTF2(_L("Failed: KErrCancel not returned, Got %d"), request.Int()); + SetTestStepResult(EFail); + } + } + else + { + INFO_PRINTF2(_L("Failed: CancelRequest returned error %d"), err); + SetTestStepResult(EFail); + } + } + break; + + // LBS-Mod-Status-Event-0013 + case 33: + { + TInt err = iServer.CancelRequest(EPositionServerNotifyModuleStatusEvent); + if(KErrNotFound != err) + { + INFO_PRINTF2(_L("Failed: CancelRequest returned error %d, expecting KErrNotFound"), err); + SetTestStepResult(EFail); + } + } + break; + + // LBS-Mod-Status-Event-0014 + case 34: + { + // close server since we don't want to be connected for this test + iServer.Close(); + + TInt err = iServer.CancelRequest(EPositionServerNotifyModuleStatusEvent); + + // if we get here, something went wrong, so panic + SetTestStepResult(EFail); + + User::Panic(KLbsClientStep_ModStatus, KErrGeneral); + } + break; + + // LBS-Mod-Status-Event-0015 + case 35: + { + TPositionModuleId modId; + TRequestStatus request; + TPositionModuleStatusEvent statusEvent; + + // use agps module id + T_LbsUtils utils; + modId = utils.GetAGpsModuleIdL(iServer); + + // set requested events mask + statusEvent.SetRequestedEvents(TPositionModuleStatusEvent::EEventDeviceStatus); + + // ask to be notified of requested events + iServer.NotifyModuleStatusEvent(statusEvent, request, modId); + + // ask to be notified of requested events a second time (panics) + iServer.NotifyModuleStatusEvent(statusEvent, request, modId); + + // if we get here, something went wrong, so panic + SetTestStepResult(EFail); + + User::Panic(KLbsClientStep_ModStatus, KErrGeneral); + } + break; + case 101: + { + // This test requires net sim to be open. + OpenNetSim(); + + // Select the network module. + T_LbsUtils utils; + TPositionModuleId modId; + modId = utils.GetNetworkModuleIdL(iServer); + User::LeaveIfError(iPositioner.Open(iServer, modId)); + CleanupClosePushL(iPositioner); + + // Initialise the position info variable. + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + CleanupStack::PushL(posInfo); + + // set requested events mask so we get notified on EEventDeviceStatus (any status change) + TPositionModuleStatusEvent statusEvent; + statusEvent.SetRequestedEvents(TPositionModuleStatusEvent::EEventDeviceStatus); + CT_LbsAsyncWaiter* waiter = CT_LbsAsyncWaiter::NewL(); + iServer.NotifyModuleStatusEvent(statusEvent, waiter->iStatus, modId); + + // Verify that the module status is ready before we make any requests. + DoVerifyModStatus(TPositionModuleStatus::EDeviceReady,modId); + + // Request a position update, we should then see a state change to EDeviceActive + TRequestStatus status; + INFO_PRINTF1(_L("Performing NotifyPositionUpdate()")); + iPositioner.NotifyPositionUpdate(*posInfo,status); + // Use the waiter object so that we can get the device status change. + waiter->StartAndWait(); + waiter->Result(); + + // Check that the change that happened was the correct thing. + TPositionModuleStatusEvent::TModuleEvent eventsExpected = TPositionModuleStatusEvent::EEventDeviceStatus; + TPositionModuleStatusEvent::TModuleEvent eventsOccurred = statusEvent.OccurredEvents(); + + if(eventsOccurred!=eventsExpected) + { + INFO_PRINTF1(_L("No Module Status Event have Occured")); + SetTestStepResult(EFail); + } + + + // Verify the device is now active + DoVerifyModStatus(TPositionModuleStatus::EDeviceActive,modId); + + INFO_PRINTF1(_L("Position Received")); + User::WaitForRequest(status); + + //Verify that the position is EDeviceReady again + DoVerifyModStatus(TPositionModuleStatus::EDeviceReady,modId); + + // Tidy up everything + CloseNetSim(); + delete waiter; + CleanupStack::PopAndDestroy(posInfo); + CleanupStack::PopAndDestroy(&iPositioner); + } + break; + default: + { + User::Panic(KLbsClientStep_ModStatus, KErrUnknown); + } + } + + + } + + // All done, clean up. + CleanupStack::PopAndDestroy(&iServer); + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_ModStat::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepmultireq.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepmultireq.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,463 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepmultireq.cpp +// This is the class implementation for the Multi-Request Tests +// +// + +#include "ctlbsclientstepmultireq.h" + +#include +#include +#include +#include + +#include "tlbsutils.h" + +// constant definitions +_LIT(KLbsClientStepMultiReq, "LbsClientStepMultiReq"); + + +/** + * Destructor + */ +CT_LbsClientStep_MultiReq::~CT_LbsClientStep_MultiReq() + { + delete iGetLastKnownPosAO; + delete iNotifyPosUpdateAO; + delete iTimer; + delete iTempPosInfo; + } + + +/** + * Constructor + */ +CT_LbsClientStep_MultiReq::CT_LbsClientStep_MultiReq(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent), iState(EStateUnknown), iTempPosInfo(NULL) + { + SetTestStepName(KLbsClientStep_MultiReq); + } + + +/** +Static Constructor +*/ +CT_LbsClientStep_MultiReq* CT_LbsClientStep_MultiReq::NewL(CT_LbsClientServer& aParent) + { + return new(ELeave) CT_LbsClientStep_MultiReq(aParent); + } + + +/** +Static Constructor +*/ +CT_LbsClientStep_MultiReq* CT_LbsClientStep_MultiReq::New(CT_LbsClientServer& aParent) + { + return new CT_LbsClientStep_MultiReq(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** + * Callback - called when NotifyPositionUpdate request completes + */ +void CT_LbsClientStep_MultiReq::NotifyPositionUpdateCallback(TRequestStatus& aStatus) +/** + * Called when async NotifyPositionUpdate completes + */ + { + TInt testCaseId; + + if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId)) + { + switch (testCaseId) + { + case 01: // multiple requests of different types + { + if(KErrNone == aStatus.Int()) + { + switch(iState) + { + case EStateUnknown: + { + iState = EStateLastNotifyPositionUpdateComplete; + } + break; + + case EStateLastKnownPositionComplete: + { + iState = EStateDone; + AsyncTidyUp(); + // note: we'll now drop back into the main test step + } + break; + + case EStateLastNotifyPositionUpdateComplete: + case EStateDone : + // fall through + default: + { + User::Panic(KLbsClientStepMultiReq, KErrUnknown); + } + break; + } + } + else + { + INFO_PRINTF2(_L("NotifyModuleStatusEvent completed. Status = %d"), aStatus.Int()); + SetTestStepResult(EFail); + AsyncTidyUp(); + } + }// end case 01 + break; + case 02: // + { + switch(iState) + { + case EStateUnknown: + { + iState = EStateLastNotifyPositionUpdateComplete; + } + break; + + case EStateLastKnownPositionComplete: + { + iState = EStateDone; + AsyncTidyUp(); + } + break; + + case EStateLastNotifyPositionUpdateComplete: + case EStateDone : + // fall through + default: + { + User::Panic(KLbsClientStepMultiReq, KErrUnknown); + } + break; + } + } + break; + default: + { + User::Panic(KLbsClientStepMultiReq, KErrUnknown); + } + + }// end switch testCaseId + }// end if GetIntFromConfig + } + + + +/** + * Callback - called when GetLastKnownPosition request completes + */ +void CT_LbsClientStep_MultiReq::GetLastKnownPositionCallback(TRequestStatus& aStatus) +/** + * Called when NotifyModuleStatusEvent completes + */ + { + TInt testCaseId; + + if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId)) + { + switch (testCaseId) + { + case 01: // multiple requests of different types + { + if(KErrNone == aStatus.Int()) + { + switch(iState) + { + case EStateUnknown: + { + iState = EStateLastKnownPositionComplete; + } + break; + + case EStateLastNotifyPositionUpdateComplete: + { + iState = EStateDone; + AsyncTidyUp(); + // note: we'll now drop back into the main test step + } + break; + + case EStateLastKnownPositionComplete: + case EStateDone : + // fall through + default: + { + User::Panic(KLbsClientStepMultiReq, KErrUnknown); + } + break; + + } + } + else + { + INFO_PRINTF2(_L("NotifyModuleStatusEvent completed. Status =%d"), aStatus.Int()); + SetTestStepResult(EFail); + AsyncTidyUp(); + } + + }// end case 01 + break; + case 02: // NotifyPositionUpdate then GetLKP, latter cancelled + { + switch(iState) + { + case EStateUnknown: + { + iState = EStateLastKnownPositionComplete; + TInt err = aStatus.Int(); + switch(err) + { + case KErrNone: + { + INFO_PRINTF1(_L("MultiReq test: Last Known Position request completed successfully")); + } + break; + case KErrCancel: + { + INFO_PRINTF1(_L("MultiReq test: Last Known Position request completed with KErrCancel")); + } + break; + case KErrUnknown: + { + INFO_PRINTF1(_L("MultiReq test: Last Known Position request completed with KErrUnknown")); + } + break; + default: + { + + SetTestStepResult(EFail); + AsyncTidyUp(); + } + break; + } + } + break; + + case EStateLastNotifyPositionUpdateComplete: + { + iState = EStateDone; + TInt err = aStatus.Int(); + if(KErrNone != err) + { + SetTestStepResult(EFail); + } + AsyncTidyUp(); + } + break; + + case EStateLastKnownPositionComplete: + case EStateDone : + // fall through + default: + { + User::Panic(KLbsClientStepMultiReq, KErrUnknown); + } + }// end switch(iState) + }// end case 2 + break; + + default: + { + User::Panic(KLbsClientStepMultiReq, KErrUnknown); + } + break; + } + } + } + + +/** + * tidy up everything + */ +void CT_LbsClientStep_MultiReq::AsyncTidyUp() + { + if ( iTimer->IsActive() ) + { + iTimer->Cancel(); + } + // Cancel any outstanding requests (to be tested): + if(iNotifyPosUpdateAO->IsActive()) + { + iNotifyPosUpdateAO->Cancel(); + } + if(iGetLastKnownPosAO->IsActive()) + { + iGetLastKnownPosAO->Cancel(); + } + CActiveScheduler::Stop(); + } + + +/** + * Callback function - called if timer fires (requests did not all complete in time) + */ +static TInt TimerCallback(TAny* aPointer) + { + //the timer expired and we have not got the responses to our lbs requests + static_cast(aPointer)->INFO_PRINTF1(_L(">>TEST FAILED: timer fired")); + static_cast(aPointer)->AsyncTidyUp(); + static_cast(aPointer)->SetTestStepResult(EFail); + + return KErrNone; + } + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_MultiReq::doTestStepL() + { + // Generic test step used to test the LBS Client Notify position update API. + INFO_PRINTF1(_L(">>CT_LbsClientStep_MultiReq::doTestStepL()")); + + if (TestStepResult()==EPass) + { + // Connect to self locate server. + User::LeaveIfError(iServer.Connect()); + CleanupClosePushL(iServer); + + TInt testCaseId; + if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId)) + { + switch (testCaseId) + { + case 01: // multiple requests of different types + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + // Carry out a notify update to ensure last known cache is filled (note: this blocks!) + TPositionInfo notifyPosInfo; + User::LeaveIfError(DoNotifyUpdateL(notifyPosInfo)); + + // Create 2 posinfos and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfoLastKnown = new(ELeave) TPositionInfo(); + TPositionInfo* posInfoNotifyUpd = new(ELeave) TPositionInfo(); + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + // these get deleted by the base class destructor + posInfoArr.Append(posInfoLastKnown); + posInfoArr.Append(posInfoNotifyUpd); + + // Start GetLastKnownPosition request: + iGetLastKnownPosAO = CT_LbsClientGetLastKnownPosAO::NewL(*this); + + iGetLastKnownPosAO->GetLastKnownPosL(iPositioner, *posInfoLastKnown); + + // Start NotifyPositionUpdate request: + iNotifyPosUpdateAO = CT_LbsClientNotifyPosUpdAO::NewL(*this); + + iNotifyPosUpdateAO->NotifyPosUpdateL(iPositioner, *posInfoNotifyUpd); + + // Start a timer to make sure neither of above times out: + iTimer = CPeriodic::New(CActive::EPriorityStandard); + TCallBack callbackFunction = TCallBack(TimerCallback, this); + iTimer->Start( delay10Seconds, 0, callbackFunction); + + // can start the scheduler now as there are async requests issued + CActiveScheduler::Start(); + + // All requests have now completed (and scheduler stopped) + + CleanupStack::PopAndDestroy(&iPositioner); + } // end case 1 + break; + + case 02: // cancel one of two outstanding requests + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfoNotifyUpd = new(ELeave) TPositionInfo(); + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + // this gets deleted by the base class destructor: + posInfoArr.Append(posInfoNotifyUpd); + + // Start NotifyPositionUpdate request: + iNotifyPosUpdateAO = CT_LbsClientNotifyPosUpdAO::NewL(*this); + + iNotifyPosUpdateAO->NotifyPosUpdateL(iPositioner, *posInfoNotifyUpd); + + // Start a GetLastKnownPosition: + // don't put in verify array as this may be cancelled: + iTempPosInfo = new(ELeave) TPositionInfo(); + + iGetLastKnownPosAO = CT_LbsClientGetLastKnownPosAO::NewL(*this); + + iGetLastKnownPosAO->GetLastKnownPosL(iPositioner, *iTempPosInfo); + + // cancel the last known position. Note that we do this directly, NOT by calling the AO's cancel() + // so that the AO's RunL(), and therefore our callback, will be called and we can check the result + TInt err; + err = iPositioner.CancelRequest(EPositionerGetLastKnownPosition); + if(KErrNotFound != err) + { + SetTestStepResult(EFail); + } + + // Start a timer to make sure neither of above times out: + iTimer = CPeriodic::New(CActive::EPriorityStandard); + TCallBack callbackFunction = TCallBack(TimerCallback, this); + + // + // + // NB - THIS VALUE WAS 10 SEC AND THE TIMER EXPIRED, CAUSING THE TEST + // TO FAIL. NEED TO FIND OUT WHY THIS VALUE IS OK BUT THAT ONE WAS NOT. + // PUT BACK TEMPORARILY TO GET RID OF REGRESSION FAILURE + // + iTimer->Start( 22000000, 0, callbackFunction); + + // can start the scheduler now as there are async requests issued + CActiveScheduler::Start(); + + // All requests have now completed + + CleanupStack::PopAndDestroy(&iPositioner); + } + break; + + default: + { + User::Leave(KErrArgument); + } + }// end switch + }//end if GetIntFromConfig + + CleanupStack::PopAndDestroy(&iServer); + + } // end if TestStepResult + + INFO_PRINTF1(_L("<<CT_LbsClientStep_MultiReq::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepnotifyposupdate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepnotifyposupdate.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,1441 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstep_notifyposupdate.cpp +// This is the class implementation for the Notify Position Update Tests +// +// + +#include "ctlbsclientstepnotifyposupdate.h" + +#include +#include + +#include "tlbsutils.h" +#include "ctlbsasyncwaiter.h" + + +// constant definitions +_LIT(KLbsClientStepNotifyPosUpdate, "LbsClientStepNotifyPosUpdate"); + +//profile_id in ini file +_LIT(KLbsProfileId, "profile_id"); + +//max_time in ini file +_LIT(KLbsMaxTime, "max_time"); + + +const TTimeIntervalMicroSeconds KModuleTimeout = 6000000;//makes test module time out(which should be more than the Maxtime in lbsprofile.ini) + +/** + * Sets a Requestor for now - TODO will be removed with new location server + */ +void CT_LbsClientStep_NotifyPosUpdate::TempSetRequestorL() + { + User::LeaveIfError(iPositioner.SetRequestor( CRequestor::ERequestorService, + CRequestor::EFormatApplication, + _L("Tom Tom"))); + } + + +/** + * Destructor + */ +CT_LbsClientStep_NotifyPosUpdate::~CT_LbsClientStep_NotifyPosUpdate() + { + delete iLbsAdmin; + } + + +/** + * Constructor + */ +CT_LbsClientStep_NotifyPosUpdate::CT_LbsClientStep_NotifyPosUpdate(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent),iLbsAdmin(NULL),iRequestedAssData(FALSE), iReceivedAssData(FALSE) + { + + SetTestStepName(KLbsClientStep_NotifyPosUpdate); + } + + +/** +Static Constructor +*/ +CT_LbsClientStep_NotifyPosUpdate* CT_LbsClientStep_NotifyPosUpdate::New(CT_LbsClientServer& aParent) + { + + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + + CT_LbsClientStep_NotifyPosUpdate* testStep = new CT_LbsClientStep_NotifyPosUpdate(aParent); + if (testStep) + { + TInt err = KErrNone; + + TRAP(err, testStep->ConstructL()); + if (err) + { + delete testStep; + testStep = NULL; + } + } + return testStep; + } + + +void CT_LbsClientStep_NotifyPosUpdate::ConstructL() + { + // create the admin + iLbsAdmin = CLbsAdmin::NewL(); + + } + +//from MT_NotifyPosUpdateObserver: +/** + * Callback - called when NotifyPositionUpdate request completes + */ + +void CT_LbsClientStep_NotifyPosUpdate::NotifyPositionUpdateCallback(TRequestStatus& aStatus) + { + TInt err = aStatus.Int(); + if (KErrCancel != err) + { + SetTestStepResult(EFail); // the request always gets cancelled (see test 0122) + } + CActiveScheduler::Stop(); + } + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_NotifyPosUpdate::doTestStepL() + { + // Generic test step used to test the LBS Client Notify position update API. + INFO_PRINTF1(_L(">>CT_LbsClientStep_NotifyPosUpdate::doTestStepL()")); + + if (TestStepResult()==EPass) + { + TInt err = KErrNone; + + // Connect to self locate server. + err = iServer.Connect(); + User::LeaveIfError(err); + CleanupClosePushL(iServer); + + // Carryout unique test actions. + TInt testCaseId; + if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId)) + { + switch (testCaseId) + { + // Test case LBS-NotifyPosUpdate-0001 + case 1: + case 29: // Test case LBS-NotifyPosUpdate-0029 + case 30: // Test case LBS-NotifyPosUpdate-0030 + case 101: + case 105: + case 201: // in Lbs "original" mode no ref position! + { + T_LbsUtils utils; + + // Open positioner. + err = iPositioner.Open(iServer); + User::LeaveIfError(err); + CleanupClosePushL(iPositioner); + + // For this test an additional reference position will be returned. + if ((testCaseId == 101) || (testCaseId == 105)) + { + + if (testCaseId == 105) + { + TModuleDataIn modDataIn; // Used to send test information to the test module. + modDataIn.iRequestType = TModuleDataIn::EModuleRequestTestMode; + modDataIn.iAssDataTestMode = TModuleDataIn::EModuleTestModeAssDataOn_EarlyPosUpdates; + // Inform the test module of the required test mode - will block. + utils.NotifyModuleOfConfigChangeL(modDataIn); + } + + // Setup netsim. + User::LeaveIfError(OpenNetSim()); + + // Request notify for the expected reference position. + TPositionInfo actualRefPosInfo; + + err = DoNotifyUpdateL(actualRefPosInfo); + if (err) + { + INFO_PRINTF2(_L("Failed test, reference position request returned err %d."), err); + + SetTestStepResult(EFail); + } + + // Verify reference position. + TPositionInfo verifyRefPosInfo; + + verifyRefPosInfo.SetPosition(iRefPos); + if (!utils.Compare_PosInfo(verifyRefPosInfo, actualRefPosInfo)) + { + if(!iParent.iSharedData->iTestModuleInUse) + { + WARN_PRINTF1(_L("WARNING: position received was not reference position")); + } + else + { + INFO_PRINTF1(_L("Failed test, reference position incorrect.")); + SetTestStepResult(EFail); + } + } + } + + + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + posInfoArr.Append(posInfo); + + // Get the actual position + err = DoNotifyUpdateL(*posInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + // Cleanup. + CleanupStack::PopAndDestroy(&iPositioner); + if ((testCaseId == 101) || (testCaseId == 105)) + { + CloseNetSim(); + } + + break; + } + + + // Test case LBS-NotifyPosUpdate-0003 + case 3: + { + // Select the Network module because it does not support TPositionSatelliteInfo, + // then request position update and expect satellite info, which should return + // in KErrArgument. + TPositionModuleId modId; + + T_LbsUtils utils; + modId = utils.GetNetworkModuleIdL(iServer); + + // Select the network module. + User::LeaveIfError(iPositioner.Open(iServer, modId)); + CleanupClosePushL(iPositioner); + + // Try to get the actual position, using TPositionSatellite which is not + // supported by the selected module. + TPositionSatelliteInfo posInfo; + + err = DoNotifyUpdateL(posInfo); + if (KErrArgument == err) + { + INFO_PRINTF2(_L("correct err %d returned"), err); + } + else + { + INFO_PRINTF2(_L("incorrect err %d returned"), err); + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + break; + } + + // Test case LBS-NotifyPosUpdate-0005 + case 5: + { + + CLbsAdmin::TSelfLocateService selflocate; + + + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeSelfLocate, CLbsAdmin::ESelfLocateOff)); + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingHomeSelfLocate, selflocate)); + + if(selflocate != CLbsAdmin::ESelfLocateOff) + { + SetTestStepResult(EFail); + } + else + { + // Open positioner. + err = iPositioner.Open(iServer); + User::LeaveIfError(err); + CleanupClosePushL(iPositioner); + + TPositionInfo notifyPosInfo; + err = DoNotifyUpdateL(notifyPosInfo); + if(KErrAccessDenied != err) + { + SetTestStepResult(EFail); + } + } + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeSelfLocate, CLbsAdmin::ESelfLocateOn)); + + CleanupStack::PopAndDestroy(&iPositioner); + + } + break; + + // Test case LBS-NotifyPosUpdate-0006 + case 6: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + TPositionInfo posInfoNotifyUpd; + + TRequestStatus status; + TBool cancelled; + + TempSetRequestorL(); + iPositioner.NotifyPositionUpdate(posInfoNotifyUpd, status); + + TInt err = iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); + + if(KErrNone == err) + { + cancelled = TRUE; + } + else + { + cancelled = FALSE; + } + + // this should complete with either KErrNone or KErrCancel + User::WaitForRequest(status); + + err = status.Int(); + + if(cancelled) + { + if((KErrCancel != err) && (KErrNone != err)) + { + SetTestStepResult(EFail); + } + } + else + { + if(KErrNone != err) + { + SetTestStepResult(EFail); + } + } + + CleanupStack::PopAndDestroy(&iPositioner); + + } + break; + + // Test case LBS-NotifyPosUpdate-0007 + case 7: + { + // Note: Not connecting to position server. + TPositionInfo notifyPosInfo; + TRequestStatus status; + + // should panic with EPositionServerBadHandle + iPositioner.NotifyPositionUpdate(notifyPosInfo, status); + } + break; + + // Test case LBS-NotifyPosUpdate-0008 + case 8: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + TPositionInfo notifyPosInfo, notifyPosInfo2; + TRequestStatus status, status2; + + TempSetRequestorL(); + // attempt multiple NotifyPositionUpdates on same subsession: + iPositioner.NotifyPositionUpdate(notifyPosInfo, status); + + // expected to panic with EPositionDuplicateRequest: + iPositioner.NotifyPositionUpdate(notifyPosInfo2, status2); + + // need to block here so that loc server can run and recieve both + // requests - its the second request that causes the panic! + User::After(1); + // if we get here, we've failed to panic + SetTestStepResult(EFail); + + CleanupStack::PopAndDestroy(&iPositioner); + } + break; + + // Test case LBS-NotifyPosUpdate-0014 INCOMPLETE + case 14: + { + // Set 'autonomous' mode + CLbsAdmin::TGpsMode mode; + + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsAutonomous)); + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingHomeGpsMode, mode)); + + // TODO: figure out how to get notifications of assistance data requests (MLbsNetSimTestObserver?) + // If we get notification before Notify Update completes, then we fail + + if(mode != CLbsAdmin::EGpsAutonomous) + { + SetTestStepResult(EFail); + } + else // Request a location update + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + // Create a posinfos and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + TPositionInfo* posInfoNotifyUpd = new(ELeave) TPositionInfo(); + + posInfoArr.Append(posInfoNotifyUpd); + + err = DoNotifyUpdateL(*posInfoNotifyUpd); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + } + + + } + break; + + // Test case LBS-NotifyPosUpdate-0015 UNSUPPORTED + case 15: + { + // this test should not be run; lbs currently doesn't support AlwaysTerminalBased mode + __ASSERT_ALWAYS(FALSE, User::Panic(_L("LBS-NotifyPosUpdate-0015 should not be run"), KErrNotSupported)); + + // Set 'assisted-only' (EGpsAlwaysTerminalBased) mode + CLbsAdmin::TGpsMode mode; + + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsAlwaysTerminalBased)); + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingHomeGpsMode, mode)); + + // TODO: figure out how to get notifications of assistance data requests (MLbsNetSimTestObserver?) + // If we do not get notification before Notify Update completes, then we fail + + if(mode != CLbsAdmin::EGpsAlwaysTerminalBased) + { + SetTestStepResult(EFail); + } + else // Request a location update + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + // Create a posinfos and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + TPositionInfo* posInfoNotifyUpd = new(ELeave) TPositionInfo(); + + posInfoArr.Append(posInfoNotifyUpd); + + err = DoNotifyUpdateL(*posInfoNotifyUpd); // can use this blocking version if netsim uses callbacks for assistance data notifications + // TODO iRequestedAssData needs to be set in assist data callback + if (KErrNone != err || !iRequestedAssData || !iReceivedAssData) + { + SetTestStepResult(EFail); + } + + // verify that preferred positioning mode was used: + if(EPositionModeReasonNone != posInfoNotifyUpd->PositionMode()) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + } + } + break; + + // Test case LBS-NotifyPosUpdate-0016 INCOMPLETE + case 16: + { + // Set 'assisted-if-possible' (EGpsPreferTerminalBased) mode + CLbsAdmin::TGpsMode mode; + + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsPreferTerminalBased)); + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingHomeGpsMode, mode)); + + #pragma message("TO DO: LBS-NotifyPosUpdate-0016 INCOMPLETE") + // figure out how to get notifications of assistance data requests (MLbsNetSimTestObserver?) + // If we do not get notification before Notify Update completes, then we fail + + // do we need to do something to make sure that we require assistancce data (no assistance data already retrieved)? + + // Configure NetSim to indciate that network is not available + + + if(mode != CLbsAdmin::EGpsPreferTerminalBased) + { + SetTestStepResult(EFail); + } + else // Request a location update + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + // Create a posinfos and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + TPositionInfo* posInfoNotifyUpd = new(ELeave) TPositionInfo(); + + posInfoArr.Append(posInfoNotifyUpd); + + err = DoNotifyUpdateL(*posInfoNotifyUpd); // can use this blocking version if netsim uses callbacks for assistance data notifications + if (KErrNone != err || !iRequestedAssData) + { + SetTestStepResult(EFail); + } + + // verify that preferred positioning mode was not used: + if(EPositionModeReasonNetworkError != posInfoNotifyUpd->PositionMode()) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + } + } + break; + + // Test case LBS-NotifyPosUpdate-0017 UNSUPPORTED + case 17: + { + // this test should not be run; lbs currently doesn't support AlwaysTerminalBased mode + __ASSERT_ALWAYS(FALSE, User::Panic(_L("LBS-NotifyPosUpdate-0017 should not be run"), KErrNotSupported)); + + // Set 'assisted-only' (EGpsAlwaysTerminalBased) mode + CLbsAdmin::TGpsMode mode; + + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsAlwaysTerminalBased)); + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingHomeGpsMode, mode)); + + // Configure NetSim to indciate that network is not available + + + if(mode != CLbsAdmin::EGpsAlwaysTerminalBased) + { + SetTestStepResult(EFail); + } + else // Request a location update + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + TPositionInfo posInfoNotifyUpd; + + err = DoNotifyUpdateL(posInfoNotifyUpd); // can use this blocking version if netsim uses callbacks for assistance data notifications + if (KErrPositionMethodFailure != err) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + } + } + break; + + // Test case LBS-NotifyPosUpdate-0018 INCOMPLETE + case 18: + { + #pragma message("TO DO: LBS-NotifyPosUpdate-0018 INCOMPLETE") + // Set 'assisted-if-possible' (EGpsPreferTerminalBased) mode + CLbsAdmin::TGpsMode mode; + + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsPreferTerminalBased)); + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingHomeGpsMode, mode)); + + // TODO: figure out how to get notifications of assistance data requests (MLbsNetSimTestObserver?) + // If we do not get notification before Notify Update completes, then we fail + + // TODO: do we need to do something to make sure that we require assistancce data (no assistance data already retrieved)? + + // TODO Configure NetSim to return bad/no assistance data + // this may involve writing an assistance data plugin to provide bad data!? + + if(mode != CLbsAdmin::EGpsPreferTerminalBased) + { + SetTestStepResult(EFail); + } + else // Request a location update + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + // Create a posinfos and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + TPositionInfo* posInfoNotifyUpd = new(ELeave) TPositionInfo(); + + posInfoArr.Append(posInfoNotifyUpd); + + err = DoNotifyUpdateL(*posInfoNotifyUpd); // can use this blocking version if netsim uses callbacks for assistance data notifications + if (KErrNone != err || !iRequestedAssData) + { + SetTestStepResult(EFail); + } + + // verify that preferred positioning mode was not used and appropriate reason given: + if(EPositionModeReasonDataError != posInfoNotifyUpd->PositionMode()) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + } + } + break; + + // Test case LBS-NotifyPosUpdate-0019 + case 19: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + // Create a posinfos and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + TInt numPositions = iParent.iSharedData->iVerifyPosInfoArr.Count(); + while(numPositions--) + { + TPositionInfo* posInfoNotifyUpd = new(ELeave) TPositionInfo(); + + posInfoArr.Append(posInfoNotifyUpd); + + User::After(500*1000); // on Winscw all the target time requests + // can get stamped with exactly the same + // time and thus all three requests may be + // satified from the one the bus + // then the test fails! This behaviour is OK but + // not what the test is trying to test for . Hence ensure + // all three target times are different by the delay + + err = DoNotifyUpdateL(*posInfoNotifyUpd); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + } + + // Cleanup. + CleanupStack::PopAndDestroy(&iPositioner); + } + break; + + // Test case LBS-NotifyPosUpdate-0022 + case 22: + { + TInt profileid_ini,maxtime_ini; + TBool profileid_exists,maxtime_exists; + profileid_exists = GetIntFromConfig(ConfigSection(), KLbsProfileId, profileid_ini); + if(!profileid_exists) + { + INFO_PRINTF1(_L("Could not get profileid from ini file")); + SetTestStepResult(EFail); + } + + maxtime_exists = GetIntFromConfig(ConfigSection(), KLbsMaxTime, maxtime_ini); + if(!maxtime_exists) + { + INFO_PRINTF1(_L("Could not get maxtime from ini file")); + SetTestStepResult(EFail); + } + + TLbsQualityProfileId profileId; + //Set SelfLocate quality profile & valid id(which is exist in lbsprofile.ini) + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingQualityProfileSelfLocate, TLbsQualityProfileId(profileid_ini))); + // Verify that the setting is what we expect + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingQualityProfileSelfLocate, profileId)); + if(profileId != TLbsQualityProfileId(profileid_ini)) + { + SetTestStepResult(EFail); + } + else // Request a location update + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + // Create a posinfos and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + TPositionInfo* posInfoNotifyUpd = new(ELeave) TPositionInfo(); + posInfoArr.Append(posInfoNotifyUpd); + + TTime timeRequested,timeReceived; + + // Position requested at + timeRequested.UniversalTime(); + + //Do request position update + err = DoNotifyUpdateL(*posInfoNotifyUpd); + if ((KErrNone != err) && (KPositionQualityLoss != err)) + { + INFO_PRINTF2(_L("NotifyUpdate failed with %d "), err); + SetTestStepResult(EFail); + } + //Need to verify MaxTime + else + { + // Check we dont have a final network postion + if (posInfoNotifyUpd->PositionMode() & TPositionModuleInfo::ETechnologyNetwork) + { + INFO_PRINTF1(_L("Failed: Recieved a final network postion")); + SetTestStepResult(EFail); + } + + TPosition pos; + posInfoNotifyUpd->GetPosition(pos); + //Position received at + timeReceived = pos.Time(); + + //Timedifference between position actually received and position actually requested + TInt64 timediff; + timediff = timeReceived.Int64() - timeRequested.Int64(); + //compare timediff with maxtime + if(timediff > maxtime_ini) + { + INFO_PRINTF1(_L("Failed: Position received outside time range")); + SetTestStepResult(EFail); + } + + } + + CleanupStack::PopAndDestroy(&iPositioner); + } + } + break; + + // Test case LBS-NotifyPosUpdate-0024 + case 24: + // Test case LBS-NotifyPosUpdate-0025 + case 25: + { + TInt profileid_ini; + TBool profileid_exists; + profileid_exists = GetIntFromConfig(ConfigSection(), KLbsProfileId, profileid_ini); + if(!profileid_exists) + { + INFO_PRINTF1(_L("Could not get profileid from section")); + SetTestStepResult(EFail); + } + + TLbsQualityProfileId profileId; + //Set SelfLocate quality profile & valid id(which is exist in lbsprofile.ini) + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingQualityProfileSelfLocate, TLbsQualityProfileId(profileid_ini))); + // Verify that the setting is what we expect + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingQualityProfileSelfLocate, profileId)); + if(profileId != TLbsQualityProfileId(profileid_ini)) + { + SetTestStepResult(EFail); + } + else // Request a location update + { + if(testCaseId==24) + { + //makes test module timeout + if (iParent.iSharedData->iTestModuleInUse) + { + T_LbsUtils utils; + TModuleDataIn modDataIn; + + modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut; + modDataIn.iTimeOut = KModuleTimeout; + + utils.NotifyModuleOfConfigChangeL(modDataIn); // This will block. + } + } + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + TPositionInfo posInfoNotifyUpd; + //Do request to position update + err = DoNotifyUpdateL(posInfoNotifyUpd); + //Position received at + + if (testCaseId == 24) + { + if (err != KErrTimedOut) + { + INFO_PRINTF1(_L("position update not failed with error -33")); + SetTestStepResult(EFail); + } + + } + else + { + if (err != KPositionQualityLoss) + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + } + } + break; + + // Test case LBS-NotifyPosUpdate-0027 + case 27: + // Test case LBS-NotifyPosUpdate-0028 + case 28: + { + TInt profileid_ini; + TBool profileid_exists; + TPositionUpdateOptions options; + T_LbsUtils utils; + + profileid_exists = GetIntFromConfig(ConfigSection(), KLbsProfileId, profileid_ini); + if(!profileid_exists) + { + INFO_PRINTF1(_L("Could not get profileid from ini file")); + SetTestStepResult(EFail); + } + + //Set SelfLocate quality profile & valid id(which is exist in lbsprofile.ini) + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingQualityProfileSelfLocate, TLbsQualityProfileId(profileid_ini))); + + if(testCaseId==28) + { + //makes test module timeout + const TTimeIntervalMicroSeconds KModuleTimeout = 60000000; // 1 minute + if (iParent.iSharedData->iTestModuleInUse) + { + T_LbsUtils utils; + TModuleDataIn modDataIn; + + modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut; + modDataIn.iTimeOut = KModuleTimeout; + + utils.NotifyModuleOfConfigChangeL(modDataIn); // This will block. + } + } + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + // Create a posinfos and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + TPositionInfo* posInfoUpd = new(ELeave) TPositionInfo(); + posInfoArr.Append(posInfoUpd); + + + options.SetUpdateInterval(0); + const TTimeIntervalMicroSeconds KMaxFix = 30000000; // 30s + options.SetUpdateTimeOut(KMaxFix); + iPositioner.SetUpdateOptions(options); + + err = DoNotifyUpdateL(*posInfoUpd); + + if (testCaseId == 27) + { + if (err != KPositionQualityLoss) + SetTestStepResult(EFail); + } + else + { + if (err != KErrTimedOut) + SetTestStepResult(EFail); + } + // Cleanup. + CleanupStack::PopAndDestroy(&iPositioner); + } + break; + + case 26: + { + //Set up a 15 second interval between updates, with a 5 second timeout + TPositionUpdateOptions posUpdateOpts(15000000, 5000000, 0, EFalse); + + // Open positioner. + err = iPositioner.Open(iServer); + User::LeaveIfError(err); + if(err != KErrNone) + { + INFO_PRINTF1(_L("** SubSession Failed to open **")); + SetTestStepResult(EFail); + } + CleanupClosePushL(iPositioner); + + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + CleanupStack::PushL(posInfo); + + iPositioner.SetUpdateOptions(posUpdateOpts); + User::LeaveIfError(iPositioner.SetRequestor( CRequestor::ERequestorService, + CRequestor::EFormatApplication, + _L("Tom Tom"))); + TRequestStatus status; + + //Ask for a position update (should get this one) + iPositioner.NotifyPositionUpdate(*posInfo,status); + + User::WaitForRequest(status); + if(status != KErrNone) + { + INFO_PRINTF2(_L("Failed test, expected KErrNone, request finished with err %d."), status.Int()); + SetTestStepResult(EFail); + } + +const TTimeIntervalMicroSeconds KModuleTimeout = 60000000; // 1 minute +const TTimeIntervalMicroSeconds KModuleNoTimeout = 0; + // Set a delay in the test AGPS manager big enough to guarantee + // we won't get a response to the next one + if (iParent.iSharedData->iTestModuleInUse) + { + T_LbsUtils utils; + TModuleDataIn modDataIn; + + modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut; + modDataIn.iTimeOut = KModuleTimeout; + + utils.NotifyModuleOfConfigChangeL(modDataIn); // This will block. + } + + // Try again. Shouldn't get a response this time as it times out. + iPositioner.NotifyPositionUpdate(*posInfo,status); + + User::WaitForRequest(status); + if(status != KErrTimedOut) + { + INFO_PRINTF2(_L("Failed test, expected KErrTimedOut, request finished with err %d."), status.Int()); + SetTestStepResult(EFail); + } + + // Get rid of the AGPS manager delay. + if (iParent.iSharedData->iTestModuleInUse) + { + T_LbsUtils utils; + TModuleDataIn modDataIn; + + modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut; + modDataIn.iTimeOut = KModuleNoTimeout; + + utils.NotifyModuleOfConfigChangeL(modDataIn); // This will block. + } + + //Ask for a position update (should get this one again) + iPositioner.NotifyPositionUpdate(*posInfo,status); + + User::WaitForRequest(status); + if(status != KErrNone) + { + INFO_PRINTF2(_L("Failed test, expected KErrNone, request finished with err %d."), status.Int()); + SetTestStepResult(EFail); + } + + iPositioner.Close(); + + CleanupStack::PopAndDestroy(posInfo); + CleanupStack::PopAndDestroy(&iPositioner); + } // case 26 + break; + // Test case LBS-NotifyPosUpdate-0122 + case 122: + { + const TLbsQualityProfileId KLbsTest0122QualityProfileId = 5; + TLbsQualityProfileId profileId122(KLbsTest0122QualityProfileId); + TLbsQualityProfileId oldProfileId(9); + iLbsAdmin->Get(KLbsSettingQualityProfileSelfLocate, oldProfileId); + + iLbsAdmin->Set(KLbsSettingQualityProfileSelfLocate, profileId122); + + iLbsAdmin->Get(KLbsSettingQualityProfileSelfLocate, profileId122); + if (profileId122 != KLbsTest0122QualityProfileId) + { + INFO_PRINTF2(_L("Fail test: profile should be 5 but its %d."), profileId122); + SetTestStepResult(EFail); + } + + // the profile.ini file contains a MaxTime= 2147483647 + CT_LbsClientNotifyPosUpdAO* notifyPosUpdateAO; + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfoNotifyUpd = new(ELeave) TPositionInfo(); + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + // this gets deleted by the base class destructor: + posInfoArr.Append(posInfoNotifyUpd); + + TModuleDataIn modDataIn; + + modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut; + modDataIn.iTimeOut = KModuleTimeout; + + utils.NotifyModuleOfConfigChangeL(modDataIn); // This will block. + + // Start NotifyPositionUpdate request: + notifyPosUpdateAO = CT_LbsClientNotifyPosUpdAO::NewL(*this); + + notifyPosUpdateAO->NotifyPosUpdateL(iPositioner, *posInfoNotifyUpd); + // User::After(3*1000*1000); + + + TInt err; + err = iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); + if(KErrNone != err) + { + SetTestStepResult(EFail); + } + + // can start the scheduler now as there are async requests issued + CActiveScheduler::Start(); + + CleanupStack::PopAndDestroy(&iPositioner); + + iLbsAdmin->Set(KLbsSettingQualityProfileSelfLocate, oldProfileId); + + + } + break; + + // Test that the final network position is not passed on to the client if they + // switch to autonomous mode mid-way through a session. + case 1001: + { + // Set preferred TB mode + // Set 'assisted-if-possible' (EGpsPreferTerminalBased) mode + CLbsAdmin::TGpsMode mode; + + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsPreferTerminalBased)); + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingHomeGpsMode, mode)); + + if(mode != CLbsAdmin::EGpsPreferTerminalBased) + { + SetTestStepResult(EFail); + } + else // Request a location update + { + + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + + const TTimeIntervalMicroSeconds KMicroSecondsValue(60*1000*1000); + TPositionUpdateOptions posOption; + posOption.SetUpdateTimeOut(KMicroSecondsValue); + User::LeaveIfError(iPositioner.SetUpdateOptions(posOption)); + + CleanupClosePushL(iPositioner); + + // Create a posinfos and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + // Setup netsim. + User::LeaveIfError(OpenNetSim()); + TLbsNetPosRequestQuality quality; + quality.SetMinHorizontalAccuracy(200); + quality.SetMinVerticalAccuracy(20000); + iNetSim.SetQuality(quality); + + TPositionInfo* posInfoNotifyUpd = new(ELeave) TPositionInfo(); + + posInfoArr.Append(posInfoNotifyUpd); + + // Send the first NPUD & block on response + err = DoNotifyUpdateL(*posInfoNotifyUpd); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + // Set autonomous mode + CLbsAdmin::TGpsMode mode; + + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsAutonomous)); + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingHomeGpsMode, mode)); + + if(mode != CLbsAdmin::EGpsAutonomous) + { + SetTestStepResult(EFail); + } + else // Request a location update + { + //TPositionModuleInfo::TTechnologyType techType; + + // Send the second NPUD & block on response + err = DoNotifyUpdateL(*posInfoNotifyUpd); + + // This should not give a final network position response + //techType = posInfoNotifyUpd->PositionMode(); + + if(err != KPositionQualityLoss) + { + SetTestStepResult(EFail); + } + } + + CleanupStack::PopAndDestroy(&iPositioner); + CloseNetSim(); + } + + break; + } + + // Test that the final network position is not passed on to the client if they + // switch to autonomous mode mid-way through a session. + case 1002: + { + // Set preferred TB mode + // Set 'assisted-if-possible' (EGpsPreferTerminalBased) mode + CLbsAdmin::TGpsMode mode; + + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsPreferTerminalBased)); + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingHomeGpsMode, mode)); + + if(mode != CLbsAdmin::EGpsPreferTerminalBased) + { + SetTestStepResult(EFail); + } + else // Request a location update + { + + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + + const TTimeIntervalMicroSeconds KMicroSecondsValue(60*1000*1000); + TPositionUpdateOptions posOption; + posOption.SetUpdateTimeOut(KMicroSecondsValue); + User::LeaveIfError(iPositioner.SetUpdateOptions(posOption)); + + CleanupClosePushL(iPositioner); + + // Create a posinfos and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + // Setup netsim. + User::LeaveIfError(OpenNetSim()); + TLbsNetPosRequestQuality quality; + quality.SetMinHorizontalAccuracy(200); + quality.SetMinVerticalAccuracy(20000); + iNetSim.SetQuality(quality); + + TPositionInfo* posInfoNotifyUpd = new(ELeave) TPositionInfo(); + + posInfoArr.Append(posInfoNotifyUpd); + + // Send the first NPUD & block on response + err = DoNotifyUpdateL(*posInfoNotifyUpd); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + TPositionModuleInfo::TTechnologyType techType; + + // Wait for 10 seconds to allow the FNP to come in then send the next NPUD + User::After(10*1000*1000); + + // Send the second NPUD & block on response + err = DoNotifyUpdateL(*posInfoNotifyUpd); + + // This should give a final network position response + techType = posInfoNotifyUpd->PositionMode(); + + if(techType != (TPositionModuleInfo::ETechnologyNetwork | + TPositionModuleInfo::ETechnologyAssisted)) + { + INFO_PRINTF1(_L("Failed test, did not get a final network position.")); + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + CloseNetSim(); + } + + break; + } + + //Tests within SetUpdateOptions test to ensure that the correct Location Position + // is retured from the cache on a second NPUD (with correct MaxAge set). This test + // tests to make sure that if the last position to arrive was a reference position + // that the reference position is returned + case 1003: + { + //Setup in the TB mode + CLbsAdmin::TGpsMode mode; + + User::LeaveIfError(iLbsAdmin->Set(KLbsSettingHomeGpsMode, CLbsAdmin::EGpsPreferTerminalBased)); + User::LeaveIfError(iLbsAdmin->Get(KLbsSettingHomeGpsMode, mode)); + + if(mode != CLbsAdmin::EGpsPreferTerminalBased) + { + SetTestStepResult(EFail); + } + else // Request a location update + { + + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + //Setup netsim + User::LeaveIfError(OpenNetSim()); + TLbsNetPosRequestQuality quality; + quality.SetMinHorizontalAccuracy(200); + quality.SetMinVerticalAccuracy(20000); + iNetSim.SetQuality(quality); + + //xx + // Set the reference position, which also be used for any required verification. + TPosition refPos; + + #define REFPOS_LAT 1 + #define REFPOS_LONG 1 + #define REFPOS_ALT 1 + #define REFPOS_HORZ_ACCURACY 1 + #define REFPOS_VERT_ACCURACY 1 + + refPos.SetCoordinate(REFPOS_LAT, REFPOS_LONG, REFPOS_ALT); + refPos.SetAccuracy(REFPOS_HORZ_ACCURACY, REFPOS_VERT_ACCURACY); + refPos.SetCurrentTime(); + iNetSim.SetReferenceLocation(refPos); + User::After(500*1000); + //xx; + //Do first NPUD, this should get a reference position on the reference cache + TPositionInfo posInfo; + TPositionInfo posInfob; + + // Send the first NPUD & block on response + err = DoNotifyUpdateL(posInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + //Change the update options to set the MaxUpdateAge + TPositionUpdateOptions posOpts; + posOpts.SetMaxUpdateAge(1*1000000); + + iPositioner.SetUpdateOptions(posOpts); + + //Do the second NPUD, which should return a position from the cache + // At this point in time the AGPS module will not yet have produced a position + err = DoNotifyUpdateL(posInfob); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + //Check to see if the returned position is a reference position + TPositionModuleInfo::TTechnologyType techType; + techType = posInfob.PositionMode(); + + if(techType != TPositionModuleInfo::ETechnologyNetwork) + { + INFO_PRINTF1(_L("Failed test, did not get a Network Reference Position.")); + SetTestStepResult(EFail); + } + + //Since the second position is taken from the cache, check to see the two positions match + T_LbsUtils utils; + if(!utils.Compare_PosInfo(posInfo, posInfob)) + { + INFO_PRINTF1(_L("Failed test, the two positions are not the same!")); + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + CloseNetSim(); + } + + break; + } + case 1004: + { + TTimeIntervalMicroSeconds iTimeOut; + TTime iStartTime; + TPositionSatelliteInfo iPos, iPos2; + TBool iEOP; + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + TPositionUpdateOptions updateOptions; + iTimeOut = 2000000; // Two second timeout. + + const TTimeIntervalMicroSeconds KTimeOut(iTimeOut); + updateOptions.SetUpdateTimeOut(KTimeOut); + updateOptions.SetAcceptPartialUpdates(ETrue); + iPositioner.SetUpdateOptions(updateOptions); + + // Store initial time + iStartTime.UniversalTime(); + + TInt err = DoNotifyUpdateL(iPos); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + TTimeIntervalMicroSeconds timeLeft,maxUpdate; + TTime cTime; + //TPositionSatelliteInfo pos = iPos; + + cTime.UniversalTime(); + iEOP = EFalse; + while (!iEOP) + { + cTime.UniversalTime(); + // Requesting another update must be the first thing done in RunL + timeLeft = (iTimeOut.Int64() - cTime.MicroSecondsFrom(iStartTime).Int64()); + maxUpdate = 100000; + + if (timeLeft <= 0) + { + iEOP = ETrue; + timeLeft = 1; // Use a very small value for the last update + } + else + { + const TTimeIntervalMicroSeconds KTimeOut(timeLeft); + TPositionUpdateOptions posOpts; + posOpts.SetUpdateTimeOut(KTimeOut); + posOpts.SetMaxUpdateAge(maxUpdate); + posOpts.SetAcceptPartialUpdates(ETrue); + iPositioner.SetUpdateOptions(posOpts); + + err = DoNotifyUpdateL(iPos); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + else + { + // We have a valid position, test passed + SetTestStepResult(EPass); + iEOP = ETrue; + } + } + } // end while + CleanupStack::PopAndDestroy(&iPositioner); + break; + } + + // Test case LBS-NotifyPosUpdate-0106 for demonstration of INC117582 + case 106: + { + + TPositionModuleId id; + iServer.GetDefaultModuleId(id); + + + RPositioner positioner1; + err = positioner1.Open(iServer, id); + User::LeaveIfError(err); + + RPositioner positioner2; + err = positioner2.Open(iServer, id); + User::LeaveIfError(err); + + RPositioner positioner3; + err = positioner3.Open(iServer, id); + User::LeaveIfError(err); + + RPositioner positioner4; + err = positioner4.Open(iServer, id); + User::LeaveIfError(err); + + RPositioner positioner5; + err = positioner5.Open(iServer, id); + User::LeaveIfError(err); + + RPositioner positioner6; + err = positioner6.Open(iServer, id); + User::LeaveIfError(err); + + RPositioner positioner7; + err = positioner7.Open(iServer, id); + User::LeaveIfError(err); + + + positioner1.Close(); + positioner2.Close(); + positioner3.Close(); + positioner6.Close(); + positioner7.Close(); // leaving 4 and 5 still open + + User::After(2000000); //allow time for close to work through the locserver + + + break; + } + + default: + User::Panic(KLbsClientStepNotifyPosUpdate, KErrUnknown); + + } + } + + // All done, clean up. + CleanupStack::PopAndDestroy(&iServer); + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_NotifyPosUpdate::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepopenclose.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepopenclose.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,273 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstep_openclose.cpp +// This is the class implementation for the Server Open Close Tests +// +// + +#include "ctlbsclientstepopenclose.h" + +#include + + +/** + * Destructor + */ +CT_LbsClientStep_OpenClose::~CT_LbsClientStep_OpenClose() + { + } + + +/** + * Constructor + */ +CT_LbsClientStep_OpenClose::CT_LbsClientStep_OpenClose(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent) + { + SetTestStepName(KLbsClientStep_OpenClose); + } + + +/** +Static Constructor +*/ +CT_LbsClientStep_OpenClose* CT_LbsClientStep_OpenClose::New(CT_LbsClientServer& aParent) + { + return new CT_LbsClientStep_OpenClose(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_OpenClose::doTestStepL() + { + // Generic test step used to test the LBS Client server open and close APIs. + INFO_PRINTF1(_L(">>CT_LbsClientStep_OpenClose::doTestStepL()")); + + if (TestStepResult() == EPass) + { + + TUint howManyModules = 0; + TPositionModuleInfo myModuleInfo; + TInt err = KErrNone; + TPositionCriteria criteria; + + + // Carryout common test action. + err = iServer.Connect(); // Function under test. + if (KErrNone == err) + { + INFO_PRINTF1(_L("server opened")); + + + // Carryout unquie test actions. + TInt testCaseId; + if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId)) + { + switch (testCaseId) + { + // Test case LBS-OpenClose-0001 + case 1: + { + TPositionModuleId serverDefaultModuleId; + User::LeaveIfError(iServer.GetDefaultModuleId(serverDefaultModuleId)); + err = iPositioner.Open(iServer, serverDefaultModuleId); + if(err != KErrNone) + { + INFO_PRINTF1(_L("** SubSession Failed to open **")); + SetTestStepResult(EFail); + } + } + break; + + // Test case LBS-OpenClose-0002 + case 2: + { + User::LeaveIfError(iServer.GetNumModules(howManyModules)); + User::LeaveIfError(iServer.GetModuleInfoByIndex(howManyModules-1, myModuleInfo)); + err = iPositioner.Open(iServer, myModuleInfo.ModuleId()); + if(err != KErrNone) + { + INFO_PRINTF1(_L("** SubSession Failed to open **")); + SetTestStepResult(EFail); + } + } + break; + + // Test case LBS-OpenClose-0003 + case 3: + { + // PassInNullUID + err = iPositioner.Open(iServer, KPositionNullModuleId ); + if (KErrNotFound == err) + { + INFO_PRINTF1(_L("** SubSession failed to open: Negative Test Successful **")); + } + else + { + INFO_PRINTF1(_L("** SubSession Opened, test failed **")); + SetTestStepResult(EFail); + } + } + break; + + // Test case LBS-OpenCloseExtend-0001 + case 11: + { + criteria.AddRequiredCapabilities(TPositionModuleInfo::ECapabilitySatellite); + err = iPositioner.Open(iServer, criteria); + if(err != KErrNone) + { + INFO_PRINTF1(_L("** SubSession Failed to open **")); + SetTestStepResult(EFail); + } + } + break; + + // Test case LBS-OpenCloseExtend-0002 + case 12: + { + // Set capabilities not supported by the module: + criteria.AddRequiredCapabilities(TPositionModuleInfo::ECapabilityAddress); + err = iPositioner.Open(iServer, criteria); + if (KErrNotFound == err) + { + INFO_PRINTF1(_L("** SubSession failed to open: Negative Test Successful **")); + } + else + { + INFO_PRINTF1(_L("** SubSession Opened, test failed **")); + SetTestStepResult(EFail); + } + } + break; + + // Test case LBS-OpenCloseMultiple-0001 + case 20: + { + User::LeaveIfError(iPositioner.Open(iServer)); + RPositioner positioner2; + err = positioner2.Open(iServer); + if(err != KErrNone) + { + INFO_PRINTF1(_L("** SubSession Failed to open **")); + SetTestStepResult(EFail); + } + positioner2.Close(); + } + break; + + // Test case LBS-ReOpen-0001 + case 30: + { + User::LeaveIfError(iPositioner.Open(iServer)); + User::LeaveIfError(iPositioner.Open(iServer)); + } + break; + // Test case LBS-OpenClose-0041 + case 41: + { + err = iServer.CancelRequest(EPositionerNotifyPositionUpdate); + if(err != KErrNotFound) + { + INFO_PRINTF2(_L("** Failed to return KErrnotFound, instead returned %d**"),err); + SetTestStepResult(EFail); + } + } + break; + + // Test case LBS-OpenClose-0042 + case 42: + { + err = iPositioner.Open(iServer); + if(err != KErrNone) + { + INFO_PRINTF1(_L("** SubSession Failed to open **")); + SetTestStepResult(EFail); + } + + err = 0; // reset Err + + err = iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); + if(err != KErrNotFound) + { + INFO_PRINTF2(_L("** Failed to return KErrnotFound, instead returned %d**"),err); + SetTestStepResult(EFail); + } + } + break; + + // Test case LBS-OpenClose-0043 + case 43: + { + err = iPositioner.Open(iServer); + if(err != KErrNone) + { + INFO_PRINTF1(_L("** SubSession Failed to open **")); + SetTestStepResult(EFail); + } + + err = 0; // reset Err + + err = iPositioner.CancelRequest(EPositionerGetLastKnownPosition); + if(err != KErrNotFound) + { + INFO_PRINTF2(_L("** Failed to return KErrnotFound, instead returned %d**"),err); + SetTestStepResult(EFail); + } + } + break; + + // Test case LBS-OpenClose-0044 + case 44: + { + err = iServer.CancelRequest(EPositionServerNotifyModuleStatusEvent); + if(err != KErrNotFound) + { + INFO_PRINTF2(_L("** Failed to return KErrnotFound, instead returned %d**"),err); + SetTestStepResult(EFail); + } + } + break; + + default: + User::Leave(KErrArgument); + break; + } + + iPositioner.Close(); + iServer.Close(); + } + else + { + INFO_PRINTF1(_L("Bad Ini file")); + SetTestStepResult(EFail); + } + } + else + { + INFO_PRINTF1(_L("SubSession failed to open")); + SetTestStepResult(EFail); + } + + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_OpenClose::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientsteppartialupdate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientsteppartialupdate.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,990 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientsteppartialupdate.cpp +// This is the class implementation for the UpdateOptions Tests +// +// + +#include "ctlbsclientsteppartialupdate.h" + +#include +#include + +#include "tlbsutils.h" +#include "ctlbsasyncwaiter.h" + +#define EXPECTED_GPS_ACCURACY_HORIZONTAL 20 +#define EXPECTED_GPS_ACCURACY_VERTICAL 20 + +#define KLbsKeepAlivePeriod 10000 + +#define REFPOS_LAT 2 +#define REFPOS_LONG 3 +#define REFPOS_ALT 10 +#define REFPOS_HORZ_ACCURACY 100 +#define REFPOS_VERT_ACCURACY 100 + +#define REFPOS_HORZ_ACCURACY_BETTER 5 +#define REFPOS_VERT_ACCURACY_BETTER 5 + + +const TInt KTestAssistanceDataProviderPluginUidValue = 0x10281D77; +const TInt KRealAssistanceDataProviderPluginUidValue = 0x1028225B; + + +/** + * Destructor + */ +CT_LbsClientStep_PartialUpdate::~CT_LbsClientStep_PartialUpdate() + { + delete iDoPosUpdatePtr; + } + + +/** + * Constructor + */ +CT_LbsClientStep_PartialUpdate::CT_LbsClientStep_PartialUpdate(CT_LbsClientServer& aParent) : CT_LbsNetSimStep(), iParent(aParent) + { + SetTestStepName(KLbsClientStep_PartialUpdate); + } + + +/** +Static Constructor +*/ +CT_LbsClientStep_PartialUpdate* CT_LbsClientStep_PartialUpdate::New(CT_LbsClientServer& aParent) + { + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + CT_LbsClientStep_PartialUpdate* testStep = new CT_LbsClientStep_PartialUpdate(aParent); + if (testStep) + { + TInt err = KErrNone; + + TRAP(err, testStep->ConstructL()); + if (err) + { + delete testStep; + testStep = NULL; + } + } + return testStep; + } + +void CT_LbsClientStep_PartialUpdate::ConstructL() + { + // Create the base class objects. + CT_LbsNetSimStep::ConstructL(); + + // and the active object wrapper for the notify position update. + iDoPosUpdatePtr = CT_LbsDoPosUpdate::NewL(this, TPositionModuleInfo::ETechnologyTerminal); + + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_PartialUpdate::doTestStepL() + { + // Generic test step used to test the LBS SetUpdateOptions API. + INFO_PRINTF1(_L(">>CT_LbsClientStep_PartialUpdate::doTestStepL()")); + + if (TestStepResult()==EPass) + { + TInt err = KErrNone; + iPosUpdateStatus = EPositionUpdateStart; + + //Configure partial Updates + TPositionUpdateOptions optsA; + optsA.SetAcceptPartialUpdates(ETrue); + + if(!optsA.AcceptPartialUpdates()) + { + INFO_PRINTF1(_L("Partial Updates not set.")); + SetTestStepResult(EFail); + } + + err = iDoPosUpdatePtr->SetOptions(optsA); + User::LeaveIfError(err); + + CLbsAdmin* lbsAdminApi = CLbsAdmin::NewL(); + CleanupStack::PushL(lbsAdminApi); + + // Carryout unique test actions. + if (GetIntFromConfig(ConfigSection(), KTestCaseId, iTestCaseId)) + { + switch (iTestCaseId) + { + // Test case LBS-Partial-Update-Options-0001 + case 1: + { + CLbsAdmin::TGpsMode gpsMode = CLbsAdmin::EGpsAutonomous; + lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode); + + //Configure Partial Update to EFalse + TPositionUpdateOptions updOpts; + updOpts.SetUpdateTimeOut(10*1000000); + updOpts.SetAcceptPartialUpdates(EFalse); + if(EFalse != updOpts.AcceptPartialUpdates()) + { + INFO_PRINTF1(_L("Partial Updates not set.")); + SetTestStepResult(EFail); + } + + err = iDoPosUpdatePtr->SetOptions(updOpts); + User::LeaveIfError(err); + + break; + } + + // Test case LBS-Partial-Update-Options-0002 + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + { + CLbsAdmin::TGpsMode gpsMode = CLbsAdmin::EGpsAutonomous; + lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode); + + break; + } + + case 21: + case 22: + case 24: + case 25: + case 26: + { + CLbsAdmin::TGpsMode gpsMode = CLbsAdmin::EGpsPreferTerminalBased; + lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode); + + break; + } + + case 23: + { + CLbsAdmin::TGpsMode gpsMode = CLbsAdmin::EGpsPreferTerminalBased; + lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode); + + //Configure Partial Update to EFalse + TPositionUpdateOptions updOpts; + updOpts.SetAcceptPartialUpdates(EFalse); + if(EFalse != updOpts.AcceptPartialUpdates()) + { + INFO_PRINTF1(_L("Partial Updates not set.")); + SetTestStepResult(EFail); + } + + err = iDoPosUpdatePtr->SetOptions(updOpts); + User::LeaveIfError(err); + + break; + } + + case 27: + case 28: + { + //Tracking + CLbsAdmin::TGpsMode gpsMode; + if(iTestCaseId == 27) + { + gpsMode = CLbsAdmin::EGpsAutonomous; + } + else + { + gpsMode = CLbsAdmin::EGpsPreferTerminalBased; + } + + lbsAdminApi->Set(KLbsSettingHomeGpsMode,gpsMode); + + TPositionUpdateOptions updOpts; + updOpts.SetUpdateInterval(10*1000000); //Set Update Interval to 10 secs + updOpts.SetAcceptPartialUpdates(ETrue); + + err = iDoPosUpdatePtr->SetOptions(updOpts); + User::LeaveIfError(err); + + break; + } + + default: + User::Panic(KLbsClientStep_PartialUpdate, KErrUnknown); + + } + } + + User::LeaveIfError(OpenNetSim()); + + // Kick off the test abort and keep alive timers. + TTimeIntervalMicroSeconds32 keepAliveInterval(KLbsKeepAlivePeriod); + iKeepAliveTimer->SetTimer(keepAliveInterval); + + // Kick off test. + CActiveScheduler::Start(); + + // Verify location data. + VerifyPosInfos(); + + //Reset Test module timeout + TModuleDataIn modDataIn; + modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut; + modDataIn.iTimeOut = 0; + + T_LbsUtils utils; + utils.NotifyModuleOfConfigChangeL(modDataIn); + + // Clean up. + CloseNetSim(); + + CleanupStack::PopAndDestroy(lbsAdminApi); + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_PartialUpdate::doTestStepL()")); + + return TestStepResult(); + } + + +void CT_LbsClientStep_PartialUpdate::Connected() + { + // Call base implementation. + //CT_LbsNetSimStep::Connected(); + + // Create a posinfo and store in our shared array for later verification. + T_LbsUtils utils; + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + iPosInfoPtr1 = new(ELeave) TPositionInfo(); + posInfoArr.Append(iPosInfoPtr1); + iPosInfoPtr2 = new(ELeave) TPositionInfo(); + posInfoArr.Append(iPosInfoPtr2); + + //For test case 22, Set Reference Position better than required position + if(iTestCaseId == 22) + { + // Set the reference position, which also be used for any required verification. + iRefPos.SetCoordinate(REFPOS_LAT, REFPOS_LONG, REFPOS_ALT); + iRefPos.SetAccuracy(REFPOS_HORZ_ACCURACY_BETTER, REFPOS_VERT_ACCURACY_BETTER); + iRefPos.SetCurrentTime(); + + if (!iNetSim.SetReferenceLocation(iRefPos)) + { + INFO_PRINTF1(_L("Failed test, can't set NetSim's reference location.")); + SetTestStepResult(EFail); + } + } + + // Kick off pos update. + iDoPosUpdatePtr->StartL(*iPosInfoPtr1); + } + + +void CT_LbsClientStep_PartialUpdate::MT_LbsDoPosUpdateCallback(TRequestStatus& aStatus) + { + INFO_PRINTF1(_L("Got - Client Notify Update Complete - Callback Event.")); + + T_LbsUtils utils; + TInt err = aStatus.Int(); + + switch(iTestCaseId) + { + case 1: + { + if (KPositionQualityLoss != err) + { + SetTestStepResult(EFail); + } + + iState = EWaiting; + break; + } + + case 2: + case 3: + { + if (KPositionPartialUpdate != err) + { + SetTestStepResult(EFail); + } + + if(iPosUpdateStatus != EPositionUpdateComplete) + { + // Kick off pos update. + iDoPosUpdatePtr->StartL(*iPosInfoPtr2); + iPosUpdateStatus = EPositionUpdateComplete; + } + else + iState = EWaiting; + + break; + } + + case 4: + { + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + if(iPosUpdateStatus != EPositionUpdateComplete) + { + // Kick off pos update. + iDoPosUpdatePtr->StartL(*iPosInfoPtr2); + iPosUpdateStatus = EPositionUpdateComplete; + } + else + iState = EWaiting; + + break; + } + + case 5: + case 6: + + case 21: + case 22: + { + if(iPosUpdateStatus != EPositionUpdateComplete) + { + if(iTestCaseId == 5 || iTestCaseId == 21) + { + if (KPositionPartialUpdate != err) + { + SetTestStepResult(EFail); + } + } + else + { + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + } + } + else + { + if (KPositionEarlyComplete != err) + { + SetTestStepResult(EFail); + } + } + + if(iPosUpdateStatus != EPositionUpdateComplete) + { + TModuleDataIn modDataIn; // Used to send test information to the test module. + modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut; + modDataIn.iTimeOut = 5*1000000; + + // Send timeout value to test module - will block. + utils.NotifyModuleOfConfigChangeL(modDataIn); + + // Kick off pos update. + iDoPosUpdatePtr->StartL(*iPosInfoPtr2); + + err = iDoPosUpdatePtr->CompleteRequest(EPositionerNotifyPositionUpdate); + if (err != KErrNone) + { + SetTestStepResult(EFail); + } + + iPosUpdateStatus = EPositionUpdateComplete; + + } + else + { + //if(iTestCaseId == 5 || iTestCaseId == 6) + { + iState = EWaiting; + } + } + + break; + } + + case 7: + { + if(iPosUpdateStatus != EPositionUpdateComplete) + { + if (KPositionPartialUpdate != err) + { + SetTestStepResult(EFail); + } + + // Kick off pos update. + iDoPosUpdatePtr->StartL(*iPosInfoPtr2); + iPosUpdateStatus = EPositionUpdateComplete; + } + else + { + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + err = iDoPosUpdatePtr->CompleteRequest(EPositionerNotifyPositionUpdate); + if (err != KErrNotFound) + { + SetTestStepResult(EFail); + } + iState = EWaiting; + } + + break; + } + + case 23: + { + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + break; + } + + case 24: + case 27: + { + if(iPosUpdateStatus != EPositionUpdateComplete) + { + if (KPositionPartialUpdate != err) + { + SetTestStepResult(EFail); + } + + if(iPosUpdateStatus == EPositionUpdateStart) + { + iDoPosUpdatePtr->StartL(*iPosInfoPtr2); + iPosUpdateStatus = EPositionUpdateContinue; + } + else + { + TModuleDataIn modDataIn; // Used to send test information to the test module. + modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut; + modDataIn.iTimeOut = 5*1000000; + + // Send timeout value to test module - will block. + utils.NotifyModuleOfConfigChangeL(modDataIn); + + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfoPtr3; + posInfoPtr3 = new(ELeave) TPositionInfo(); + posInfoArr.Append(posInfoPtr3); + + // Kick off pos update. + iDoPosUpdatePtr->StartL(*posInfoPtr3); + + err = iDoPosUpdatePtr->CompleteRequest(EPositionerNotifyPositionUpdate); + if (err != KErrNone) + { + SetTestStepResult(EFail); + } + + iPosUpdateStatus = EPositionUpdateComplete; + } + } + else + { + if (KPositionEarlyComplete != err) + { + SetTestStepResult(EFail); + } + + //if (iTestCaseId == 27) + // { + iState = EWaiting; + // } + } + + break; + } + + case 25: + case 26: + { + if(iPosUpdateStatus != EPositionUpdateComplete) + { + if (KPositionPartialUpdate != err) + { + SetTestStepResult(EFail); + } + + if(iPosUpdateStatus == EPositionUpdateStart) + { + iDoPosUpdatePtr->StartL(*iPosInfoPtr2); + iPosUpdateStatus = EPositionUpdateContinue; + } + else + { + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfoPtr3; + posInfoPtr3 = new(ELeave) TPositionInfo(); + posInfoArr.Append(posInfoPtr3); + + // Kick off pos update. + iDoPosUpdatePtr->StartL(*posInfoPtr3); + + iPosUpdateStatus = EPositionUpdateComplete; + } + } + else + { + if (KPositionPartialUpdate != err && KPositionQualityLoss != err) + { + _LIT(KUnexpectedErrorWhilePartialUpdate, "Unexpected error returned: %d"); + INFO_PRINTF2(KUnexpectedErrorWhilePartialUpdate, err); + SetTestStepResult(EFail); + } + + err = iDoPosUpdatePtr->CompleteRequest(EPositionerNotifyPositionUpdate); + if (err != KErrNotFound) + { + SetTestStepResult(EFail); + } + + iState =EWaiting; + + TPositionInfo* curPosInfo = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[0]); + TPositionInfo* curPosInfo2 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[1]); + TPositionInfo* curPosInfo3 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[2]); + } + + break; + } + + case 28: + { + if(iPosUpdateStatus != EPositionUpdateComplete) + { + if (KPositionPartialUpdate != err) + { + SetTestStepResult(EFail); + } + + if(iPosUpdateStatus == EPositionUpdateStart) + { + iDoPosUpdatePtr->StartL(*iPosInfoPtr2); + iPosUpdateStatus = EPositionUpdateContinue; + } + else + { + TModuleDataIn modDataIn; // Used to send test information to the test module. + modDataIn.iRequestType = TModuleDataIn::EModuleRequestTimeOut; + modDataIn.iTimeOut = 5*1000000; + + // Send timeout value to test module - will block. + utils.NotifyModuleOfConfigChangeL(modDataIn); + + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfoPtr3; + posInfoPtr3 = new(ELeave) TPositionInfo(); + posInfoArr.Append(posInfoPtr3); + + // Kick off pos update. + iDoPosUpdatePtr->StartL(*posInfoPtr3); + + err = iDoPosUpdatePtr->CompleteRequest(EPositionerNotifyPositionUpdate); + if (err != KErrNone) + { + SetTestStepResult(EFail); + } + + iPosUpdateStatus = EPositionUpdateComplete; + } + } + else + { + if (KPositionEarlyComplete != err) + { + SetTestStepResult(EFail); + } + + iState = EWaiting; + } + + break; + } + + default: + break; + } + } + +void CT_LbsClientStep_PartialUpdate::VerifyPosInfos() + { + T_LbsUtils utils; + T_LbsUtils::TComparisonAccuracyType accType; + + if(iParent.iSharedData->iTestModuleInUse) + { + accType = T_LbsUtils::EExactAccuracy; + } + else + { + accType = T_LbsUtils::ERoughAccuracy; + } + + switch(iTestCaseId) + { + case 5: + case 6: + { + //Verify Position returned - It should be the position returned earlier + TPositionInfo* curPosInfoPtr1 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[0]); + TPositionInfo* curPosInfoPtr2 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[1]); + TPositionInfo* verPosInfoPtr = reinterpret_cast(iParent.iSharedData->iVerifyPosInfoArr[0]); + + if (!utils.Compare_PosInfo(*curPosInfoPtr1, *verPosInfoPtr, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + if (!utils.Compare_PosInfo(*curPosInfoPtr2, *verPosInfoPtr, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + break; + } + + case 7: + { + //Verify Position returned - It should be the position returned earlier + TPositionInfo* curPosInfoPtr1 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[0]); + TPositionInfo* curPosInfoPtr2 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[1]); + + TPositionInfo* verPosInfoPtr1 = reinterpret_cast(iParent.iSharedData->iVerifyPosInfoArr[0]); + TPositionInfo* verPosInfoPtr2 = reinterpret_cast(iParent.iSharedData->iVerifyPosInfoArr[1]); + + if (!utils.Compare_PosInfo(*curPosInfoPtr1, *verPosInfoPtr1, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + if (!utils.Compare_PosInfo(*curPosInfoPtr2, *verPosInfoPtr2, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + break; + } + + case 21: + case 22: + { + //Verify Position returned - It should be the position returned earlier + TPositionInfo* curPosInfoPtr1 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[0]); + TPositionInfo* curPosInfoPtr2 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[1]); + + TPositionInfo refPosInfo; + refPosInfo.SetPosition(iRefPos); + + if (!utils.Compare_PosInfo(*curPosInfoPtr1, refPosInfo, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + if (!utils.Compare_PosInfo(*curPosInfoPtr2, refPosInfo, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + break; + } + + case 23: + { + //Verify Position returned - It should be the position returned earlier + TPositionInfo* curPosInfoPtr = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[0]); + + TPositionInfo refPosInfo; + refPosInfo.SetPosition(iRefPos); + + if (!utils.Compare_PosInfo(*curPosInfoPtr, refPosInfo, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + break; + } + + case 24: + case 25: + case 26: + case 28: + { + //Verify Position returned - It should be the position returned earlier + TPositionInfo* curPosInfoPtr1 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[0]); + TPositionInfo* curPosInfoPtr2 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[1]); + TPositionInfo* curPosInfoPtr3 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[2]); + + TPositionInfo* verPosInfoPtr1 = reinterpret_cast(iParent.iSharedData->iVerifyPosInfoArr[0]); + TPositionInfo* verPosInfoPtr2 = reinterpret_cast(iParent.iSharedData->iVerifyPosInfoArr[1]); + + TPositionInfo refPosInfo; + refPosInfo.SetPosition(iRefPos); + + if (!utils.Compare_PosInfo(*curPosInfoPtr1, refPosInfo, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + if (!utils.Compare_PosInfo(*curPosInfoPtr2, *verPosInfoPtr1, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + //if(iTestCaseId == 26 || iTestCaseId == 25) + // { + // if (!utils.Compare_PosInfo(*curPosInfoPtr3, *verPosInfoPtr2, accType)) + // { + // INFO_PRINTF1(_L("Failed test, position incorrect.")); + // SetTestStepResult(EFail); + // } + // } + //else + // { + if (!utils.Compare_PosInfo(*curPosInfoPtr3, *verPosInfoPtr1, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + // } + + break; + } + + case 27: + { + //Verify Position returned - It should be the position returned earlier + TPositionInfo* curPosInfoPtr1 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[0]); + TPositionInfo* curPosInfoPtr2 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[1]); + TPositionInfo* curPosInfoPtr3 = reinterpret_cast(iParent.iSharedData->iCurrentPosInfoArr[2]); + + TPositionInfo* verPosInfoPtr1 = reinterpret_cast(iParent.iSharedData->iVerifyPosInfoArr[0]); + TPositionInfo* verPosInfoPtr2 = reinterpret_cast(iParent.iSharedData->iVerifyPosInfoArr[1]); + + if (!utils.Compare_PosInfo(*curPosInfoPtr1, *verPosInfoPtr1, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + if (!utils.Compare_PosInfo(*curPosInfoPtr2, *verPosInfoPtr2, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + if (!utils.Compare_PosInfo(*curPosInfoPtr3, *verPosInfoPtr2, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + break; + } + + default: + break; + } + } + + +void CT_LbsClientStep_PartialUpdate::NotifyRegisterLcsMoLr(const TDesC& aData) + { + (void)aData; + } + +void CT_LbsClientStep_PartialUpdate::NotifyMeasurementControlLocation(const TPositionInfo& aPosition, const RLbsAssistanceDataBuilderSet& aData, const TLbsNetPosRequestQuality& aQuality) + { + (void)aPosition; + (void)aData; + (void)aQuality; + + } + +void CT_LbsClientStep_PartialUpdate::NotifyMeasurementReportLocation(const TPositionInfo& aPosition) + { + + T_LbsUtils utils; + T_LbsUtils::TComparisonAccuracyType accType; + if(iParent.iSharedData->iTestModuleInUse) + { + accType = T_LbsUtils::EExactAccuracy; + } + else + { + accType = T_LbsUtils::ERoughAccuracy; + } + + switch(iTestCaseId) + { + case 21: + case 22: + { + TPositionInfo refPosInfo; + refPosInfo.SetPosition(iRefPos); + if (!utils.Compare_PosInfo(refPosInfo, aPosition, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + break; + } + + case 24: + case 25: + case 28: + { + TPositionInfo* verPosInfoPtr = reinterpret_cast(iParent.iSharedData->iVerifyPosInfoArr[0]); + + if (!utils.Compare_PosInfo(*verPosInfoPtr, aPosition, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + break; + } + + /*case 25: + { + TPositionInfo* verPosInfoPtr = reinterpret_cast(iParent.iSharedData->iVerifyPosInfoArr[1]); + + if (!utils.Compare_PosInfo(*verPosInfoPtr, aPosition, accType)) + { + INFO_PRINTF1(_L("Failed test, position incorrect.")); + SetTestStepResult(EFail); + } + + break; + }*/ + + case 26: + { + //INFO_PRINTF1(_L("Position should not be sent to Network")); + //SetTestStepResult(EFail); + + break; + } + + default: + break; + + } + } + +void CT_LbsClientStep_PartialUpdate::NotifyFacilityLcsMoLrResult(TInt aReason, const TPositionInfo& aPosition) + { + (void)aReason; + (void)aPosition; + } + +void CT_LbsClientStep_PartialUpdate::NotifyReleaseLcsMoLr(TInt aReason) + { + (void)aReason; + if(iTestCaseId == 23) + { + iState = EWaiting; + } + } + + +TInt CT_LbsClientStep_PartialUpdate::OpenNetSim() + { + TInt err = KErrNone; + + //Connect to NetSim + err = iNetSim.ConnectL(this); + if (err) + { + SetTestStepResult(EFail); + return KErrGeneral; + } + + // Set the reference position, which also be used for any required verification. + iRefPos.SetCoordinate(REFPOS_LAT, REFPOS_LONG, REFPOS_ALT); + iRefPos.SetAccuracy(REFPOS_HORZ_ACCURACY, REFPOS_VERT_ACCURACY); + iRefPos.SetCurrentTime(); + + if (!iNetSim.SetReferenceLocation(iRefPos)) + { + INFO_PRINTF1(_L("Failed test, can't set NetSim's reference location.")); + SetTestStepResult(EFail); + iNetSim.Close(); + return KErrGeneral; + } + + //Set the position quality required by the network. + TTimeIntervalMicroSeconds maxFixTime(60 * 1000000); + + TLbsNetPosRequestQuality netPosQuality; + netPosQuality.SetMaxFixTime(maxFixTime); + netPosQuality.SetMinHorizontalAccuracy(iRefPos.HorizontalAccuracy()); + netPosQuality.SetMinVerticalAccuracy(iRefPos.VerticalAccuracy()); + + if (!iNetSim.SetQuality(netPosQuality)) + { + INFO_PRINTF1(_L("Failed test, can't set NetSim's quality.")); + SetTestStepResult(EFail); + iNetSim.Close(); + return KErrGeneral; + } + + TUid pluginUid; + if(iParent.iSharedData->iTestModuleInUse) + { + // Set plugin to use. + pluginUid = TUid::Uid(KTestAssistanceDataProviderPluginUidValue); + } + else + { + // Real AGPS Uid + pluginUid = TUid::Uid(KRealAssistanceDataProviderPluginUidValue); + } + + if (!iNetSim.SetAssistanceDataProvider(pluginUid)) + { + INFO_PRINTF1(_L("Failed test, can't set NetSim's assistance data plugin uid.")); + SetTestStepResult(EFail); + iNetSim.Close(); + return KErrGeneral; + } + + return KErrNone; + } + +void CT_LbsClientStep_PartialUpdate::CloseNetSim() + { + iNetSim.Close(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepsrvconnectclose.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepsrvconnectclose.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,230 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstep_srvconnectclose.cpp +// This is the class implementation for the Server Connect Close Tests +// +// + +#include "ctlbsclientstepsrvconnectclose.h" + +#include + +/** + * Destructor + */ +CT_LbsClientStep_SrvConnectClose::~CT_LbsClientStep_SrvConnectClose() + { + } + + +/** + * Constructor + */ +CT_LbsClientStep_SrvConnectClose::CT_LbsClientStep_SrvConnectClose(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent) + { + SetTestStepName(KLbsClientStep_SrvConnectClose); + } + + +/** +Static Constructor +*/ +CT_LbsClientStep_SrvConnectClose* CT_LbsClientStep_SrvConnectClose::New(CT_LbsClientServer& aParent) + { + return new CT_LbsClientStep_SrvConnectClose(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_SrvConnectClose::doTestStepL() + { + // Generic test step used to test the LBS Client server open and close APIs. + INFO_PRINTF1(_L(">>CT_LbsClientStep_SrvConnectClose::doTestStepL()")); + + if (TestStepResult() == EPass) + { + // Carryout common test action. + TInt err = KErrNone; + err = iServer.Connect(); // Function under test. + CleanupClosePushL(iServer); + + if (KErrNone == err) + { + INFO_PRINTF1(_L("server opened")); + + // Carryout unique test actions. + TInt testCaseId; + if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId)) + { + switch (testCaseId) + { + // Test case LBS-ConnectClose-0001 + case 1: + // Only requires create, connect and close for RPositionServer object + // Connect and close occur outside the switch. + break; + + // Test case LBS-ConnectClose-0002 + case 2: + { + OpenNetSim(); + RPositioner positioner; + User::LeaveIfError(positioner.Open(iServer)); + TPositionInfo posInfo; + TRequestStatus status; + + TPositionUpdateOptions optsA; + TTimeIntervalMicroSeconds interval = 60 * 1000000; // 1 minute interval + // note: do 2 NPUDs because the first may complete before we close + optsA.SetUpdateInterval(interval); + positioner.NotifyPositionUpdate(posInfo, status); + User::WaitForRequest(status); + + // this will not complete quickly, so we'll def have an outstanding request when we close + positioner.NotifyPositionUpdate(posInfo, status); + positioner.Close(); + CloseNetSim(); + } + break; + + // Test case LBS-ConnectClose-0003 + case 3: + { + // Will panic, not interested in any return err. + iServer.Connect(); + } + break; + + // Test case LBS-ConnectClose-0004 + case 4: + { + RPositionServer server2; + + err = server2.Connect(); + if(err != KErrNone) + { + INFO_PRINTF1(_L("Server2 connect() didn't return KErrNone")); + SetTestStepResult(EFail); + } + + else + { + server2.Close(); + } + } + break; + //Test case LBS-ConnectClose-0005 + case 5: + { + // look in the kernels process list for the server + _LIT(KLocServerName, "*locserver*"); // NB you MUST use this server name for the location server. + // see KPositionServerName in the location server code (server side) + TFindThread serverSearcher(KLocServerName); + TFileName matchingFileName; + TInt matchCount = 0; + while(serverSearcher.Next(matchingFileName) == KErrNone) + { + // we have a match, there should only be one + matchCount++; + } + // start checking + if(matchCount!=1) + { + /* fail the test - we somehow have more than one location server running. + May have been one left over from a previous test */ + INFO_PRINTF1(_L("somehow have more than one location server running")); + SetTestStepResult(EFail); + } + RThread iserverThread; + TInt err; + err=iserverThread.Open(matchingFileName); + User::LeaveIfError(err); + TThreadId iserverThreadId = iserverThread.Id(); + // log the thread ID + // we now try and explicitly start a 2nd copy of the position server. + //We expect not to get a 2nd copy, but to //connect to the existing copy. + // create an connect to the lcoation server + RPositionServer server2; + User::LeaveIfError(server2.Connect()); + CleanupClosePushL(server2); + // search again + serverSearcher.Find(KLocServerName); + matchCount = 0; + while(serverSearcher.Next(matchingFileName) == KErrNone) + { + // we have a match, there should only be one + matchCount++; + } + // sanity check + if(matchCount!=1) + { + /*SDA 3_50 Failure here + fail the test - we have two servers.*/ + INFO_PRINTF1(_L("we have two servers")); + SetTestStepResult(EFail); + + } + else + { + // we have one server so check the thread its match + RThread server2Thread; + err=server2Thread.Open(matchingFileName); + User::LeaveIfError(err); + TThreadId server2ThreadId = server2Thread.Id(); + + if(iserverThreadId != server2ThreadId) + { + /*different thread ids - somehow + fail the test here */ + INFO_PRINTF1(_L("Different thread ids ")); + SetTestStepResult(EFail); + } + } + CleanupStack::PopAndDestroy(&server2); + } + break; + default: + User::Leave(KErrArgument); + break; + + } + } + else + { + INFO_PRINTF1(_L("Failed to read from ini file correctly")); + SetTestStepResult(EFail); + } + } + else + { + INFO_PRINTF1(_L("server failed to open")); + SetTestStepResult(EFail); + } + + // Carryout final common test action. + CleanupStack::PopAndDestroy(&iServer); + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_SrvConnectClose::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepsrvversion.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepsrvversion.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,127 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstepsrvversion.cpp +// This is the class implementation for the Server Version Tests +// +// + +#include "ctlbsclientstepsrvversion.h" + +#include + + +_LIT(Ksrvvermajor, "srv_ver_major"); +_LIT(Ksrvverminor, "srv_ver_minor"); +_LIT(Ksrvverbuild, "srv_ver_build"); + + +/** + * Destructor + */ +CT_LbsClientStep_SrvVersion::~CT_LbsClientStep_SrvVersion() + { + } + + +/** + * Constructor + */ +CT_LbsClientStep_SrvVersion::CT_LbsClientStep_SrvVersion(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent) + { + SetTestStepName(KLbsClientStep_SrvVersion); + } + + +/** +Static Constructor +*/ +CT_LbsClientStep_SrvVersion* CT_LbsClientStep_SrvVersion::New(CT_LbsClientServer& aParent) + { + return new CT_LbsClientStep_SrvVersion(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_SrvVersion::doTestStepL() + { + // Generic test step used to test the LBS Client server open and close APIs. + INFO_PRINTF1(_L(">>CT_LbsClientStep_SrvVersion::doTestStepL()")); + + if (TestStepResult() == EPass) + { + RPositionServer server; + TInt err = KErrNone; + + // Carryout common test action. + err = server.Connect(); + if (KErrNone == err) + { + INFO_PRINTF1(_L("server opened")); + + // Carryout unique test actions. + // Test case LBS-APIVersion-0001 + + TVersion serverversion; + serverversion = server.Version(); + TInt MajorVersionNumber = 0; + TInt MinorVersionNumber = 0; + TInt BuildVersionNumber = 0; + if(!(GetIntFromConfig(ConfigSection(), Ksrvvermajor, MajorVersionNumber) && + GetIntFromConfig(ConfigSection(), Ksrvverminor, MinorVersionNumber) && + GetIntFromConfig(ConfigSection(), Ksrvverbuild, BuildVersionNumber))) + { + INFO_PRINTF1(_L("Bad ini file Build info.")); + User::Leave(KErrArgument); + } + + //Check expected Version matches tested version + if (MajorVersionNumber == static_cast(serverversion.iMajor) && + MinorVersionNumber == static_cast(serverversion.iMinor) && + BuildVersionNumber == static_cast(serverversion.iBuild)) + { + INFO_PRINTF1(_L("Expected Version Matches")); + } + else + { + INFO_PRINTF1(_L("Expected Version Differs")); + SetTestStepResult(EFail); + } + + } + else + { + INFO_PRINTF1(_L("server failed to open")); + SetTestStepResult(EFail); + } + + + // Carryout final common test action. + if (KErrNone == err) + { + server.Close(); + } + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_SrvVersion::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientsteptracking.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientsteptracking.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,668 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstep_tracking.cpp +// This is the class implementation for the Tracking Tests +// +// + +#include "ctlbsclientsteptracking.h" + +#include +#include + +#include "tlbsutils.h" +#include "ctlbsasyncwaiter.h" + + +/** + * Construction. + */ +CT_LbsClientStep_Tracking* CT_LbsClientStep_Tracking::New(CT_LbsClientServer& aParent) + { + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + CT_LbsClientStep_Tracking* testStep = new CT_LbsClientStep_Tracking(aParent); + if (testStep) + { + TInt err = KErrNone; + + TRAP(err, testStep->ConstructL()); + if (err) + { + delete testStep; + testStep = NULL; + } + } + + return testStep; + } + + +CT_LbsClientStep_Tracking::CT_LbsClientStep_Tracking(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent), + iVerifyInterval(ETrue), iExpectedErr(KErrNone), iUpdateIndex(0) + { + SetTestStepName(KLbsClientStep_Tracking); + } + + +void CT_LbsClientStep_Tracking::ConstructL() + { + // Setup netsim. + User::LeaveIfError(OpenNetSim()); + + // Connect server. + User::LeaveIfError(iServer.Connect()); + + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + } + + +/** + * Destructor + */ +CT_LbsClientStep_Tracking::~CT_LbsClientStep_Tracking() + { + iPositioner.Close(); + iServer.Close(); + CloseNetSim(); + } + + +const TTimeIntervalMicroSeconds KTimestampMargin = 500000; //+/-0.5s + +TBool CT_LbsClientStep_Tracking::VerifyFirstPosTime(const TTime& aTimeRequested, const TPositionInfo& aPosInfo, const TPositionUpdateOptions& aUpdateOpts) + { + TTime timeReceived, timeStamp; + TPosition pos; + + TInt64 maxtime; + maxtime = aUpdateOpts.UpdateTimeOut().Int64(); + if(!maxtime) + { + #pragma message("TO DO: CT_LbsClientStep_Tracking::VerifyFirstPosTime - Update when moduleinfo supported") + const TTimeIntervalMicroSeconds ttff = 90*1000000; // TO DO - this should be retrieved from the module info (currently hardcoded in locserver too) + maxtime = ttff.Int64(); + } + + // get current time + timeReceived.UniversalTime(); + + // get the position data: + aPosInfo.GetPosition(pos); + + INFO_PRINTF1(_L("First position received at: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeReceived.DateTime().Day() + 1, timeReceived.DateTime().Month() + 1, timeReceived.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeReceived.DateTime().Hour(), timeReceived.DateTime().Minute(), timeReceived.DateTime().Second(), timeReceived.DateTime().MicroSecond()); + + timeStamp = pos.Time(); + INFO_PRINTF1(_L("First position timeStamp: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeStamp.DateTime().Day() + 1, timeStamp.DateTime().Month() + 1, timeStamp.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeStamp.DateTime().Hour(), timeStamp.DateTime().Minute(), timeStamp.DateTime().Second(), timeStamp.DateTime().MicroSecond()); + + TInt64 timediff; + timediff = timeReceived.Int64() - aTimeRequested.Int64(); + + // *first* position received can arrive 'immediately' and up to timeout, or maxtimetofirstfix if timeout not specified + if(timediff > maxtime) + { + INFO_PRINTF1(_L("Failed: First Position received outside time range")); + return FALSE; + } + else + { + return TRUE; + } + } + + +/** + aPosCount - which position in a set of periodic positions this is (first position = 0) + */ +TBool CT_LbsClientStep_Tracking::VerifyPosTime(const TTime& aTimeFirstPosStamped, const TPositionUpdateOptions& aUpdateOpts, TPositionInfo& aPosInfo, TInt aPosCount) + { + TTime timeReceived, timeStamp; + TPosition pos; + TInt64 interval = aUpdateOpts.UpdateInterval().Int64(); + TTimeIntervalMicroSeconds timeout; + timeout = aUpdateOpts.UpdateTimeOut().Int64(); + + // should call different function for first position: + __ASSERT_ALWAYS(aPosCount > 0, User::Panic(_L("Update options test"), KErrArgument)); + + // get current time + timeReceived.UniversalTime(); + + // get the position data: + aPosInfo.GetPosition(pos); + + INFO_PRINTF1(_L("Position received at: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeReceived.DateTime().Day() + 1, timeReceived.DateTime().Month() + 1, timeReceived.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeReceived.DateTime().Hour(), timeReceived.DateTime().Minute(), timeReceived.DateTime().Second(), timeReceived.DateTime().MicroSecond()); + + timeStamp = pos.Time(); + INFO_PRINTF1(_L("Position timeStamp: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeStamp.DateTime().Day() + 1, timeStamp.DateTime().Month() + 1, timeStamp.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeStamp.DateTime().Hour(), timeStamp.DateTime().Minute(), timeStamp.DateTime().Second(), timeStamp.DateTime().MicroSecond()); + + TTime windowstart = aTimeFirstPosStamped + static_cast(aPosCount * interval) - KTimestampMargin; + TTime windowend = windowstart + timeout + KTimestampMargin; + + INFO_PRINTF1(_L("valid window start: ")); + INFO_PRINTF4(_L("%d/%d/%d"), windowstart.DateTime().Day() + 1, windowstart.DateTime().Month() + 1, windowstart.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), windowstart.DateTime().Hour(), windowstart.DateTime().Minute(), windowstart.DateTime().Second(), windowstart.DateTime().MicroSecond()); + + if(timeStamp < windowstart && timeReceived < windowstart) + { + INFO_PRINTF1(_L("Failed: Position received outside time range")); + return FALSE; + } + if(timeout.Int64() && (timeStamp > windowend || timeReceived > windowend)) + { + INFO_PRINTF1(_L("valid window end: ")); + INFO_PRINTF4(_L("%d/%d/%d"), windowend.DateTime().Day() + 1, windowend.DateTime().Month() + 1, windowend.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), windowend.DateTime().Hour(), windowend.DateTime().Minute(), windowend.DateTime().Second(), windowend.DateTime().MicroSecond()); + + return FALSE; + } + else + { + return TRUE; + } + } + + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_Tracking::doTestStepL() + { + // Generic test step used to test the LBS SetUpdateOptions API. + INFO_PRINTF1(_L(">>CT_LbsClientStep_Tracking::doTestStepL()")); + + if (TestStepResult()==EPass) + { + // Determine the test case id. + TInt testCaseId; + if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId)) + { + // Set the update options. + T_LbsUtils utils; + TPtrC configFileName; + _LIT(KUpdateOptionsFile, "agps_module_update_file"); + + GetStringFromConfig(ConfigSection(), KUpdateOptionsFile, configFileName); + + utils.GetConfigured_ModuleUpdateOptionsL(configFileName, ConfigSection(), iUpdateOpts); + iPositioner.SetUpdateOptions(iUpdateOpts); + + // count the number of updates from the .ini file + RPointerArray posInfoArray; + utils.GetConfigured_UpdateArrayL(configFileName, ConfigSection(), posInfoArray); + TInt numOfPosInfos = posInfoArray.Count(); + posInfoArray.ResetAndDestroy(); + + // Perfom test. + TInt err = KErrNone; + TPosition pos; + TTime timeFirstStamped; + TTime timeRequested; + iUpdateWindowIndex = 0; + if(testCaseId == 8) + { + iCheckIfSameAsPreviousPosition = ETrue; + } + else + { + iCheckIfSameAsPreviousPosition = EFalse; + } + + + for (iUpdateIndex = 0 ; iUpdateIndex < numOfPosInfos; iUpdateIndex++) + { + // Get and log current time. + timeRequested.UniversalTime(); + INFO_PRINTF1(_L("Position requested at: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeRequested.DateTime().Day() + 1, timeRequested.DateTime().Month() + 1, timeRequested.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeRequested.DateTime().Hour(), timeRequested.DateTime().Minute(), timeRequested.DateTime().Second(), timeRequested.DateTime().MicroSecond()); + + // Do request to position update. + err = DoNotifyUpdateL(iPosInfo); + + iPosInfo.GetPosition(pos); + + // First update, ref pos, KErrNone. + if (iUpdateIndex == 0) + { + // Verify time taken for first update. + timeFirstStamped = pos.Time(); // Need to remember the time we received this update. + if(!VerifyFirstPosTime(timeRequested, iPosInfo, iUpdateOpts)) + { + SetTestStepResult(EFail); + } + + // Verify reference position. + TPositionInfo verifyRefPosInfo; + + verifyRefPosInfo.SetPosition(iRefPos); + if (!utils.Compare_PosInfo(verifyRefPosInfo, iPosInfo)) + { + INFO_PRINTF1(_L("Failed test, reference position incorrect.")); + SetTestStepResult(EFail); + } + + // Expected error. + iExpectedErr = KErrNone; + + // Expect to verify interval time, for other updates. + iVerifyInterval = ETrue; + iPreviousPos = iPosInfo; + } + + // Remaining updates. + else + { + // Increment the expected time interval 'window' the update is expected to arrive in + iUpdateWindowIndex++; + + // Determine expected err, and any special test actions. + switch (iUpdateIndex) + { + // Second update, gps accurate, KErrNone, after n * intervals. + case 1: + { + iExpectedErr = KErrNone; + + if(testCaseId == 7) + { + DoInterval_TestCaseId_07(); + } + else if(testCaseId == 8) + { + DoInterval_TestCaseId_08(); + } + else + { + // Got the first accurate gps update, switch on partial updates. + iUpdateOpts.SetAcceptPartialUpdates(ETrue); + iPositioner.SetUpdateOptions(iUpdateOpts); + } + + break; + } + + // Remaining updates as per test case. + default: + { + switch (testCaseId) + { + // Test case LBS-Tracking-001 + case 1: + { + DoInterval_TestCaseId_01(); + + break; + } + + // Test case LBS-Tracking-002 + case 2: + { + DoInterval_TestCaseId_02(); + + break; + } + + // Test case LBS-Tracking-003 + case 3: + { + DoInterval_TestCaseId_03(); + + break; + } + + // Test case LBS-Tracking-004 + case 4: + { + DoInterval_TestCaseId_04(); + + break; + } + + // Test case LBS-Tracking-005 + case 5: + { + DoInterval_TestCaseId_05(); + + break; + } + + // Test case LBS-Tracking-006 + case 6: + { + DoInterval_TestCaseId_06(); + + break; + } + + // Test case LBS-Tracking-007 + case 7: + { + DoInterval_TestCaseId_07(); + + break; + } + + // Test case LBS-Tracking-008 + case 8: + { + DoInterval_TestCaseId_08(); + + break; + } + } + } + break; + } + + // Verify correct interval for update, if required. + if (iVerifyInterval) + { + if(!VerifyPosTime(timeFirstStamped, iUpdateOpts, iPosInfo, iUpdateWindowIndex)) + { + INFO_PRINTF1(_L("Failed: Position received outside time range")); + SetTestStepResult(EFail); + } + } + + if(iCheckIfSameAsPreviousPosition) + { + if(iSameAsPreviousPos && !utils.Compare_PosInfo(iPreviousPos, iPosInfo)) + { + INFO_PRINTF1(_L("Failed test, position different from previous, when it should be same.")); + SetTestStepResult(EFail); + } + if(!iSameAsPreviousPos && utils.Compare_PosInfo(iPreviousPos, iPosInfo)) + { + INFO_PRINTF1(_L("Failed test, position same as previous, when it should be different.")); + SetTestStepResult(EFail); + } + } + iPreviousPos = iPosInfo; + } + + // Verify err. + if (err != iExpectedErr) + { + SetTestStepResult(EFail); + } + } + + } + + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_Tracking::doTestStepL()")); + + return TestStepResult(); + } + + +// Test 1 - expected updates +// +// Ref pos, KErrNone, before interval +// Gps pos (accurate), KErrNone, after n * intervals +// Gps pos (accurate), KErrNone, after interval +// Gps pos (partial), KPositionPartialUpdate, after interval +// +void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_01() +{ + + switch (iUpdateIndex) + { + case 2: // Third update, gps accurate, KErrNone. + { + iExpectedErr = KErrNone; + + break; + } + + case 3: // Last update, gps inaccurate, KPositionPartialUpdate. + { + iExpectedErr = KPositionPartialUpdate; + + break; + } + } + } + + +// Test 2 - expected updates +// +// Ref pos, KErrNone, before interval +// Gps pos (accurate), KErrNone, after n * intervals +// Gps pos (accurate), KErrNone, after interval +// Gps pos (accurate), KErrNone, after interval +// +void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_02() +{ + + switch (iUpdateIndex) + { + case 2: // Third update, gps accurate, KErrNone. + case 3: // Last update, gps accurate, KErrNone. + { + iExpectedErr = KErrNone; + + break; + } + } + } + + +// Test 3 - expected updates +// +// Ref pos, KErrNone, before interval +// Gps pos (accurate), KErrNone, after n * intervals +// Gps pos (NAN), KPositionPartialUpdate, after interval +// Gps pos (NAN), KPositionPartialUpdate, after interval +// +void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_03() +{ + + switch (iUpdateIndex) + { + case 2: // Third update, gps NAN, KPositionPartialUpdate. + case 3: // Last update, gps NAN, KPositionPartialUpdate. + { + iExpectedErr = KPositionPartialUpdate; + + break; + } + } + } + + +// Test 4 - expected updates +// +// Ref pos, KErrNone, before interval +// Gps pos (accurate), KErrNone, after n * intervals +// Gps pos (inaccurate), KPositionPartialUpdate, after interval +// Gps pos (inaccurate), KPositionPartialUpdate, after interval +// +void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_04() +{ + + switch (iUpdateIndex) + { + case 2: // Third update, gps accurate, KPositionPartialUpdate. + case 3: // Last update, gps inaccurate, KPositionPartialUpdate. + { + iExpectedErr = KPositionPartialUpdate; + + break; + } + } + } + + +// Test 5 - expected updates +// +// Ref pos, KErrNone, before interval +// Gps pos (accurate), KErrNone, after n * intervals +// Gps pos (accurate), KErrNonee, after interval +// Gps pos (not delivered), KErrTimedOut, after interval +// +void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_05() +{ + + switch (iUpdateIndex) + { + case 2: // Third update, gps accurate, KErrNone. + { + iExpectedErr = KErrNone; + + // Send timeout to the A-GPS hybrid module - we expect further updates to timeout. + TTimeIntervalMicroSeconds timeOutVal(40000000); + + ConfigureModuleTimeOut(timeOutVal); + + break; + } + + case 3: // Last update, gps inaccurate, KPositionPartialUpdate. + { + iExpectedErr = KErrTimedOut; + iVerifyInterval = EFalse; + + // Reset the timeout in the A-GPS module. + TTimeIntervalMicroSeconds timeOutVal(0); + ConfigureModuleTimeOut(timeOutVal); + break; + } + } + } + +// Test 6 - expected updates +// +// Ref pos, KErrNone, before interval +// Gps pos (accurate), KErrNone, after n * intervals +// Gps pos (inaccurate), KPositionPartialUpdate, after interval +// Gps pos (NAN), KPositionQualityLoss, before interval (because of futile udpate) +// Gps pos (inaccurate), KPositionPartialUpdate, after interval +// +void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_06() +{ + + switch (iUpdateIndex) + { + case 2: // Third update, gps inaccurate, KPositionPartialUpdate. + { + iExpectedErr = KPositionPartialUpdate; + break; + } + + case 3: // Fourth update, gps NAN, KPositionQualityLoss. + { + iExpectedErr = KPositionQualityLoss; + + // This update should have happened before the next expected + // interval window (because it's a futile update from the + // GPS module), so it will be in the previous 'window' + iUpdateWindowIndex--; + break; + } + + case 4: // Last update, gps inaccurate, KPositionPartialUpdate. + { + iExpectedErr = KPositionPartialUpdate; + break; + } + } + } + +// Test 7 - expected updates +// +// Ref pos, KErrNone, before interval +// Gps pos (accurate), KErrNone, after n * intervals +// Gps pos (inaccurate), KPositionQualityLoss, after timeout +// +void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_07() + { + switch (iUpdateIndex) + { + case 1: + { + iExpectedErr = KErrNone; + break; + } + case 2: + { + iVerifyInterval = EFalse; + iExpectedErr = KPositionQualityLoss; + break; + } + } + } + +void CT_LbsClientStep_Tracking::DoInterval_TestCaseId_08() + { + iExpectedErr = KErrNone; + switch (iUpdateIndex) + { + case 1: + case 3: + { + iSameAsPreviousPos = EFalse; + break; + } + case 2: + { + iSameAsPreviousPos = ETrue; + break; + } + } + } + +// A-GPS hybrid module configuration function. +void CT_LbsClientStep_Tracking::ConfigureModuleTimeOut(TTimeIntervalMicroSeconds& aTimeOut) + { + CT_LbsAGpsHandler* modHandler; + modHandler = CT_LbsAGpsHandler::NewL(this); + + // Send timeout request. + modHandler->SendRequestTimeOutMsg(aTimeOut); + + // Wait for response from module. + CActiveScheduler::Start(); + + delete modHandler; + } + + +// Response back from A-GPS hybrid module to notify the test it has got the timeout request. +void CT_LbsClientStep_Tracking::ProcessAGpsResponseMessage(const TT_LbsAGpsResponseMsg::TModuleResponseType aResponse) + { + if (TT_LbsAGpsResponseMsg::EModuleResponseOk != aResponse) + { + // fail test could not config module! + INFO_PRINTF2(_L("Unable to configure hybrid module, err %d."), aResponse); + SetTestStepResult(EFail); + } + + // Return back to test. + CActiveScheduler::Stop(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepupdateoptions.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientstepupdateoptions.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,1274 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsclientstep_UpdateOptions.cpp +// This is the class implementation for the UpdateOptions Tests +// +// + +#include "ctlbsclientstepupdateoptions.h" + +#include +#include + +#include "tlbsutils.h" +#include "ctlbsasyncwaiter.h" + +#define EXPECTED_GPS_ACCURACY_HORIZONTAL 100 +#define EXPECTED_GPS_ACCURACY_VERTICAL 100 + +const TTimeIntervalMicroSeconds KTimestampMargin = 500000; //+/-0.5s + +/** + + */ +TBool CT_LbsClientStep_UpdateOptions::VerifyFirstPosTime(const TTime& aTimeRequested, const TPositionInfo& aPosInfo, const TPositionUpdateOptions& aUpdateOpts) + { + TTime timeReceived, timeStamp; + TPosition pos; + + TInt64 maxtime; + maxtime = aUpdateOpts.UpdateTimeOut().Int64(); + if(!maxtime) + { + #pragma message("TO DO: CT_LbsClientStep_UpdateOptions::VerifyFirstPosTime - Update when moduleinfo supported") + const TTimeIntervalMicroSeconds ttff = 90*1000000; // TO DO - this should be retrieved from the module info (currently hardcoded in locserver too) + maxtime = ttff.Int64(); + } + + // get current time + timeReceived.UniversalTime(); + + // get the position data: + aPosInfo.GetPosition(pos); + + INFO_PRINTF1(_L("First position received at: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeReceived.DateTime().Day() + 1, timeReceived.DateTime().Month() + 1, timeReceived.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeReceived.DateTime().Hour(), timeReceived.DateTime().Minute(), timeReceived.DateTime().Second(), timeReceived.DateTime().MicroSecond()); + + timeStamp = pos.Time(); + INFO_PRINTF1(_L("First position timeStamp: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeStamp.DateTime().Day() + 1, timeStamp.DateTime().Month() + 1, timeStamp.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeStamp.DateTime().Hour(), timeStamp.DateTime().Minute(), timeStamp.DateTime().Second(), timeStamp.DateTime().MicroSecond()); + + TInt64 timediff; + timediff = timeReceived.Int64() - aTimeRequested.Int64(); + + // *first* position received can arrive 'immediately' and up to timeout, or maxtimetofirstfix if timeout not specified + if(timediff > maxtime) + { + INFO_PRINTF1(_L("Failed: First Position received outside time range")); + return FALSE; + } + else + { + return TRUE; + } + + } + + +/** + aPosCount - which position in a set of periodic positions this is (first position = 0) + */ +TBool CT_LbsClientStep_UpdateOptions::VerifyPosTime(const TTime& aTimeFirstPosStamped, const TPositionUpdateOptions& aUpdateOpts, TPositionInfo& aPosInfo, TInt aPosCount) + { + TTime timeReceived, timeStamp; + TPosition pos; + TInt64 interval = aUpdateOpts.UpdateInterval().Int64(); + TTimeIntervalMicroSeconds timeout; + timeout = aUpdateOpts.UpdateTimeOut().Int64(); + + // should call different function for first position: + __ASSERT_ALWAYS(aPosCount > 0, User::Panic(_L("Update options test"), KErrArgument)); + + // get current time + timeReceived.UniversalTime(); + + // get the position data: + aPosInfo.GetPosition(pos); + + INFO_PRINTF1(_L("Position received at: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeReceived.DateTime().Day() + 1, timeReceived.DateTime().Month() + 1, timeReceived.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeReceived.DateTime().Hour(), timeReceived.DateTime().Minute(), timeReceived.DateTime().Second(), timeReceived.DateTime().MicroSecond()); + + timeStamp = pos.Time(); + INFO_PRINTF1(_L("Position timeStamp: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeStamp.DateTime().Day() + 1, timeStamp.DateTime().Month() + 1, timeStamp.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeStamp.DateTime().Hour(), timeStamp.DateTime().Minute(), timeStamp.DateTime().Second(), timeStamp.DateTime().MicroSecond()); + + TTime windowstart = aTimeFirstPosStamped + static_cast(aPosCount * interval) - KTimestampMargin; + TTime windowend = windowstart + timeout + KTimestampMargin; + + INFO_PRINTF1(_L("valid window start: ")); + INFO_PRINTF4(_L("%d/%d/%d"), windowstart.DateTime().Day() + 1, windowstart.DateTime().Month() + 1, windowstart.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), windowstart.DateTime().Hour(), windowstart.DateTime().Minute(), windowstart.DateTime().Second(), windowstart.DateTime().MicroSecond()); + + if(timeStamp < windowstart) + { + INFO_PRINTF1(_L("Failed: Position received outside time range")); + return FALSE; + } + if(timeout.Int64() && (timeStamp > windowend)) + { + INFO_PRINTF1(_L("valid window end: ")); + INFO_PRINTF4(_L("%d/%d/%d"), windowend.DateTime().Day() + 1, windowend.DateTime().Month() + 1, windowend.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), windowend.DateTime().Hour(), windowend.DateTime().Minute(), windowend.DateTime().Second(), windowend.DateTime().MicroSecond()); + + return FALSE; + } + else + { + return TRUE; + } + } + + + + +// constant definitions +_LIT(KLbsClientStepUpdateOptions, "LbsClientStepUpdateOptions"); + +/** + * Sets a Requestor for now - TO DO will be removed with new location server? + */ +void CT_LbsClientStep_UpdateOptions::TempSetRequestorL() + { + User::LeaveIfError(iPositioner.SetRequestor( CRequestor::ERequestorService, + CRequestor::EFormatApplication, + _L("Tom Tom"))); + } + + +/** + * Destructor + */ +CT_LbsClientStep_UpdateOptions::~CT_LbsClientStep_UpdateOptions() + { + delete iLbsAdmin; + } + + +/** + * Constructor + */ +CT_LbsClientStep_UpdateOptions::CT_LbsClientStep_UpdateOptions(CT_LbsClientServer& aParent) : CT_LbsClientStep(aParent), iLbsAdmin(NULL), iRequestedAssData(FALSE), iReceivedAssData(FALSE) + { + SetTestStepName(KLbsClientStep_UpdateOptions); + } + + +/** +Static Constructor +*/ +CT_LbsClientStep_UpdateOptions* CT_LbsClientStep_UpdateOptions::New(CT_LbsClientServer& aParent) + { + return new CT_LbsClientStep_UpdateOptions(aParent); + // Note the lack of ELeave. + // This means that having insufficient memory will return NULL; + } + + +/** +Compare UpdateOptions +*/ +TBool CT_LbsClientStep_UpdateOptions::CompareUpdateOptions(TPositionUpdateOptions aPosA, TPositionUpdateOptions aPosB) + { + TBool isEqual = ETrue; + + if(aPosA.AcceptPartialUpdates() != aPosB.AcceptPartialUpdates()) + { + return EFalse; + } + + if(aPosA.MaxUpdateAge() != aPosB.MaxUpdateAge()) + { + return EFalse; + } + + if(aPosA.PositionClassSize() != aPosB.PositionClassSize()) + { + return EFalse; + } + + if(aPosA.PositionClassType() != aPosB.PositionClassType()) + { + return EFalse; + } + + if(aPosA.UpdateInterval() != aPosB.UpdateInterval()) + { + return EFalse; + } + + if(aPosA.UpdateTimeOut() != aPosB.UpdateTimeOut()) + { + return EFalse; + } + + return isEqual; + + } + +/** + * @return - TVerdict code + * Override of base class pure virtual + * Our implementation only gets called if the base class doTestStepPreambleL() did + * not leave. That being the case, the current test result value will be EPass. + */ +TVerdict CT_LbsClientStep_UpdateOptions::doTestStepL() + { + // Generic test step used to test the LBS SetUpdateOptions API. + INFO_PRINTF1(_L(">>CT_LbsClientStep_UpdateOptions::doTestStepL()")); + + if (TestStepResult()==EPass) + { + TInt err = KErrNone; + + // Connect to self locate server. + User::LeaveIfError(iServer.Connect()); + CleanupClosePushL(iServer); + + // Carryout unique test actions. + TInt testCaseId; + if (GetIntFromConfig(ConfigSection(), KTestCaseId, testCaseId)) + { + switch (testCaseId) + { + // Test case LBS-UpdateOptions-001 + case 1: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + TPositionUpdateOptions optsA; + + TPositionUpdateOptions optsB; + iPositioner.SetUpdateOptions(optsA); + iPositioner.GetUpdateOptions(optsB); + if (!CompareUpdateOptions(optsA, optsB)) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + // Test case LBS-UpdateOptions-002 + case 2: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + //(aInterval, aTimeOut, aMaxAge, TBool aAcceptPartialUpdates=EFalse) + TPositionUpdateOptions optsA(-1, 0, 0, EFalse); + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + // Test case LBS-UpdateOptions-003 + case 3: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + TPositionUpdateOptions optsA(0, -1, 0, EFalse); + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + // Test case LBS-UpdateOptions-004 + case 4: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + TPositionUpdateOptions optsA(0, 0, -1, EFalse); + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + + // Test case LBS-UpdateOptions-005 + case 5: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + TPositionUpdateOptions& updateOpts = iParent.iSharedData->iVerifyUpdateOpts; + iPositioner.SetUpdateOptions(updateOpts); + + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + posInfoArr.Append(posInfo); + + TTime timeRequested; + timeRequested.UniversalTime(); + INFO_PRINTF1(_L("Position requested at: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeRequested.DateTime().Day() + 1, timeRequested.DateTime().Month() + 1, timeRequested.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeRequested.DateTime().Hour(), timeRequested.DateTime().Minute(), timeRequested.DateTime().Second(), timeRequested.DateTime().MicroSecond()); + + + // Get the actual position + err = DoNotifyUpdateL(*posInfo); + if (KErrNone != err || !VerifyFirstPosTime(timeRequested, *posInfo, updateOpts)) + { + SetTestStepResult(EFail); + } + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + + // Test case LBS-UpdateOptions-006 + case 6: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + // Create a posinfo and store in our shared array for later verification. + TPositionInfo* posInfo = new(ELeave) TPositionInfo(); + posInfoArr.Append(posInfo); + + TRequestStatus status; + + TPositionUpdateOptions tempOpts; + // set a fairly long interval (1 minute) to ensure the 2nd request doesn't complete too quicky: + tempOpts.SetUpdateInterval(60*1000000); + tempOpts.SetUpdateTimeOut(300*1000000); + iPositioner.SetUpdateOptions(tempOpts); + iPositioner.GetUpdateOptions(tempOpts); + + TempSetRequestorL(); + + TTime timeRequested; + TTime timeFirstStamped; + + INFO_PRINTF2(_L("Requesting position (current interval set to %d): "),tempOpts.UpdateInterval().Int64() ); + timeRequested.UniversalTime(); + err = DoNotifyUpdateL(*posInfo); + if (KErrNone != err) + { + INFO_PRINTF2(_L("Failed: Position Update failed with %d"), err); + SetTestStepResult(EFail); + } + else + { + TPosition pos; + posInfo->GetPosition(pos); + + // need to remember the time we received this one: + timeFirstStamped = pos.Time(); + if(!VerifyFirstPosTime(timeRequested, *posInfo, tempOpts)) + { + SetTestStepResult(EFail); + } + } + + // Create another posinfo and store in our shared array for later verification. + posInfo = new(ELeave) TPositionInfo(); + posInfoArr.Append(posInfo); + + INFO_PRINTF2(_L("Requesting position (current interval set to %d): "), tempOpts.UpdateInterval().Int64()); + + // this should complete after original interval (1 min), despite setting a new interval while it's outstanding: + iPositioner.NotifyPositionUpdate(*posInfo, status); + + // set configured update options while update still outstanding: + TPositionUpdateOptions& updateOpts = iParent.iSharedData->iVerifyUpdateOpts; + iPositioner.SetUpdateOptions(updateOpts); + iPositioner.GetUpdateOptions(updateOpts); + + INFO_PRINTF2(_L("Interval now set to %d microseconds"), updateOpts.UpdateInterval().Int64()); + + User::WaitForRequest(status); + + // verify time for 'outstanding when interval changed' position + if(!VerifyPosTime(timeFirstStamped, tempOpts, *posInfo, 1)) + { + INFO_PRINTF1(_L("CT_LbsClientStep_UpdateOptions::doTestStepL() Failed: Time received outside valid range")); + SetTestStepResult(EFail); + } + else + { + TInt numOfPosInfos = iParent.iSharedData->iVerifyPosInfoArr.Count() - 2; // -2 because first 2 positions used above + for(TInt i = 0 ; i < numOfPosInfos ; i++) + { + // get current time + timeRequested.UniversalTime(); + INFO_PRINTF1(_L("Position requested at: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeRequested.DateTime().Day() + 1, timeRequested.DateTime().Month() + 1, timeRequested.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeRequested.DateTime().Hour(), timeRequested.DateTime().Minute(), timeRequested.DateTime().Second(), timeRequested.DateTime().MicroSecond()); + + //Do request to position update + posInfo = new(ELeave) TPositionInfo(); + posInfoArr.Append(posInfo); + + err = DoNotifyUpdateL(*posInfo); + if (KErrNone != err) + { + INFO_PRINTF2(_L("Failed: Position Update failed with %d"), err); + SetTestStepResult(EFail); + } + else + { + if(i > 0) + { + if(!VerifyPosTime(timeFirstStamped, updateOpts, *posInfo, i)) + { + INFO_PRINTF1(_L("Failed: Position received outside time range")); + SetTestStepResult(EFail); + } + } + else // first position + { + TPosition pos; + + posInfo->GetPosition(pos); + + // need to remember the time we received this one: + timeFirstStamped = pos.Time(); + if(!VerifyFirstPosTime(timeRequested, *posInfo, updateOpts)) + { + SetTestStepResult(EFail); + } + } + } + } + } + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + + // Test case LBS-UpdateOptions-007 + case 7: + case 107: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + + // For this test an additional reference position will be returned. + if (testCaseId == 107) + { + // Setup netsim. + User::LeaveIfError(OpenNetSim()); + + // Request notify for the expected reference position. + TPositionInfo actualRefPosInfo; + + err = DoNotifyUpdateL(actualRefPosInfo); + if (err) + { + INFO_PRINTF2(_L("Failed test, reference position request returned err %d."), err); + + SetTestStepResult(EFail); + } + + // Verify reference position. + T_LbsUtils utils; + TPositionInfo verifyRefPosInfo; + + verifyRefPosInfo.SetPosition(iRefPos); + if (!utils.Compare_PosInfo(verifyRefPosInfo, actualRefPosInfo)) + { + INFO_PRINTF1(_L("Failed test, reference position incorrect.")); + SetTestStepResult(EFail); + } + } + + + TPositionUpdateOptions& updateOpts = iParent.iSharedData->iVerifyUpdateOpts; + + iPositioner.SetUpdateOptions(updateOpts); + + // verify that the set worked: + ASSERT(updateOpts.UpdateInterval() == iParent.iSharedData->iVerifyUpdateOpts.UpdateInterval()); + + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + TPositionInfo* posInfo; + TTime timeRequested; + + iPositioner.GetUpdateOptions(updateOpts); + + TInt numOfPosInfos = iParent.iSharedData->iVerifyPosInfoArr.Count(); + TTime timeFirstStamped; + for(TInt i = 0 ; i < numOfPosInfos ; i++) + { + // get current time + timeRequested.UniversalTime(); + INFO_PRINTF1(_L("Position requested at: ")); + INFO_PRINTF4(_L("%d/%d/%d"), timeRequested.DateTime().Day() + 1, timeRequested.DateTime().Month() + 1, timeRequested.DateTime().Year()); + INFO_PRINTF5(_L("at %d :%d :%d :%d"), timeRequested.DateTime().Hour(), timeRequested.DateTime().Minute(), timeRequested.DateTime().Second(), timeRequested.DateTime().MicroSecond()); + + //Do request to position update + posInfo = new(ELeave) TPositionInfo(); + posInfoArr.Append(posInfo); + + err = DoNotifyUpdateL(*posInfo); + if (KErrNone != err) + { + INFO_PRINTF2(_L("NotifyUpdate failed with %d "), err); + SetTestStepResult(EFail); + } + else + { + if(i > 0) + { + if(!VerifyPosTime(timeFirstStamped, updateOpts, *posInfo, i)) + { + INFO_PRINTF1(_L("Failed: Position received outside time range")); + SetTestStepResult(EFail); + } + } + else // first position + { + TPosition pos; + + posInfo->GetPosition(pos); + + // need to remember the time we received this one: + timeFirstStamped = pos.Time(); + if(!VerifyFirstPosTime(timeRequested, *posInfo, updateOpts)) + { + SetTestStepResult(EFail); + } + } + } + } + + // Clean up. + CleanupStack::PopAndDestroy(&iPositioner); + if (testCaseId == 107) + { + CloseNetSim(); + } + + break; + } + + // Test case LBS-UpdateOptions-008 + case 8: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + //2 second interval + TPositionUpdateOptions optsA(2000000, 0, 0, EFalse); + optsA.SetUpdateInterval(-1); + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + // Test case LBS-UpdateOptions-009 + case 9: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + + //10 second interval + TPositionUpdateOptions posUpdateOptsA(10000000, 0, 0, EFalse); + TPositionUpdateOptions posUpdateOptsB; + iPositioner.SetUpdateOptions(posUpdateOptsA); + iPositioner.GetUpdateOptions(posUpdateOptsB); + + if(!CompareUpdateOptions(posUpdateOptsA, posUpdateOptsB)) + { + INFO_PRINTF1(_L("SetUpdate and GetUpdate comparison didn't match")); + SetTestStepResult(EFail); + } + + //5 second timeout + posUpdateOptsA.SetUpdateTimeOut(5000000); + iPositioner.SetUpdateOptions(posUpdateOptsA); + iPositioner.GetUpdateOptions(posUpdateOptsB); + + if(!CompareUpdateOptions(posUpdateOptsA, posUpdateOptsB)) + { + INFO_PRINTF1(_L("SetUpdate and GetUpdate comparison didn't match")); + SetTestStepResult(EFail); + } + + TPositionInfo posInfo; + + // TO DO - is this sufficient, or should we really be testing how long it takes to timeout? + + // Get the actual position, should time out on AGPS side + // ** Configure test gps module to cause a timeout + err = DoNotifyUpdateL(posInfo); + if (KErrTimedOut != err) + { + INFO_PRINTF1(_L("AGPS module didn't timeout as expected.")); + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + + // Test case LBS-UpdateOptions-010 + case 10: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + TPositionUpdateOptions optsA; + optsA.SetUpdateTimeOut(-1); + + CleanupStack::PopAndDestroy(&iPositioner); + break; + } + + + // Test case LBS-UpdateOptions-011 + case 11: + { + // Open positioner with + // configured required quality + TPositionCriteria criteria; + TPositionQuality quality; + + // set up the required accuracy + quality.SetHorizontalAccuracy(EXPECTED_GPS_ACCURACY_HORIZONTAL); + quality.SetVerticalAccuracy(EXPECTED_GPS_ACCURACY_VERTICAL); + + criteria.SetRequiredQuality(quality); + User::LeaveIfError(iPositioner.Open(iServer, criteria)); + CleanupClosePushL(iPositioner); + + //Configure partial Updates + TPositionUpdateOptions optsA; + optsA.SetAcceptPartialUpdates(EFalse); + if(EFalse != optsA.AcceptPartialUpdates()) + { + INFO_PRINTF1(_L("Partial Updates not set.")); + SetTestStepResult(EFail); + } + + iPositioner.SetUpdateOptions(optsA); + + + // NOTE: + // -Expect to call NPU once, and have module return 2 partial updates + // before finally returning the complete update. + // -We need a way to inform the module that it nedes to return partial updates + // When we have AcceptPartialUpdates SwitchedOff. + + // ** Test AGPS manager must already be configured to return partial location info + // ** We should only see the full location info to required accuracy etc + TPositionInfo positionInfo; + TPositionInfo positionInfoTemp = reinterpret_cast(iParent.iSharedData->iVerifyPosInfoArr[2]); + + // Get the actual position + err = DoNotifyUpdateL(positionInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + else + { + //Compare posInfo with Moduledata 3 + T_LbsUtils utils; + if(!utils.Compare_PosInfo(positionInfo, positionInfoTemp)) + { + INFO_PRINTF1(_L("We didn't recieve complete update.")); + SetTestStepResult(EFail); + } + } + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + // Test case LBS-UpdateOptions-012 + case 12: + { + // Open positioner with + // configured required quality + TPositionCriteria criteria; + TPositionQuality quality; + + // set up the required accuracy + quality.SetHorizontalAccuracy(EXPECTED_GPS_ACCURACY_HORIZONTAL); + quality.SetVerticalAccuracy(EXPECTED_GPS_ACCURACY_VERTICAL); + + criteria.SetRequiredQuality(quality); + err = iPositioner.Open(iServer, criteria); + User::LeaveIfError(err); + CleanupClosePushL(iPositioner); + + //Configure partial Updates + TPositionUpdateOptions optsA; + optsA.SetAcceptPartialUpdates(ETrue); + if(!optsA.AcceptPartialUpdates()) + { + INFO_PRINTF1(_L("Partial Updates not set.")); + SetTestStepResult(EFail); + } + + err = iPositioner.SetUpdateOptions(optsA); + User::LeaveIfError(err); + + // NOTE: + // -Expect to call NPU repeatedly to recieve each partial update + // -We need a way to inform the module that it nedes to return partial updates + // When we have AcceptPartialUpdates SwitchedOff. + + // ** Test AGPS manager must already be configured to return partial location info + // ** We should only see the full location info to required accuracy etc + + // Create a posinfo and store in our shared array for later verification. + RPointerArray& posInfoArr = iParent.iSharedData->iCurrentPosInfoArr; + T_LbsUtils utils; + utils.ResetAndDestroy_PosInfoArr(posInfoArr); // Clear previous entries before new entry is appended. + + TInt loopCount = iParent.iSharedData->iCurrentPosInfoArr.Count()-1; + // Get the actual position + for(int i = 0 ; i < loopCount ; i++ ) + { + TPositionInfo* positionInfo = new(ELeave) TPositionInfo(); + posInfoArr.Append(positionInfo); + + err = DoNotifyUpdateL(*positionInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + } + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + // Test case LBS-UpdateOptions-013 + case 13: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + TPositionInfo posInfo; + TPositionInfo posInfob; + + // This call to NPU puts a location in cache + err = DoNotifyUpdateL(posInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + // TO DO - read these from config? + TPositionUpdateOptions posOpts; + posOpts.SetMaxUpdateAge(1*1000000); + posOpts.SetUpdateInterval(5*1000000); + + if((posOpts.MaxUpdateAge() != 1000000) || (posOpts.UpdateInterval() != 5000000)) + { + SetTestStepResult(EFail); + } + + iPositioner.SetUpdateOptions(posOpts); + + //Retrieve cached location with second call to NPU + err = DoNotifyUpdateL(posInfob); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + //INTERNAL COMPARISON + //Make sure we've retrieved the cached location + T_LbsUtils utils; + if(!utils.Compare_PosInfo(posInfo, posInfob)) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + + + + + // Test case LBS-UpdateOptions-014 + case 14: + { + T_LbsUtils utils; + TPositionModuleId networkModId = utils.GetNetworkModuleIdL(iServer); + + // Open positioners. + User::LeaveIfError(iPositioner.Open(iServer, networkModId)); + CleanupClosePushL(iPositioner); + + RPositionServer server2; + RPositioner positioner2; + + // Connect to self locate servers. + User::LeaveIfError(server2.Connect()); + CleanupClosePushL(server2); + + TPositionModuleId aGpsModId = utils.GetAGpsModuleIdL(server2); + + User::LeaveIfError(positioner2.Open(server2, aGpsModId)); + CleanupClosePushL(positioner2); + + + TPositionUpdateOptions optsA; + TPositionUpdateOptions optsB; + + optsA.SetMaxUpdateAge(10000000); + optsA.SetUpdateInterval(5000000); + + optsB.SetMaxUpdateAge(0); + optsB.SetUpdateInterval(2000000); + + TPositionInfo posInfo; + TPositionInfo posInfob; + + + // Get the actual position + err = DoNotifyUpdateL(posInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + err = DoNotifyUpdateL(posInfob); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&positioner2); + CleanupStack::PopAndDestroy(&server2); + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + + + + // Test case LBS-UpdateOptions-015 + case 15: + { + T_LbsUtils utils; + TPositionModuleId networkModId = utils.GetNetworkModuleIdL(iServer); + + // Open positioners. + User::LeaveIfError(iPositioner.Open(iServer, networkModId)); + CleanupClosePushL(iPositioner); + + RPositionServer server2; + RPositioner positioner2; + + // Connect to self locate servers. + User::LeaveIfError(server2.Connect()); + CleanupClosePushL(server2); + + User::LeaveIfError(positioner2.Open(server2, networkModId)); + CleanupClosePushL(positioner2); + + + TPositionUpdateOptions optsA; + TPositionUpdateOptions optsB; + + optsA.SetMaxUpdateAge(10000000); + optsA.SetUpdateInterval(5000000); + + optsB.SetMaxUpdateAge(0); + optsB.SetUpdateInterval(2000000); + + TPositionInfo posInfo; + TPositionInfo posInfob; + + + // Get the actual position + err = DoNotifyUpdateL(posInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + // Loop? Keep calling until full info recieved. + err = DoNotifyUpdateL(posInfob); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&positioner2); + CleanupStack::PopAndDestroy(&server2); + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + + + + + // Test case LBS-UpdateOptions-016 + case 16: + { + T_LbsUtils utils; + TPositionModuleId networkModId = utils.GetNetworkModuleIdL(iServer); + + // Open positioners. + User::LeaveIfError(iPositioner.Open(iServer, networkModId)); + CleanupClosePushL(iPositioner); + + RPositionServer server2; + RPositioner positioner2; + + //Connect to self locate server + TPositionModuleId aGpsModId = utils.GetAGpsModuleIdL(server2); + + User::LeaveIfError(positioner2.Open(iServer, aGpsModId)); + CleanupClosePushL(positioner2); + + TPositionUpdateOptions optsA; + TPositionUpdateOptions optsB; + + optsA.SetMaxUpdateAge(10000000); + optsA.SetUpdateInterval(5000000); + + optsB.SetMaxUpdateAge(0); + optsB.SetUpdateInterval(2000000); + + TPositionInfo posInfo; + TPositionInfo posInfob; + + // Get the actual position + err = DoNotifyUpdateL(posInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + // Loop? Keep calling until full info recieved. + err = DoNotifyUpdateL(posInfob); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&positioner2); + CleanupStack::PopAndDestroy(&server2); + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + + + // Test case LBS-UpdateOptions-017 + case 17: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + + TPositionUpdateOptions optsA; + optsA.SetUpdateInterval(1000000); + optsA.SetMaxUpdateAge(5000000); + + if((optsA.MaxUpdateAge() != 5000000) || (optsA.UpdateInterval() != 1000000)) + { + SetTestStepResult(EFail); + } + + iPositioner.SetUpdateOptions(optsA); + // Test AGPS manager must already be configured to return partial location info + + TPositionInfo posInfo; + + // This call to NPU puts a location in cache + err = DoNotifyUpdateL(posInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + /* + MaxUpdateAge () returns the current age limit for + information returned by NotifyPositionUpdate(). + Zero is returned when there is no acceptable age limit. + */ + + if(optsA.MaxUpdateAge() != 0) + { + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + // Test case LBS-UpdateOptions-018 + case 18: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + TPositionUpdateOptions optsA; + optsA.SetMaxUpdateAge(-1); + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + + // Test case LBS-UpdateOptions-019 + case 19: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + //MaxUpdateAge comparision replacede by verify data step + TPositionUpdateOptions& updateOpts = iParent.iSharedData->iVerifyUpdateOpts; + + TPositionInfo posInfoA, posInfoB; + + //Get fresh location and have it in cache + err = DoNotifyUpdateL(posInfoA); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + //Second call to NPU should have maxupdateage set. + iPositioner.SetUpdateOptions(updateOpts); + + err = DoNotifyUpdateL(posInfoB); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + T_LbsUtils utils; + + if(!utils.Compare_PosInfo(posInfoA, posInfoB)) + { + //Cached copy doesnt match retrieved copy. + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + // Test case LBS-UpdateOptions-020 + case 20: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + TPositionInfo cachedInfo, firstposInfo, secondposInfo; + + TPositionUpdateOptions& updateOpts = iParent.iSharedData->iVerifyUpdateOpts; + updateOpts.SetUpdateInterval(0); + updateOpts.SetMaxUpdateAge(0); + //Second call to NPU should have maxupdateage set. + iPositioner.SetUpdateOptions(updateOpts); + + // Get fresh location and have it in cache + err = DoNotifyUpdateL(cachedInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + // Change the max fix time + updateOpts.SetMaxUpdateAge(5000000); + iPositioner.SetUpdateOptions(updateOpts); + + // Wait 4 seconds + User::After(4000000); + + // Get a position should be the same as in the cache + err = DoNotifyUpdateL(firstposInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + // Wait 2 seconds + User::After(2000000); + // Get a position should not be the same as the cache + err = DoNotifyUpdateL(secondposInfo); + if (KErrNone != err) + { + SetTestStepResult(EFail); + } + + T_LbsUtils utils; + + TBool a = utils.Compare_PosInfo(cachedInfo, firstposInfo); + TBool b = utils.Compare_PosInfo(firstposInfo, secondposInfo); + + if(!a || b) + { + //Cached copy doesnt match retrieved copy. + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + + // Test case LBS-UpdateOptions-101 (for DEF118183) + case 101: + { + // Open positioner. + User::LeaveIfError(iPositioner.Open(iServer)); + CleanupClosePushL(iPositioner); + + TPositionInfo posInfoa; + TPositionInfo posInfob; + TPositionInfo posInfoc; + + // This call to NPU puts a location in cache + err = DoNotifyUpdateL(posInfoa); + if (KErrNone != err) + { + INFO_PRINTF2(_L("Failed: During first call to NPU err is %d"), err); + SetTestStepResult(EFail); + } + + TPositionUpdateOptions posOpts; + posOpts.SetMaxUpdateAge(1*1000000); + posOpts.SetUpdateInterval(5*1000000); + + if((posOpts.MaxUpdateAge() != 1000000) || (posOpts.UpdateInterval() != 5000000)) + { + INFO_PRINTF1(_L("Failed: During check of options values")); + SetTestStepResult(EFail); + } + + iPositioner.SetUpdateOptions(posOpts); + + //Retrieve cached location with second call to NPU + err = DoNotifyUpdateL(posInfob); + if (KErrNone != err) + { + INFO_PRINTF2(_L("Failed: During NPU 2 value is %d"), err); + SetTestStepResult(EFail); + } + + //INTERNAL COMPARISON + //Make sure we've retrieved the cached location + T_LbsUtils utils; + if(!utils.Compare_PosInfo(posInfoa, posInfob)) + { + INFO_PRINTF1(_L("Failed: During comparison of pos info values")); + SetTestStepResult(EFail); + } + + // Make 3rd call to NPU - this one to be cancelled + TRequestStatus status; + iPositioner.NotifyPositionUpdate(posInfoc, status); + + // Wait 2 seconds and then cancel + User::After(2000000); + err = iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); + if (KErrNone != err) + { + // Pre-DefectFix code would return -1 at this point since there would have been no request to cancel + INFO_PRINTF2(_L("Failed: Cancel request was rejected with error %d"), err); + SetTestStepResult(EFail); + } + + User::WaitForRequest(status); + if (KErrCancel != status.Int()) + { + // Pre-DefectFix code would return 0 at this point to indicate a successfully returned position + INFO_PRINTF2(_L("Failed: Expected NPU to complete with KErrCancel but actual value is %d"), status.Int()); + SetTestStepResult(EFail); + } + + CleanupStack::PopAndDestroy(&iPositioner); + + break; + } + + + + default: + User::Panic(KLbsClientStepUpdateOptions, KErrUnknown); + + } + + } + + + // All done, clean up. + CleanupStack::PopAndDestroy(&iServer); + } + + INFO_PRINTF1(_L("<<CT_LbsClientStep_UpdateOptions::doTestStepL()")); + + return TestStepResult(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbsclient/testdata/smoketest_lbs.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbsclient/testdata/smoketest_lbs.ini Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,45 @@ +[LBS-Mod-Cnt-0001] +tc_id=1 +num_of_mods=2 + +[LBS-Mod-Cnt-0002] +tc_id=2 + +[LBS-Mod-Cnt-0003] +tc_id=3 +num_of_mods=3 + +[LBS-Mod-Cnt-0004] +tc_id=4 +num_of_mods=3 + +[LBS-Mod-Info-0001] +tc_id=11 +module_id=271064388 + + +[LBS-Mod-Info-0002] +tc_id=12 + +[LBS-Mod-Info-0003] +tc_id=13 + +[LBS-Mod-Info-0004] +tc_id=14 + +[LBS-Mod-Info-0005] +tc_id=15 +module_id=271064388 + +[LBS-Mod-Info-0006] +tc_id=16 + +[LBS-Mod-Info-0007] +tc_id=17 + +[LBS-Mod-Info-0008] +tc_id=18 +default_mod_id=271064388 + +[LBS-Mod-Info-0009] +tc_id=19 diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestchannel/BWINS/LbsTestChannelU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestchannel/BWINS/LbsTestChannelU.DEF Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,26 @@ +EXPORTS + ??0RT_LbsChannel@@QAE@XZ @ 1 NONAME ; RT_LbsChannel::RT_LbsChannel(void) + ??0TT_LbsAGpsRequestError@@QAE@H@Z @ 2 NONAME ; TT_LbsAGpsRequestError::TT_LbsAGpsRequestError(int) + ??0TT_LbsAGpsRequestOptions@@QAE@W4TLbsHybridModuleOptions@@@Z @ 3 NONAME ; TT_LbsAGpsRequestOptions::TT_LbsAGpsRequestOptions(enum TLbsHybridModuleOptions) + ??0TT_LbsAGpsRequestOptions@@QAE@W4TLbsHybridModuleOptions@@H@Z @ 4 NONAME ; TT_LbsAGpsRequestOptions::TT_LbsAGpsRequestOptions(enum TLbsHybridModuleOptions, int) + ??0TT_LbsAGpsRequestTimeOut@@QAE@ABVTTimeIntervalMicroSeconds@@@Z @ 5 NONAME ; TT_LbsAGpsRequestTimeOut::TT_LbsAGpsRequestTimeOut(class TTimeIntervalMicroSeconds const &) + ??0TT_LbsAGpsRequestUpdateInitMsg@@QAE@ABVTDesC16@@0@Z @ 6 NONAME ; TT_LbsAGpsRequestUpdateInitMsg::TT_LbsAGpsRequestUpdateInitMsg(class TDesC16 const &, class TDesC16 const &) + ??0TT_LbsAGpsResponseMsg@@QAE@ABW4TModuleResponseType@0@@Z @ 7 NONAME ; TT_LbsAGpsResponseMsg::TT_LbsAGpsResponseMsg(enum TT_LbsAGpsResponseMsg::TModuleResponseType const &) + ??0TT_LbsMsgBase@@IAE@W4TLbsMsgType@0@@Z @ 8 NONAME ; TT_LbsMsgBase::TT_LbsMsgBase(enum TT_LbsMsgBase::TLbsMsgType) + ??0TT_LbsMsgBase@@QAE@XZ @ 9 NONAME ; TT_LbsMsgBase::TT_LbsMsgBase(void) + ?CancelSendMessageNotification@RT_LbsChannel@@QAEXXZ @ 10 NONAME ; void RT_LbsChannel::CancelSendMessageNotification(void) + ?Close@RT_LbsChannel@@QAEXXZ @ 11 NONAME ; void RT_LbsChannel::Close(void) + ?ConfigFileName@TT_LbsAGpsRequestUpdateInitMsg@@QBEABVTDesC16@@XZ @ 12 NONAME ; class TDesC16 const & TT_LbsAGpsRequestUpdateInitMsg::ConfigFileName(void) const + ?ConfigSection@TT_LbsAGpsRequestUpdateInitMsg@@QBEABVTDesC16@@XZ @ 13 NONAME ; class TDesC16 const & TT_LbsAGpsRequestUpdateInitMsg::ConfigSection(void) const + ?Error@TT_LbsAGpsRequestError@@QBEHXZ @ 14 NONAME ; int TT_LbsAGpsRequestError::Error(void) const + ?InitializeL@RT_LbsChannel@@SAXW4TT_LbsChannelId@1@@Z @ 15 NONAME ; void RT_LbsChannel::InitializeL(enum RT_LbsChannel::TT_LbsChannelId) + ?ModuleOption@TT_LbsAGpsRequestOptions@@QBE?AW4TLbsHybridModuleOptions@@XZ @ 16 NONAME ; enum TLbsHybridModuleOptions TT_LbsAGpsRequestOptions::ModuleOption(void) const + ?ModuleValue@TT_LbsAGpsRequestOptions@@QBEHXZ @ 17 NONAME ; int TT_LbsAGpsRequestOptions::ModuleValue(void) const + ?OpenL@RT_LbsChannel@@QAEXW4TT_LbsChannelId@1@AAVMT_LbsChannelObserver@@@Z @ 18 NONAME ; void RT_LbsChannel::OpenL(enum RT_LbsChannel::TT_LbsChannelId, class MT_LbsChannelObserver &) + ?ResponseType@TT_LbsAGpsResponseMsg@@QBE?AW4TModuleResponseType@1@XZ @ 19 NONAME ; enum TT_LbsAGpsResponseMsg::TModuleResponseType TT_LbsAGpsResponseMsg::ResponseType(void) const + ?SendMessage@RT_LbsChannel@@QAEXABVTT_LbsMsgBase@@AAVTRequestStatus@@@Z @ 20 NONAME ; void RT_LbsChannel::SendMessage(class TT_LbsMsgBase const &, class TRequestStatus &) + ?ShutDownL@RT_LbsChannel@@SAXW4TT_LbsChannelId@1@@Z @ 21 NONAME ; void RT_LbsChannel::ShutDownL(enum RT_LbsChannel::TT_LbsChannelId) + ?TimeOut@TT_LbsAGpsRequestTimeOut@@QBEABVTTimeIntervalMicroSeconds@@XZ @ 22 NONAME ; class TTimeIntervalMicroSeconds const & TT_LbsAGpsRequestTimeOut::TimeOut(void) const + ?Type@TT_LbsMsgBase@@QBE?AW4TLbsMsgType@1@XZ @ 23 NONAME ; enum TT_LbsMsgBase::TLbsMsgType TT_LbsMsgBase::Type(void) const + ??0TT_LbsAGpsRequestForcedUpdate@@QAE@XZ @ 24 NONAME ; TT_LbsAGpsRequestForcedUpdate::TT_LbsAGpsRequestForcedUpdate(void) + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestchannel/EABI/LbsTestChannelu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestchannel/EABI/LbsTestChannelu.def Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,36 @@ +EXPORTS + _ZN13RT_LbsChannel11InitializeLENS_15TT_LbsChannelIdE @ 1 NONAME + _ZN13RT_LbsChannel11SendMessageERK13TT_LbsMsgBaseR14TRequestStatus @ 2 NONAME + _ZN13RT_LbsChannel29CancelSendMessageNotificationEv @ 3 NONAME + _ZN13RT_LbsChannel5CloseEv @ 4 NONAME + _ZN13RT_LbsChannel5OpenLENS_15TT_LbsChannelIdER21MT_LbsChannelObserver @ 5 NONAME + _ZN13RT_LbsChannel9ShutDownLENS_15TT_LbsChannelIdE @ 6 NONAME + _ZN13RT_LbsChannelC1Ev @ 7 NONAME + _ZN13RT_LbsChannelC2Ev @ 8 NONAME + _ZN13TT_LbsMsgBaseC1ENS_11TLbsMsgTypeE @ 9 NONAME + _ZN13TT_LbsMsgBaseC1Ev @ 10 NONAME + _ZN13TT_LbsMsgBaseC2ENS_11TLbsMsgTypeE @ 11 NONAME + _ZN13TT_LbsMsgBaseC2Ev @ 12 NONAME + _ZN21TT_LbsAGpsResponseMsgC1ERKNS_19TModuleResponseTypeE @ 13 NONAME + _ZN21TT_LbsAGpsResponseMsgC2ERKNS_19TModuleResponseTypeE @ 14 NONAME + _ZN22TT_LbsAGpsRequestErrorC1Ei @ 15 NONAME + _ZN22TT_LbsAGpsRequestErrorC2Ei @ 16 NONAME + _ZN24TT_LbsAGpsRequestOptionsC1E23TLbsHybridModuleOptions @ 17 NONAME + _ZN24TT_LbsAGpsRequestOptionsC1E23TLbsHybridModuleOptionsi @ 18 NONAME + _ZN24TT_LbsAGpsRequestOptionsC2E23TLbsHybridModuleOptions @ 19 NONAME + _ZN24TT_LbsAGpsRequestOptionsC2E23TLbsHybridModuleOptionsi @ 20 NONAME + _ZN24TT_LbsAGpsRequestTimeOutC1ERK25TTimeIntervalMicroSeconds @ 21 NONAME + _ZN24TT_LbsAGpsRequestTimeOutC2ERK25TTimeIntervalMicroSeconds @ 22 NONAME + _ZN30TT_LbsAGpsRequestUpdateInitMsgC1ERK7TDesC16S2_ @ 23 NONAME + _ZN30TT_LbsAGpsRequestUpdateInitMsgC2ERK7TDesC16S2_ @ 24 NONAME + _ZNK13TT_LbsMsgBase4TypeEv @ 25 NONAME + _ZNK21TT_LbsAGpsResponseMsg12ResponseTypeEv @ 26 NONAME + _ZNK22TT_LbsAGpsRequestError5ErrorEv @ 27 NONAME + _ZNK24TT_LbsAGpsRequestOptions11ModuleValueEv @ 28 NONAME + _ZNK24TT_LbsAGpsRequestOptions12ModuleOptionEv @ 29 NONAME + _ZNK24TT_LbsAGpsRequestTimeOut7TimeOutEv @ 30 NONAME + _ZNK30TT_LbsAGpsRequestUpdateInitMsg13ConfigSectionEv @ 31 NONAME + _ZNK30TT_LbsAGpsRequestUpdateInitMsg14ConfigFileNameEv @ 32 NONAME + _ZN29TT_LbsAGpsRequestForcedUpdateC1Ev @ 33 NONAME + _ZN29TT_LbsAGpsRequestForcedUpdateC2Ev @ 34 NONAME + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestchannel/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestchannel/group/bld.inf Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,21 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRJ_TESTMMPFILES +lbstestchannel.mmp + +PRJ_TESTEXPORTS +../inc/tlbschannel.h /epoc32/include/lbs/test/tlbschannel.h +../inc/tlbschannelutils.h /epoc32/include/lbs/test/tlbschannelutils.h diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestchannel/group/lbstestchannel.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestchannel/group/lbstestchannel.mmp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,39 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file lbstestchannel.mmp +// +// + +TARGET lbstestchannel.dll +TARGETTYPE DLL + +//CAPABILITY ProtServ LocalServices WriteDeviceData ReadDeviceData Location +CAPABILITY ALL -TCB + +UID 0x1000007A 0x10282291 + + +SYSTEMINCLUDE /epoc32/include +SYSTEMINCLUDE /epoc32/include/lbs +SYSTEMINCLUDE /epoc32/include/lbs/test + +USERINCLUDE ../inc + +SOURCEPATH ../src + +SOURCE tlbschannel.cpp +SOURCE tlbschannelutils.cpp + +// EPOC libraries. +LIBRARY euser.lib diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestchannel/inc/tlbschannel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestchannel/inc/tlbschannel.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,112 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file TLbschannel.h +// This is the header file which contains the channel utilities for communication between +// the test harness and the test AGps module. +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef TLbsCHANNEL_H +#define TLbsCHANNEL_H + +// User includes +#include "tlbschannelutils.h" + +// Epoc includes +#include + + +class MT_LbsChannelObserver; +class CT_ChannelMonitor; + + +/** Logical channel used for communication between Test Harness and +the test A-GPS module. + +Messages are: +- sent by calling SendMessage. +- received via the Mixin callback MT_LbsChannelObserver::ProcessChannelMessage. +*/ +NONSHARABLE_CLASS(RT_LbsChannel) + { +public: + enum TT_LbsChannelId + { + EChannelUnknown = -1, + EChannelTH2TAGPS = 0, + EChannelTAGPS2TH = 1 + }; + + IMPORT_C static void InitializeL(TT_LbsChannelId aChannelId); + IMPORT_C static void ShutDownL(TT_LbsChannelId aChannelId); + + IMPORT_C RT_LbsChannel(); + IMPORT_C void OpenL(TT_LbsChannelId aChannelId, MT_LbsChannelObserver& aObserver); + IMPORT_C void Close(); + + IMPORT_C void SendMessage(const TT_LbsMsgBase& aMessage, TRequestStatus& aStatus); + IMPORT_C void CancelSendMessageNotification(); + +private: + RProperty iSendProperty; + RProperty iSendMsgReadProperty; + CT_ChannelMonitor* iMonitor; + }; + +/** Observer for incoming messages from a channel +*/ +class MT_LbsChannelObserver + { +public: + /** Called when a message arrives from a channel. + @param aChannelId The channel being monitored. + @param aMessage The message received. */ + virtual void ProcessChannelMessage(RT_LbsChannel::TT_LbsChannelId aChannelId, const TT_LbsMsgBase& aMessage) = 0; + }; + +/** +Monitors for incoming messages from a channel. +*/ +NONSHARABLE_CLASS(CT_ChannelMonitor) : public CActive + { +public: + static CT_ChannelMonitor* NewL(MT_LbsChannelObserver& aObserver, RT_LbsChannel::TT_LbsChannelId aChannelId, TUid aPropId, TUint aPropKey, TUint aAckPropKey); + ~CT_ChannelMonitor(); + + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + +private: + void NotifyChannelMessage(); + CT_ChannelMonitor(MT_LbsChannelObserver& aObserver, RT_LbsChannel::TT_LbsChannelId aChannelId); + void ConstructL(TUid aPropId, TUint aPropKey, TUint aAckPropKey); + +private: + MT_LbsChannelObserver& iObserver; + RT_LbsChannel::TT_LbsChannelId iChannelId; + + RProperty iReceiveProperty; + RProperty iReceiveMsgReadProperty; + }; + +#endif // TLbsCHANNEL_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestchannel/inc/tlbschannelutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestchannel/inc/tlbschannelutils.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,237 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file tlbschannelutils.h +// This is the header file which contains the msg data types and other utilities +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef TLBSCHANNELUTILS_H +#define TLBSCHANNELUTILS_H + +#include + + +/* Key value used to publish messages from Test Harness to Test AGPS Module + and the corresponding acknowledgement */ +const TUint KTH2TAGPSMessageKey = 0x0F001010; +const TUint KTH2TAGPSMessageReadAckKey = 0x0F001020; +/* Key value used to publish messages from Test AGPS Module to Test Harness + and the corresponding acknowledgement */ +const TUint KTAGPS2THMessageKey = 0x0F001030; +const TUint KTAGPS2THMessageReadAckKey = 0x0F001040; + + + +/** Base class for messages sent between the Test Harness and Test A-Gps Module. + +This class defines the types of messages and reserves a buffer to store +information, but it can't be used itself. Instead derived classes will +implement each of the types of messages and supply accessor functions. + +*/ +class TT_LbsMsgBase + { +public: + /** List of all possible message types. + + Each type of message listed here must be implemented as a + separate class that inherits from TLbsNetInternalMsgBase. + */ + enum TLbsMsgType + { + EUnknown = 0, + EModuleRequestUpdateInit, // TH --> AGPS-Module + EModuleRequestTimeOut, // TH --> AGPS-Module + EModuleRequestOptions, // TH --> AGPS-Module + EModuleRequestError, // TH --> AGPS-Module + EModuleRequestForcedUpdate, // TH --> AGPS-Module + EModuleResponse // AGPS-Module --> TH + }; + +public: + IMPORT_C TT_LbsMsgBase(); + + IMPORT_C TLbsMsgType Type() const; + +protected: + // Derived classes set their type by using these constructors. + IMPORT_C TT_LbsMsgBase(TLbsMsgType aType); + +private: + TLbsMsgType iType; + +protected: + // A TUint64 is used to ensure that any objects that use the buffer + // are at least 8byte aligned. (The compiler will organise the arrangement + // of iBuffer within TLbsNetInternalMsgBase to be aligned to the minimum + // for a TUint64, which is 8bytes.) + TUint64 iBuffer[((1576 - (sizeof(TLbsMsgType))) >> 3)]; + }; + +/** +Test A-Gps Module Request UpdateInit Message +*/ +NONSHARABLE_CLASS(TT_LbsAGpsRequestUpdateInitMsg) : public TT_LbsMsgBase + { +public: + IMPORT_C TT_LbsAGpsRequestUpdateInitMsg(const TDesC& aConfigFileName, const TDesC& aConfigSection); + + IMPORT_C const TDesC& ConfigFileName() const; + IMPORT_C const TDesC& ConfigSection() const; + +private: + TT_LbsAGpsRequestUpdateInitMsg(); + +private: + struct ST_LbsAGpsRequestUpdateInit + { + TBuf iConfigFileName; /** Config request data. */ + TBuf<40> iConfigSection; /** Config request data. */ + }; + + inline ST_LbsAGpsRequestUpdateInit& Data(); + inline const ST_LbsAGpsRequestUpdateInit& Data() const; + }; + +/** +Test A-Gps Module Request TimeOut Message +*/ +NONSHARABLE_CLASS(TT_LbsAGpsRequestTimeOut) : public TT_LbsMsgBase + { +public: + IMPORT_C TT_LbsAGpsRequestTimeOut(const TTimeIntervalMicroSeconds& aTimeOut); + IMPORT_C const TTimeIntervalMicroSeconds& TimeOut() const; + +private: + TT_LbsAGpsRequestTimeOut(); + +private: + struct ST_LbsAGpsRequestTimeOut + { + TTimeIntervalMicroSeconds iTimeOut; /** Module time out. */ + }; + inline ST_LbsAGpsRequestTimeOut& Data(); + inline const ST_LbsAGpsRequestTimeOut& Data() const; + }; + +/** +Test A-Gps Module Request Options Message +*/ +NONSHARABLE_CLASS(TT_LbsAGpsRequestOptions) : public TT_LbsMsgBase + { +public: + IMPORT_C TT_LbsAGpsRequestOptions(TLbsHybridModuleOptions aModuleOption); + IMPORT_C TT_LbsAGpsRequestOptions(TLbsHybridModuleOptions aModuleOption, TBool aOptionValue); + + IMPORT_C TLbsHybridModuleOptions ModuleOption() const; + IMPORT_C TBool ModuleValue() const; + +private: + TT_LbsAGpsRequestOptions(); + +private: + struct ST_LbsAGpsRequestOptions + { + TLbsHybridModuleOptions iModuleOption; // Module option + TBool iModuleValue; // Value for the module option + }; + + inline ST_LbsAGpsRequestOptions& Data(); + inline const ST_LbsAGpsRequestOptions& Data() const; + }; + +/** +Test A-Gps Module Request Error Message +*/ +NONSHARABLE_CLASS(TT_LbsAGpsRequestError) : public TT_LbsMsgBase + { +public: + IMPORT_C TT_LbsAGpsRequestError(TInt aOptions); + IMPORT_C TInt Error() const; + +private: + TT_LbsAGpsRequestError(); + +private: + struct ST_LbsAGpsRequestError + { + TInt iError; /** Module Error Code */ + }; + + inline ST_LbsAGpsRequestError& Data(); + inline const ST_LbsAGpsRequestError& Data() const; + }; + +/** +Test A-Gps Module Request Forced Update Message + +This message forces the test A-Gps module to send +the next position update from the update array +now, even if there is no outstanding request from LBS. +*/ +NONSHARABLE_CLASS(TT_LbsAGpsRequestForcedUpdate) : public TT_LbsMsgBase + { +public: + IMPORT_C TT_LbsAGpsRequestForcedUpdate(); + +private: + struct ST_LbsAGpsRequestForcedUpdate + { + TInt iDummy; /** Dummy value; unused */ + }; + + inline ST_LbsAGpsRequestForcedUpdate& Data(); + inline const ST_LbsAGpsRequestForcedUpdate& Data() const; + }; + +/** +Test A-Gps Module Response Message +*/ +NONSHARABLE_CLASS(TT_LbsAGpsResponseMsg) : public TT_LbsMsgBase + { +public: + + enum TModuleResponseType + { + EModuleResponseOk, + EModuleErr + }; + + IMPORT_C TT_LbsAGpsResponseMsg(const TModuleResponseType& aResponse); + + IMPORT_C TModuleResponseType ResponseType() const; + +private: + TT_LbsAGpsResponseMsg(); + +private: + + struct ST_LbsAGpsResponse + { + TModuleResponseType iResponseType; + }; + + inline ST_LbsAGpsResponse& Data(); + inline const ST_LbsAGpsResponse& Data() const; + }; + +#endif // TLBSCHANNELUTILS_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestchannel/src/tlbschannel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestchannel/src/tlbschannel.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,247 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file T_Lbschannel.cpp +// This is the Cpp file which contains the channel for communication between +// the test harness and the test AGps module. +// +// + +// User includes +#include "tlbschannel.h" + +const TInt KLbsChannelIdMax = RT_LbsChannel::EChannelTAGPS2TH; +//const TInt KCategoryKeyIndex = 0; +const TInt KReadPropKeyIndex = 1; +const TInt KReadPropAckKeyIndex = 2; +const TInt KWritePropKeyIndex = 3; +const TInt KWritePropAckKeyIndex = 4; + +/** The array contains description (property size, keys and Ids) of all the channels supported by + the RT_LbsChannel interface */ +const TUint KPropTable[KLbsChannelIdMax+1][5]= + { + {0, KTH2TAGPSMessageKey, KTH2TAGPSMessageReadAckKey, KTAGPS2THMessageKey, KTAGPS2THMessageReadAckKey}, + {0, KTAGPS2THMessageKey, KTAGPS2THMessageReadAckKey, KTH2TAGPSMessageKey, KTH2TAGPSMessageReadAckKey}, + }; + +/////////////////////////////////////////////////////////////////////////////// +// RT_LbsChannel +/////////////////////////////////////////////////////////////////////////////// + +EXPORT_C void RT_LbsChannel::InitializeL(TT_LbsChannelId aChannelId) + { + const TSecurityPolicy KReadPolicy(ECapability_None); + const TSecurityPolicy KWritePolicy(ECapabilityWriteDeviceData); + + TInt err = RProperty::Define(KUidSystemCategory, + KPropTable[aChannelId][KWritePropKeyIndex], + RProperty::ELargeByteArray, + KReadPolicy, KWritePolicy, + sizeof(TT_LbsMsgBase)); + if (err != KErrNone && err != KErrAlreadyExists) + { + User::Leave(err); + } + + err = RProperty::Define(KUidSystemCategory, + KPropTable[aChannelId][KWritePropAckKeyIndex], + RProperty::EInt, + KReadPolicy, KWritePolicy); + if (err != KErrNone && err != KErrAlreadyExists) + { + User::Leave(err); + } + + User::LeaveIfError(RProperty::Set(KUidSystemCategory, KPropTable[aChannelId][KWritePropAckKeyIndex], 0)); + } + + +EXPORT_C void RT_LbsChannel::ShutDownL(TT_LbsChannelId aChannelId) + { + User::LeaveIfError(RProperty::Delete(KPropTable[aChannelId][KWritePropKeyIndex])); + User::LeaveIfError(RProperty::Delete(KPropTable[aChannelId][KWritePropAckKeyIndex])); + } + + +EXPORT_C RT_LbsChannel::RT_LbsChannel() + { + } + + +/** + +The channel must first be initialised before this is called, otherwise the +resources needed by the channel will not have been allocated. + +@param aObserver Reference to the observer class used to notify of new messages. +@param aChannelId Uid of the RProperty category used for this channel. + +@leave +*/ +EXPORT_C void RT_LbsChannel::OpenL(TT_LbsChannelId aChannelId, MT_LbsChannelObserver& aObserver) + { + __ASSERT_DEBUG(iSendProperty.Handle()==NULL, User::Invariant()); + __ASSERT_DEBUG(iSendMsgReadProperty.Handle()==NULL, User::Invariant()); + + User::LeaveIfError(iSendProperty.Attach(KUidSystemCategory, KPropTable[aChannelId][KWritePropKeyIndex])); + User::LeaveIfError(iSendMsgReadProperty.Attach(KUidSystemCategory, KPropTable[aChannelId][KWritePropAckKeyIndex])); + + iMonitor = CT_ChannelMonitor::NewL(aObserver, aChannelId, KUidSystemCategory, + KPropTable[aChannelId][KReadPropKeyIndex], + KPropTable[aChannelId][KReadPropAckKeyIndex]); + } + +/** Close the connection. + +This function closes the connection and frees any resources +created in RTbsChannel::OpenL(). +*/ +EXPORT_C void RT_LbsChannel::Close() + { + CancelSendMessageNotification(); + + delete iMonitor; + iSendProperty.Close(); + iSendMsgReadProperty.Close(); + } + +/** Send a message through the channel. + +This is an asynchronous function that only completes when the message +has been read. + +If another call is made to this function before a previous one has +completed then aStatus will be completed straight away, with the +completion code KErrInUse. + +@param aMessage The message to be sent. +@param aStatus Request status that is completed when the message has + been read. If there is an error sending the message + it will be stored in aStatus.Int(). +*/ +EXPORT_C void RT_LbsChannel::SendMessage(const TT_LbsMsgBase& aMessage, + TRequestStatus& aStatus) + { + // Must check that the previous message was read + TInt sendAck; + iSendMsgReadProperty.Get(sendAck); + if (sendAck == 1) + { + // Pending message has not been read yet; flag an error + TRequestStatus* statPtr = &aStatus; + User::RequestComplete(statPtr, KErrInUse); + } + else + { + // Publish the new message + iSendMsgReadProperty.Set(1); + iSendMsgReadProperty.Subscribe(aStatus); + TPckgC pckg(aMessage); + iSendProperty.Set(pckg); + } + } + +/** Cancel the current request status for SendMessage(). +*/ +EXPORT_C void RT_LbsChannel::CancelSendMessageNotification() + { + iSendMsgReadProperty.Cancel(); + } + + +/////////////////////////////////////////////////////////////////////////////// +// CT_ChannelMonitor - used to listen for incoming messages +/////////////////////////////////////////////////////////////////////////////// +CT_ChannelMonitor* CT_ChannelMonitor::NewL(MT_LbsChannelObserver& aObserver, RT_LbsChannel::TT_LbsChannelId aChannelId, TUid aPropId, TUint aPropKey, TUint aAckPropKey) + { + CT_ChannelMonitor* self = new (ELeave) CT_ChannelMonitor(aObserver, aChannelId); + CleanupStack::PushL(self); + self->ConstructL(aPropId, aPropKey, aAckPropKey); + CleanupStack::Pop(); + return self; + } + +CT_ChannelMonitor::CT_ChannelMonitor(MT_LbsChannelObserver& aObserver, RT_LbsChannel::TT_LbsChannelId aChannelId) : + CActive(EPriorityStandard), + iObserver(aObserver), + iChannelId(aChannelId) + { + CActiveScheduler::Add(this); + } + +CT_ChannelMonitor::~CT_ChannelMonitor() + { + Cancel(); + iReceiveProperty.Close(); + iReceiveMsgReadProperty.Close(); + } + +void CT_ChannelMonitor::ConstructL(TUid aPropId, TUint aPropKey, TUint aAckPropKey) + { + __ASSERT_DEBUG(iReceiveProperty.Handle()==NULL, User::Invariant()); //Handle open. + __ASSERT_DEBUG(iReceiveMsgReadProperty.Handle()==NULL, User::Invariant()); //Handle open. + + User::LeaveIfError(iReceiveProperty.Attach(aPropId, aPropKey)); + User::LeaveIfError(iReceiveMsgReadProperty.Attach(aPropId, aAckPropKey)); + + NotifyChannelMessage(); + // flag we are ready for receiving messages + iReceiveMsgReadProperty.Set(0); + } + +void CT_ChannelMonitor::NotifyChannelMessage() + { + iReceiveProperty.Subscribe(iStatus); + SetActive(); + } + +void CT_ChannelMonitor::RunL() + { + TInt result = iStatus.Int(); + switch (result) + { + case KErrNone: + { + // Read property + TT_LbsMsgBase msg; + TPckg pckg(msg); + iReceiveProperty.Get(pckg); + + // resubscribe for further messages + NotifyChannelMessage(); + + // Notify observer + iObserver.ProcessChannelMessage(iChannelId, msg); + + // flag message as read + iReceiveMsgReadProperty.Set(0); + break; + } + default: + { + User::Leave(result); + break; + } + } + } + +void CT_ChannelMonitor::DoCancel() + { + iReceiveProperty.Cancel(); + } + +TInt CT_ChannelMonitor::RunError(TInt /*aError*/) + { + return KErrNone; + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestchannel/src/tlbschannelutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestchannel/src/tlbschannelutils.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,257 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// This is the source file which contains the msg data types and other utilities +// +// + +#include "tlbschannelutils.h" + + +/////////////////////////////////////////////////////////////////////////////// +// Base Test Message Class +/////////////////////////////////////////////////////////////////////////////// + + +EXPORT_C TT_LbsMsgBase::TLbsMsgType TT_LbsMsgBase::Type() const + { + return iType; + } + +EXPORT_C TT_LbsMsgBase::TT_LbsMsgBase() : + iType(EUnknown) + { + // Check that the internal buffer is 8-byte aligned. + __ASSERT_COMPILE((_FOFF(TT_LbsMsgBase, iBuffer) & 0x40) == 0x0); + } + +EXPORT_C TT_LbsMsgBase::TT_LbsMsgBase(TLbsMsgType aType): + iType(aType) + { + } + +/////////////////////////////////////////////////////////////////////////////// +// Test A-Gps Module Request Update Initialization Message +/////////////////////////////////////////////////////////////////////////////// +EXPORT_C TT_LbsAGpsRequestUpdateInitMsg::TT_LbsAGpsRequestUpdateInitMsg(const TDesC& aConfigFileName, const TDesC& aConfigSection) + : TT_LbsMsgBase(EModuleRequestUpdateInit) + { + // Must make sure that the data to be stored is not bigger than the buffer. + __ASSERT_COMPILE(sizeof(ST_LbsAGpsRequestUpdateInit) <= sizeof(iBuffer)); + + // In-place construction of the data member + new(&Data()) ST_LbsAGpsRequestUpdateInit; + + ST_LbsAGpsRequestUpdateInit& data = Data(); + + data.iConfigFileName = aConfigFileName; + data.iConfigSection = aConfigSection; + } + +EXPORT_C const TDesC& TT_LbsAGpsRequestUpdateInitMsg::ConfigFileName() const + { + return Data().iConfigFileName; + } + +EXPORT_C const TDesC& TT_LbsAGpsRequestUpdateInitMsg::ConfigSection() const + { + return Data().iConfigSection; + } + +inline TT_LbsAGpsRequestUpdateInitMsg::ST_LbsAGpsRequestUpdateInit& TT_LbsAGpsRequestUpdateInitMsg::Data() + { + return reinterpret_cast(iBuffer); + } + +inline const TT_LbsAGpsRequestUpdateInitMsg::ST_LbsAGpsRequestUpdateInit& TT_LbsAGpsRequestUpdateInitMsg::Data() const + { + return reinterpret_cast(iBuffer); + } + + +/////////////////////////////////////////////////////////////////////////////// +// Test A-Gps Module Request TimeOut Message +/////////////////////////////////////////////////////////////////////////////// + +EXPORT_C TT_LbsAGpsRequestTimeOut::TT_LbsAGpsRequestTimeOut(const TTimeIntervalMicroSeconds& aTimeOut) + : TT_LbsMsgBase(EModuleRequestTimeOut) + { + // Must make sure that the data to be stored is not bigger than the buffer. + __ASSERT_COMPILE(sizeof(ST_LbsAGpsRequestTimeOut) <= sizeof(iBuffer)); + + // In-place construction of the data member + new(&Data()) ST_LbsAGpsRequestTimeOut; + + ST_LbsAGpsRequestTimeOut& data = Data(); + + data.iTimeOut = aTimeOut; + } + +EXPORT_C const TTimeIntervalMicroSeconds& TT_LbsAGpsRequestTimeOut::TimeOut() const + { + return Data().iTimeOut; + } + +inline TT_LbsAGpsRequestTimeOut::ST_LbsAGpsRequestTimeOut& TT_LbsAGpsRequestTimeOut::Data() + { + return reinterpret_cast(iBuffer); + } + +inline const TT_LbsAGpsRequestTimeOut::ST_LbsAGpsRequestTimeOut& TT_LbsAGpsRequestTimeOut::Data() const + { + return reinterpret_cast(iBuffer); + } + +/////////////////////////////////////////////////////////////////////////////// +// Test A-Gps Module Request Options +/////////////////////////////////////////////////////////////////////////////// +EXPORT_C TT_LbsAGpsRequestOptions::TT_LbsAGpsRequestOptions(TLbsHybridModuleOptions aModuleOption) + : TT_LbsMsgBase(EModuleRequestOptions) + { + // Must make sure that the data to be stored is not bigger than the buffer. + __ASSERT_COMPILE(sizeof(ST_LbsAGpsRequestOptions) <= sizeof(iBuffer)); + + // In-place construction of the data member + new(&Data()) ST_LbsAGpsRequestOptions; + + ST_LbsAGpsRequestOptions& data = Data(); + + data.iModuleOption = aModuleOption; + } + +EXPORT_C TT_LbsAGpsRequestOptions::TT_LbsAGpsRequestOptions(TLbsHybridModuleOptions aModuleOption, + TBool aModuleValue) + : TT_LbsMsgBase(EModuleRequestOptions) + { + // Must make sure that the data to be stored is not bigger than the buffer. + __ASSERT_COMPILE(sizeof(ST_LbsAGpsRequestOptions) <= sizeof(iBuffer)); + + // In-place construction of the data member + new(&Data()) ST_LbsAGpsRequestOptions; + + ST_LbsAGpsRequestOptions& data = Data(); + + data.iModuleOption = aModuleOption; + data.iModuleValue = aModuleValue; + } + +EXPORT_C TLbsHybridModuleOptions TT_LbsAGpsRequestOptions::ModuleOption() const + { + return Data().iModuleOption; + } + +EXPORT_C TBool TT_LbsAGpsRequestOptions::ModuleValue() const + { + return Data().iModuleValue; + } + +inline TT_LbsAGpsRequestOptions::ST_LbsAGpsRequestOptions& TT_LbsAGpsRequestOptions::Data() + { + return reinterpret_cast(iBuffer); + } + +inline const TT_LbsAGpsRequestOptions::ST_LbsAGpsRequestOptions& TT_LbsAGpsRequestOptions::Data() const + { + return reinterpret_cast(iBuffer); + } + +/////////////////////////////////////////////////////////////////////////////// +// Test A-Gps Module Request Error +/////////////////////////////////////////////////////////////////////////////// +EXPORT_C TT_LbsAGpsRequestError::TT_LbsAGpsRequestError(TInt aError) + : TT_LbsMsgBase(EModuleRequestError) + { + // Must make sure that the data to be stored is not bigger than the buffer. + __ASSERT_COMPILE(sizeof(ST_LbsAGpsRequestError) <= sizeof(iBuffer)); + + // In-place construction of the data member + new(&Data()) ST_LbsAGpsRequestError; + + ST_LbsAGpsRequestError& data = Data(); + + data.iError = aError; + } + +EXPORT_C TInt TT_LbsAGpsRequestError::Error() const + { + return Data().iError; + } + +inline TT_LbsAGpsRequestError::TT_LbsAGpsRequestError::ST_LbsAGpsRequestError& TT_LbsAGpsRequestError::Data() + { + return reinterpret_cast(iBuffer); + } + +inline const TT_LbsAGpsRequestError::ST_LbsAGpsRequestError& TT_LbsAGpsRequestError::Data() const + { + return reinterpret_cast(iBuffer); + } + +/////////////////////////////////////////////////////////////////////////////// +// Test A-Gps Module Request Forced Update +/////////////////////////////////////////////////////////////////////////////// + +EXPORT_C TT_LbsAGpsRequestForcedUpdate::TT_LbsAGpsRequestForcedUpdate() + : TT_LbsMsgBase(EModuleRequestForcedUpdate) + { + // Must make sure that the data to be stored is not bigger than the buffer. + __ASSERT_COMPILE(sizeof(ST_LbsAGpsRequestForcedUpdate) <= sizeof(iBuffer)); + + // In-place construction of the data member + new(&Data()) ST_LbsAGpsRequestForcedUpdate; + + ST_LbsAGpsRequestForcedUpdate& data = Data(); + } + +inline TT_LbsAGpsRequestForcedUpdate::ST_LbsAGpsRequestForcedUpdate& TT_LbsAGpsRequestForcedUpdate::Data() + { + return reinterpret_cast(iBuffer); + } + +inline const TT_LbsAGpsRequestForcedUpdate::ST_LbsAGpsRequestForcedUpdate& TT_LbsAGpsRequestForcedUpdate::Data() const + { + return reinterpret_cast(iBuffer); + } + +/////////////////////////////////////////////////////////////////////////////// +// Test A-Gps Module Response Message +/////////////////////////////////////////////////////////////////////////////// + +EXPORT_C TT_LbsAGpsResponseMsg::TT_LbsAGpsResponseMsg(const TModuleResponseType& aResponse) + : TT_LbsMsgBase(EModuleResponse) + { + // Must make sure that the data to be stored is not bigger than the buffer. + __ASSERT_COMPILE(sizeof(ST_LbsAGpsResponse) <= sizeof(iBuffer)); + + // In-place construction of the data member + new(&Data()) ST_LbsAGpsResponse; + + ST_LbsAGpsResponse& data = Data(); + + data.iResponseType = aResponse; + } + +EXPORT_C TT_LbsAGpsResponseMsg::TModuleResponseType TT_LbsAGpsResponseMsg::ResponseType() const + { + return Data().iResponseType; + } + +inline TT_LbsAGpsResponseMsg::ST_LbsAGpsResponse& TT_LbsAGpsResponseMsg::Data() + { + return reinterpret_cast(iBuffer); + } + +inline const TT_LbsAGpsResponseMsg::ST_LbsAGpsResponse& TT_LbsAGpsResponseMsg::Data() const + { + return reinterpret_cast(iBuffer); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/BWINS/LbsTestUtilsU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/BWINS/LbsTestUtilsU.DEF Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,63 @@ +EXPORTS + ??0T_LbsUtils@@QAE@XZ @ 1 NONAME ; T_LbsUtils::T_LbsUtils(void) + ??1CT_LbsTimerUtils@@UAE@XZ @ 2 NONAME ; CT_LbsTimerUtils::~CT_LbsTimerUtils(void) + ??1T_LbsUtils@@QAE@XZ @ 3 NONAME ; T_LbsUtils::~T_LbsUtils(void) + ?CancelTimer@CT_LbsTimerUtils@@QAEXXZ @ 4 NONAME ; void CT_LbsTimerUtils::CancelTimer(void) + ?Compare_ModuleInfo@T_LbsUtils@@QAEHAAVTPositionModuleInfo@@0@Z @ 5 NONAME ; int T_LbsUtils::Compare_ModuleInfo(class TPositionModuleInfo &, class TPositionModuleInfo &) + ?Compare_ModuleStatus@T_LbsUtils@@QAEHAAVTPositionModuleStatus@@0@Z @ 6 NONAME ; int T_LbsUtils::Compare_ModuleStatus(class TPositionModuleStatus &, class TPositionModuleStatus &) + ?Compare_ModuleUpdateOptions@@YAHAAVTPositionUpdateOptions@@0@Z @ 7 NONAME ; int Compare_ModuleUpdateOptions(class TPositionUpdateOptions &, class TPositionUpdateOptions &) + ?Compare_PosInfo@T_LbsUtils@@QAEHABVTPositionInfoBase@@0@Z @ 8 NONAME ; int T_LbsUtils::Compare_PosInfo(class TPositionInfoBase const &, class TPositionInfoBase const &) + ?Compare_PosInfo@T_LbsUtils@@QAEHABVTPositionInfoBase@@0W4TComparisonAccuracyType@1@@Z @ 9 NONAME ; int T_LbsUtils::Compare_PosInfo(class TPositionInfoBase const &, class TPositionInfoBase const &, enum T_LbsUtils::TComparisonAccuracyType) + ?Compare_PosInfoArr@T_LbsUtils@@QAEHAAV?$RPointerArray@X@@0@Z @ 10 NONAME ; int T_LbsUtils::Compare_PosInfoArr(class RPointerArray &, class RPointerArray &) + ?Compare_PosInfoArr@T_LbsUtils@@QAEHAAV?$RPointerArray@X@@0W4TComparisonAccuracyType@1@@Z @ 11 NONAME ; int T_LbsUtils::Compare_PosInfoArr(class RPointerArray &, class RPointerArray &, enum T_LbsUtils::TComparisonAccuracyType) + ?Compare_PositionQuality@T_LbsUtils@@QAEHAAVTPositionQuality@@0@Z @ 12 NONAME ; int T_LbsUtils::Compare_PositionQuality(class TPositionQuality &, class TPositionQuality &) + ?CreateTestPropertiesL@T_LbsUtils@@QAEXXZ @ 13 NONAME ; void T_LbsUtils::CreateTestPropertiesL(void) + ?Create_ModuleInfoL@T_LbsUtils@@QAEXVTUid@@AAVTPositionModuleInfo@@@Z @ 14 NONAME ; void T_LbsUtils::Create_ModuleInfoL(class TUid, class TPositionModuleInfo &) + ?GetAGpsModuleIdL@T_LbsUtils@@QAE?AVTUid@@AAVRPositionServer@@@Z @ 15 NONAME ; class TUid T_LbsUtils::GetAGpsModuleIdL(class RPositionServer &) + ?GetBadModuleId@T_LbsUtils@@QAE?AVTUid@@XZ @ 16 NONAME ; class TUid T_LbsUtils::GetBadModuleId(void) + ?GetConfigured_ModuleStatusL@T_LbsUtils@@QAEXABVTDesC16@@0AAVTPositionModuleStatus@@@Z @ 17 NONAME ; void T_LbsUtils::GetConfigured_ModuleStatusL(class TDesC16 const &, class TDesC16 const &, class TPositionModuleStatus &) + ?GetConfigured_ModuleUpdateOptionsL@T_LbsUtils@@QAEXABVTDesC16@@0AAVTPositionUpdateOptions@@@Z @ 18 NONAME ; void T_LbsUtils::GetConfigured_ModuleUpdateOptionsL(class TDesC16 const &, class TDesC16 const &, class TPositionUpdateOptions &) + ?GetConfigured_PosInfosL@T_LbsUtils@@QAEXABVTDesC16@@0AAV?$RPointerArray@X@@@Z @ 19 NONAME ; void T_LbsUtils::GetConfigured_PosInfosL(class TDesC16 const &, class TDesC16 const &, class RPointerArray &) + ?GetNetworkModuleIdL@T_LbsUtils@@QAE?AVTUid@@AAVRPositionServer@@@Z @ 20 NONAME ; class TUid T_LbsUtils::GetNetworkModuleIdL(class RPositionServer &) + ?NewL@CT_LbsAsyncWaiter@@SAPAV1@XZ @ 21 NONAME ; class CT_LbsAsyncWaiter * CT_LbsAsyncWaiter::NewL(void) + ?NewL@CT_LbsTimerUtils@@SAPAV1@PAVMT_LbsTimerUtilsObserver@@H@Z @ 22 NONAME ; class CT_LbsTimerUtils * CT_LbsTimerUtils::NewL(class MT_LbsTimerUtilsObserver *, int) + ?NotifyModuleOfConfigChangeL@T_LbsUtils@@QAEXABVTModuleDataIn@@@Z @ 23 NONAME ; void T_LbsUtils::NotifyModuleOfConfigChangeL(class TModuleDataIn const &) + ?ResetAndDestroy_PosInfoArr@T_LbsUtils@@QAEXAAV?$RPointerArray@X@@@Z @ 24 NONAME ; void T_LbsUtils::ResetAndDestroy_PosInfoArr(class RPointerArray &) + ?Result@CT_LbsAsyncWaiter@@QBEHXZ @ 25 NONAME ; int CT_LbsAsyncWaiter::Result(void) const + ?SetTimer@CT_LbsTimerUtils@@QAEXABVTTime@@@Z @ 26 NONAME ; void CT_LbsTimerUtils::SetTimer(class TTime const &) + ?SetTimer@CT_LbsTimerUtils@@QAEXVTTimeIntervalMicroSeconds32@@@Z @ 27 NONAME ; void CT_LbsTimerUtils::SetTimer(class TTimeIntervalMicroSeconds32) + ?StartAndWait@CT_LbsAsyncWaiter@@QAEXXZ @ 28 NONAME ; void CT_LbsAsyncWaiter::StartAndWait(void) + ?VerifySimpleAssistanceData@T_LbsUtils@@QAEHAAVRUEPositioningGpsReferenceTimeReader@@@Z @ 29 NONAME ; int T_LbsUtils::VerifySimpleAssistanceData(class RUEPositioningGpsReferenceTimeReader &) + ?Verify_PositionIsValid@T_LbsUtils@@QAEHAAVTPositionInfo@@@Z @ 30 NONAME ; int T_LbsUtils::Verify_PositionIsValid(class TPositionInfo &) + ?WaitForModuleToRequestAssistanceDataL@T_LbsUtils@@QAEXXZ @ 31 NONAME ; void T_LbsUtils::WaitForModuleToRequestAssistanceDataL(void) + ?Compare_AssistanceDataLog@T_LbsUtils@@QAEHABVCLbsAssistanceDataLogEvent@@0@Z @ 32 NONAME ; int T_LbsUtils::Compare_AssistanceDataLog(class CLbsAssistanceDataLogEvent const &, class CLbsAssistanceDataLogEvent const &) + ?Compare_ExternalLocateLog@T_LbsUtils@@QAEHABVCLbsExternalLocateLogEvent@@0@Z @ 33 NONAME ; int T_LbsUtils::Compare_ExternalLocateLog(class CLbsExternalLocateLogEvent const &, class CLbsExternalLocateLogEvent const &) + ?Compare_LogBase@T_LbsUtils@@QAEHABVCLbsLogEvent@@0@Z @ 34 NONAME ; int T_LbsUtils::Compare_LogBase(class CLbsLogEvent const &, class CLbsLogEvent const &) + ?Compare_NetworkLocateLog@T_LbsUtils@@QAEHABVCLbsNetworkLocateLogEvent@@0@Z @ 35 NONAME ; int T_LbsUtils::Compare_NetworkLocateLog(class CLbsNetworkLocateLogEvent const &, class CLbsNetworkLocateLogEvent const &) + ?Compare_SelfLocateLog@T_LbsUtils@@QAEHABVCLbsSelfLocateLogEvent@@0@Z @ 36 NONAME ; int T_LbsUtils::Compare_SelfLocateLog(class CLbsSelfLocateLogEvent const &, class CLbsSelfLocateLogEvent const &) + ?Compare_TransmitLocationLog@T_LbsUtils@@QAEHABVCLbsTransmitLocationLogEvent@@0@Z @ 37 NONAME ; int T_LbsUtils::Compare_TransmitLocationLog(class CLbsTransmitLocationLogEvent const &, class CLbsTransmitLocationLogEvent const &) + ??0TLbsModuleUpdateItem@@QAE@XZ @ 38 NONAME ; TLbsModuleUpdateItem::TLbsModuleUpdateItem(void) + ?Error@TLbsModuleUpdateItem@@QBEHXZ @ 39 NONAME ; int TLbsModuleUpdateItem::Error(void) const + ?Measurement@TLbsModuleUpdateItem@@QBEABVTPositionGpsMeasurementInfo@@XZ @ 40 NONAME ; class TPositionGpsMeasurementInfo const & TLbsModuleUpdateItem::Measurement(void) const + ?Position@TLbsModuleUpdateItem@@QBEABVTPositionSatelliteInfo@@XZ @ 41 NONAME ; class TPositionSatelliteInfo const & TLbsModuleUpdateItem::Position(void) const + ?SetError@TLbsModuleUpdateItem@@QAEXH@Z @ 42 NONAME ; void TLbsModuleUpdateItem::SetError(int) + ?SetMeasurement@TLbsModuleUpdateItem@@QAEXABVTPositionGpsMeasurementInfo@@@Z @ 43 NONAME ; void TLbsModuleUpdateItem::SetMeasurement(class TPositionGpsMeasurementInfo const &) + ?SetPosition@TLbsModuleUpdateItem@@QAEXABVTPositionSatelliteInfo@@@Z @ 44 NONAME ; void TLbsModuleUpdateItem::SetPosition(class TPositionSatelliteInfo const &) + ?Write@CT_Dumper@@SAXV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 45 NONAME ; void CT_Dumper::Write(class TRefByValue, ...) + ?OverWrite@CT_Dumper@@SAXXZ @ 46 NONAME ; void CT_Dumper::OverWrite(void) + ?GetConfigured_UpdateArrayL@T_LbsUtils@@QAEXABVTDesC16@@0AAV?$RPointerArray@VTLbsModuleUpdateItem@@@@@Z @ 47 NONAME ; void T_LbsUtils::GetConfigured_UpdateArrayL(class TDesC16 const &, class TDesC16 const &, class RPointerArray &) + ?NewL@CT_LbsAGpsHandler@@SAPAV1@PAVMT_ResponseObserver@@@Z @ 48 NONAME ; class CT_LbsAGpsHandler * CT_LbsAGpsHandler::NewL(class MT_ResponseObserver *) + ?SendRequestClearAllModuleOptions@CT_LbsAGpsHandler@@QAEXXZ @ 49 NONAME ; void CT_LbsAGpsHandler::SendRequestClearAllModuleOptions(void) + ?SendRequestError@CT_LbsAGpsHandler@@QAEXH@Z @ 50 NONAME ; void CT_LbsAGpsHandler::SendRequestError(int) + ?SendRequestModuleOption@CT_LbsAGpsHandler@@QAEXW4TLbsHybridModuleOptions@@H@Z @ 51 NONAME ; void CT_LbsAGpsHandler::SendRequestModuleOption(enum TLbsHybridModuleOptions, int) + ?SendRequestSetAllModuleOptions@CT_LbsAGpsHandler@@QAEXXZ @ 52 NONAME ; void CT_LbsAGpsHandler::SendRequestSetAllModuleOptions(void) + ?SendRequestTimeOutMsg@CT_LbsAGpsHandler@@QAEXABVTTimeIntervalMicroSeconds@@@Z @ 53 NONAME ; void CT_LbsAGpsHandler::SendRequestTimeOutMsg(class TTimeIntervalMicroSeconds const &) + ?SendRequestUpdateInitMsg@CT_LbsAGpsHandler@@QAEXABVTDesC16@@0@Z @ 54 NONAME ; void CT_LbsAGpsHandler::SendRequestUpdateInitMsg(class TDesC16 const &, class TDesC16 const &) + ?Delay@TLbsModuleUpdateItem@@QBEHXZ @ 55 NONAME ; int TLbsModuleUpdateItem::Delay(void) const + ?SetDelay@TLbsModuleUpdateItem@@QAEXH@Z @ 56 NONAME ; void TLbsModuleUpdateItem::SetDelay(int) + ??1CT_AgpsModuleEventListener@@UAE@XZ @ 57 NONAME ; CT_AgpsModuleEventListener::~CT_AgpsModuleEventListener(void) + ?GetExpected_ModuleModes@T_LbsUtils@@QAEXABVTDesC16@@0AAV?$RPointerArray@VTLbsGpsOptions@@@@@Z @ 58 NONAME ; void T_LbsUtils::GetExpected_ModuleModes(class TDesC16 const &, class TDesC16 const &, class RPointerArray &) + ?NewL@CT_AgpsModuleEventListener@@SAPAV1@AAVMT_AgpsModuleEventHandler@@@Z @ 59 NONAME ; class CT_AgpsModuleEventListener * CT_AgpsModuleEventListener::NewL(class MT_AgpsModuleEventHandler &) + ?GetConfigured_ClientDetailsL@T_LbsUtils@@QAEXABVTDesC16@@0AAV?$RArray@VTCTClientDetails@@@@@Z @ 60 NONAME ; void T_LbsUtils::GetConfigured_ClientDetailsL(class TDesC16 const &, class TDesC16 const &, class RArray &) + ?SendRequestForcedUpdate@CT_LbsAGpsHandler@@QAEXXZ @ 61 NONAME ; void CT_LbsAGpsHandler::SendRequestForcedUpdate(void) + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/EABI/LbsTestUtilsU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/EABI/LbsTestUtilsU.DEF Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,91 @@ +EXPORTS + _Z27Compare_ModuleUpdateOptionsR22TPositionUpdateOptionsS0_ @ 1 NONAME + _ZN10T_LbsUtils14GetBadModuleIdEv @ 2 NONAME + _ZN10T_LbsUtils15Compare_PosInfoERK17TPositionInfoBaseS2_ @ 3 NONAME + _ZN10T_LbsUtils15Compare_PosInfoERK17TPositionInfoBaseS2_NS_23TComparisonAccuracyTypeE @ 4 NONAME + _ZN10T_LbsUtils16GetAGpsModuleIdLER15RPositionServer @ 5 NONAME + _ZN10T_LbsUtils18Compare_ModuleInfoER19TPositionModuleInfoS1_ @ 6 NONAME + _ZN10T_LbsUtils18Compare_PosInfoArrER13RPointerArrayIvES2_ @ 7 NONAME + _ZN10T_LbsUtils18Compare_PosInfoArrER13RPointerArrayIvES2_NS_23TComparisonAccuracyTypeE @ 8 NONAME + _ZN10T_LbsUtils18Create_ModuleInfoLE4TUidR19TPositionModuleInfo @ 9 NONAME + _ZN10T_LbsUtils19GetNetworkModuleIdLER15RPositionServer @ 10 NONAME + _ZN10T_LbsUtils20Compare_ModuleStatusER21TPositionModuleStatusS1_ @ 11 NONAME + _ZN10T_LbsUtils21CreateTestPropertiesLEv @ 12 NONAME + _ZN10T_LbsUtils22Verify_PositionIsValidER13TPositionInfo @ 13 NONAME + _ZN10T_LbsUtils23Compare_PositionQualityER16TPositionQualityS1_ @ 14 NONAME + _ZN10T_LbsUtils23GetConfigured_PosInfosLERK7TDesC16S2_R13RPointerArrayIvE @ 15 NONAME + _ZN10T_LbsUtils26ResetAndDestroy_PosInfoArrER13RPointerArrayIvE @ 16 NONAME + _ZN10T_LbsUtils26VerifySimpleAssistanceDataER36RUEPositioningGpsReferenceTimeReader @ 17 NONAME + _ZN10T_LbsUtils27GetConfigured_ModuleStatusLERK7TDesC16S2_R21TPositionModuleStatus @ 18 NONAME + _ZN10T_LbsUtils27NotifyModuleOfConfigChangeLERK13TModuleDataIn @ 19 NONAME + _ZN10T_LbsUtils34GetConfigured_ModuleUpdateOptionsLERK7TDesC16S2_R22TPositionUpdateOptions @ 20 NONAME + _ZN10T_LbsUtilsC1Ev @ 21 NONAME + _ZN10T_LbsUtilsC2Ev @ 22 NONAME + _ZN10T_LbsUtilsD1Ev @ 23 NONAME + _ZN10T_LbsUtilsD2Ev @ 24 NONAME + _ZN16CT_LbsTimerUtils11CancelTimerEv @ 25 NONAME + _ZN16CT_LbsTimerUtils4NewLEP24MT_LbsTimerUtilsObserveri @ 26 NONAME + _ZN16CT_LbsTimerUtils8SetTimerE27TTimeIntervalMicroSeconds32 @ 27 NONAME + _ZN16CT_LbsTimerUtils8SetTimerERK5TTime @ 28 NONAME + _ZN16CT_LbsTimerUtilsD0Ev @ 29 NONAME + _ZN16CT_LbsTimerUtilsD1Ev @ 30 NONAME + _ZN16CT_LbsTimerUtilsD2Ev @ 31 NONAME + _ZN17CT_LbsAsyncWaiter12StartAndWaitEv @ 32 NONAME + _ZN17CT_LbsAsyncWaiter4NewLEv @ 33 NONAME + _ZNK17CT_LbsAsyncWaiter6ResultEv @ 34 NONAME + _ZTI16CT_LbsTimerUtils @ 35 NONAME ; ## + _ZTI17CConfigReaderBase @ 36 NONAME ; ## + _ZTI17CT_LbsAsyncWaiter @ 37 NONAME ; ## + _ZTI20CPosInfoConfigReader @ 38 NONAME ; ## + _ZTI23CUpdateOptsConfigReader @ 39 NONAME ; ## + _ZTI25CModuleStatusConfigReader @ 40 NONAME ; ## + _ZTV16CT_LbsTimerUtils @ 41 NONAME ; ## + _ZTV17CConfigReaderBase @ 42 NONAME ; ## + _ZTV17CT_LbsAsyncWaiter @ 43 NONAME ; ## + _ZTV20CPosInfoConfigReader @ 44 NONAME ; ## + _ZTV23CUpdateOptsConfigReader @ 45 NONAME ; ## + _ZTV25CModuleStatusConfigReader @ 46 NONAME ; ## + _ZN10T_LbsUtils37WaitForModuleToRequestAssistanceDataLEv @ 47 NONAME + _ZN10T_LbsUtils21Compare_SelfLocateLogERK22CLbsSelfLocateLogEventS2_ @ 48 NONAME + _ZN10T_LbsUtils24Compare_NetworkLocateLogERK25CLbsNetworkLocateLogEventS2_ @ 49 NONAME + _ZN10T_LbsUtils25Compare_AssistanceDataLogERK26CLbsAssistanceDataLogEventS2_ @ 50 NONAME + _ZN10T_LbsUtils25Compare_ExternalLocateLogERK26CLbsExternalLocateLogEventS2_ @ 51 NONAME + _ZN10T_LbsUtils27Compare_TransmitLocationLogERK28CLbsTransmitLocationLogEventS2_ @ 52 NONAME + _ZNK20TLbsModuleUpdateItem11MeasurementEv @ 53 NONAME + _ZN20TLbsModuleUpdateItem11SetPositionERK22TPositionSatelliteInfo @ 54 NONAME + _ZN20TLbsModuleUpdateItem14SetMeasurementERK27TPositionGpsMeasurementInfo @ 55 NONAME + _ZNK20TLbsModuleUpdateItem5ErrorEv @ 56 NONAME + _ZNK20TLbsModuleUpdateItem8PositionEv @ 57 NONAME + _ZN20TLbsModuleUpdateItem8SetErrorEi @ 58 NONAME + _ZN20TLbsModuleUpdateItemC1Ev @ 59 NONAME + _ZN20TLbsModuleUpdateItemC2Ev @ 60 NONAME + _ZTI19CUpdateConfigReader @ 61 NONAME + _ZTV19CUpdateConfigReader @ 62 NONAME + _ZN9CT_Dumper5WriteE11TRefByValueIK7TDesC16Ez @ 63 NONAME + _ZN9CT_Dumper9OverWriteEv @ 64 NONAME + _ZN10T_LbsUtils26GetConfigured_UpdateArrayLERK7TDesC16S2_R13RPointerArrayI20TLbsModuleUpdateItemE @ 65 NONAME + _ZN17CT_LbsAGpsHandler16SendRequestErrorEi @ 66 NONAME + _ZN17CT_LbsAGpsHandler21SendRequestTimeOutMsgERK25TTimeIntervalMicroSeconds @ 67 NONAME + _ZN17CT_LbsAGpsHandler23SendRequestModuleOptionE23TLbsHybridModuleOptionsi @ 68 NONAME + _ZN17CT_LbsAGpsHandler24SendRequestUpdateInitMsgERK7TDesC16S2_ @ 69 NONAME + _ZN17CT_LbsAGpsHandler30SendRequestSetAllModuleOptionsEv @ 70 NONAME + _ZN17CT_LbsAGpsHandler32SendRequestClearAllModuleOptionsEv @ 71 NONAME + _ZN17CT_LbsAGpsHandler4NewLEP19MT_ResponseObserver @ 72 NONAME + _ZTI17CT_LbsAGpsHandler @ 73 NONAME ; ## + _ZTV17CT_LbsAGpsHandler @ 74 NONAME ; ## + _ZN20TLbsModuleUpdateItem8SetDelayEi @ 75 NONAME + _ZNK20TLbsModuleUpdateItem5DelayEv @ 76 NONAME + _ZN10T_LbsUtils23GetExpected_ModuleModesERK7TDesC16S2_R13RPointerArrayI14TLbsGpsOptionsE @ 77 NONAME + _ZN26CT_AgpsModuleEventListener4NewLER25MT_AgpsModuleEventHandler @ 78 NONAME + _ZN26CT_AgpsModuleEventListenerD0Ev @ 79 NONAME + _ZN26CT_AgpsModuleEventListenerD1Ev @ 80 NONAME + _ZN26CT_AgpsModuleEventListenerD2Ev @ 81 NONAME + _ZTI26CT_AgpsModuleEventListener @ 82 NONAME + _ZTI28CAgpsModuleModesConfigReader @ 83 NONAME + _ZTV26CT_AgpsModuleEventListener @ 84 NONAME + _ZTV28CAgpsModuleModesConfigReader @ 85 NONAME + _ZN10T_LbsUtils28GetConfigured_ClientDetailsLERK7TDesC16S2_R6RArrayI16TCTClientDetailsE @ 86 NONAME + _ZTI26CClientDetailsConfigReader @ 87 NONAME + _ZTV26CClientDetailsConfigReader @ 88 NONAME + _ZN17CT_LbsAGpsHandler23SendRequestForcedUpdateEv @ 89 NONAME + diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/group/bld.inf Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,25 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +PRJ_TESTMMPFILES +lbstestutils.mmp + +PRJ_TESTEXPORTS +../inc/tlbsutils.h /epoc32/include/lbs/test/tlbsutils.h +../inc/ctlbsasyncwaiter.h /epoc32/include/lbs/test/ctlbsasyncwaiter.h +../inc/ctlbstimerutils.h /epoc32/include/lbs/test/ctlbstimerutils.h +../inc/ctdumper.h /epoc32/include/lbs/test/ctdumper.h +../inc/ctlbsagpshandler.h /epoc32/include/lbs/test/ctlbsagpshandler.h +../inc/ctlbsagpsmoduleeventlistener.h /epoc32/include/lbs/test/ctlbsagpsmoduleeventlistener.h diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/group/lbstestutils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/group/lbstestutils.mmp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,62 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file lbstestutils.mmp +// +// + +TARGET lbstestutils.dll +TARGETTYPE DLL + +//CAPABILITY ProtServ LocalServices WriteDeviceData ReadDeviceData Location +CAPABILITY ALL -TCB + +MACRO ENABLE_LBS_TEST_LOGGER + +UID 0x1000007A 0x10282260 + + +SYSTEMINCLUDE /epoc32/include +SYSTEMINCLUDE /epoc32/include/lbs +SYSTEMINCLUDE /epoc32/include/lbs/test + +USERINCLUDE ../inc +//USERINCLUDE ../../../../locationrequestmgmt/networkrequesthandler/inc + +SOURCEPATH ../src +SOURCE tlbsutils.cpp +SOURCE ctlbsasyncwaiter.cpp +SOURCE ctlbstimerutils.cpp +SOURCE ctlbsconfigreader.cpp +SOURCE ctdumper.cpp +SOURCE ctlbsagpshandler.cpp +SOURCE ctlbsagpsmoduleeventlistener.cpp +SOURCE ctlbstestlogger.cpp + +// EPOC libraries. +LIBRARY euser.lib +LIBRARY efsrv.lib + +// LBS libraries. +LIBRARY lbsselflocate.lib +LIBRARY lbsloccommon.lib +LIBRARY lbsassistancedata.lib +LIBRARY lbsloggerapi.lib +LIBRARY flogger.lib + +// For Log Comparison +LIBRARY lbsprivacycontroller.lib +LIBRARY lbsnetprotocol.lib + +LIBRARY lbstestchannel.lib +LIBRARY lbslocdatasource.lib diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/inc/ctdumper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/inc/ctdumper.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,43 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef CTDUMPER_H +#define CTDUMPER_H + +#include + +#define LBSDUMPNEWLOG() CT_Dumper::OverWrite() +#define LBSDUMP(L1) CT_Dumper::Write(_L(L1)) +#define LBSDUMP2(L1,L2) CT_Dumper::Write(_L(L1), L2) + + +/** Dumper used by the GPS module to dump the update array in a file. +*/ +class CT_Dumper : public CBase + { +public: + IMPORT_C static void OverWrite(); + IMPORT_C static void Write(TRefByValue aFmt, ...); + }; + +#endif // CTDUMPER_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbsagpshandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbsagpshandler.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,93 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Definition of Test Harness request handler component. +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef CTLBSAGPSHANDLER_H +#define CTLBSAGPSHANDLER_H + +#include +#include + + +/////////////////////////////////////////////////////////////////////////////// +// Test Harness Request Handler Channel +/////////////////////////////////////////////////////////////////////////////// + +/** Observer for TH Request Handler interface +*/ +class MT_ResponseObserver + { +public: + virtual void ProcessAGpsResponseMessage(const TT_LbsAGpsResponseMsg::TModuleResponseType aResponse) = 0; + }; + +/** Manager for the TH channel. + +This class handles sending and receiving messages on the Test Harness channel. +It is implemented as an active object to allow it to asnychronously wait for +messages to arrive. Sending is synchronous. +*/ +class CT_LbsAGpsHandler : public CActive, + public MT_LbsChannelObserver + { +public: + IMPORT_C static CT_LbsAGpsHandler* NewL(MT_ResponseObserver* aObserver); + ~CT_LbsAGpsHandler(); + + IMPORT_C void SendRequestUpdateInitMsg(const TDesC& aConfigFileName, + const TDesC& aConfigSection); + IMPORT_C void SendRequestTimeOutMsg(const TTimeIntervalMicroSeconds& aTimeOut); + IMPORT_C void SendRequestSetAllModuleOptions(); + IMPORT_C void SendRequestClearAllModuleOptions(); + IMPORT_C void SendRequestModuleOption(TLbsHybridModuleOptions aOption, TBool aValue); + IMPORT_C void SendRequestForcedUpdate(); + IMPORT_C void SendRequestError(TInt aError); + + +private: + CT_LbsAGpsHandler(MT_ResponseObserver* aObserver); + void ConstructL(); + + // from CActive + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + + // Send a message. + void SendRequestMessage(const TT_LbsMsgBase* aMessage); + + // Buffer a message. + void BufferMessage(const TT_LbsMsgBase* aMessage); + + // from MT_LbsChannelObserver + void ProcessChannelMessage(RT_LbsChannel::TT_LbsChannelId aChannelId, const TT_LbsMsgBase& aMessage); + +private: + MT_ResponseObserver* iObserver; + RT_LbsChannel iTHChannel; + RPointerArray iMsgBuffer; + }; + + +#endif // CTLBSAGPSHANDLER_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbsagpsmoduleeventlistener.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbsagpsmoduleeventlistener.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,62 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_AGPS_MODULE_EVENT_LISTENER_H__ +#define __CT_LBS_AGPS_MODULE_EVENT_LISTENER_H__ + +#include "tlbsutils.h" +#include +#include + +class MT_AgpsModuleEventHandler + { +public: + virtual void OnSetGpsOptions(const TLbsGpsOptions& aGpsOptions) = 0; + }; + +class CT_AgpsModuleEventListener : public CActive +/** + * This class listens to events published by the AGPS Module. + * + * @internalComponent +*/ + { +public: + IMPORT_C static CT_AgpsModuleEventListener* NewL(MT_AgpsModuleEventHandler& aHandler); + IMPORT_C ~CT_AgpsModuleEventListener(); + +private: + CT_AgpsModuleEventListener(MT_AgpsModuleEventHandler& aHandler); + void ConstructL(); + + void RunL(); + void DoCancel(); + +private: + /** The call back class */ + MT_AgpsModuleEventHandler& iHandler; + /** The property that will subscribe to the AGPS Module mode changes key */ + RProperty iModeChangesProperty; + }; + +#endif diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbsasyncwaiter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbsasyncwaiter.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,53 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsasyncwaiter.h +// This is the header file for CT_LbsAsyncWaiter +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_ASYNC_WAITER_H__ +#define __CT_LBS_ASYNC_WAITER_H__ + +//epoc includes +#include + +// Implements functions related to active objects +class CT_LbsAsyncWaiter : public CActive + { +public: + IMPORT_C static CT_LbsAsyncWaiter* NewL(); + ~CT_LbsAsyncWaiter(); + + IMPORT_C void StartAndWait(); + IMPORT_C TInt Result() const; + +private: + CT_LbsAsyncWaiter(); + // from CActive + virtual void RunL(); + virtual void DoCancel(); + +private: + TInt iError; + }; + +#endif // __CT_LBS_ASYNC_WAITER_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbsconfigreader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbsconfigreader.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,406 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsconfigreader.h +// This is the header file which contains the ini file configuration reader classes +// +// + +#ifndef __CT_LBS_CONFIG_READER_H__ +#define __CT_LBS_CONFIG_READER_H__ + + +// Epoc includes +#include + +// LBS includes +#include +#include +#include +#include + +// LBS test includes +#include "tlbsutils.h" + +// Forward Declaration + + + +const TInt KMaxSentence = 200; +const TInt KMaxFields = 20; +const TInt KMaxIniFileBuffer = 100; +const TInt KMaxConfigReaderIniFileName = 100; + +class CConfigReaderBase : public CBase + { +public: + virtual ~CConfigReaderBase(); + + /** Main entry function which reads the ini file, fills out the data items defined in the + derived classes. Once NewL as been called to construct the object, this should then be + called. */ + void ProcessL(); + +protected: + /** Converts a string to a TInt value. */ + void ExtractValueL(const TPtrC8& aField, TInt& aValue); + + /** Converts a string to a TReal32 value. */ + void ExtractValueL(const TPtrC8& aField, TReal32& aValue); + + /** Converts a string to a TReal64 value. */ + void ExtractValueL(const TPtrC8& aField, TReal64& aValue); + +// void ExtractDegreesL(const TPtrC8& aField, TReal64& aDegrees); this maybe handy so we can have lat, long in degrees not raw real numbers... +// void ExtractTimeL(const TPtrC8& aTime, TDateTime& aTheTime); +// void ExtractDateL(const TPtrC8& aDate, TDateTime& aTheDate); + +// Derived classes provide the implementation. + /** Parses a full sentence read from the ini file. */ + virtual void HandleSentenceL()=0; + + /** Fills the data item (detailed in the derived class) with default values. */ + virtual void DefaultData()=0; + + /** Fills the data item (detailed in the derived class) with values parsed from the sentence. */ + virtual void ExtractDataL()=0; + + CConfigReaderBase(const TDesC &aConfigFileName); + + CConfigReaderBase(const TDesC& aConfigFileName, const TDesC& aConfigSection); + +private: + /** Adds valid sentence character to the field. Once the field delimiter is found the field + is appended to the field array. */ + void AppendFieldChar(TUint aChar); + + /** Process sentences read from the ini file buffer. A complete valid sentence is passed + to HandeSentenceL() to allow the derived class to process the sentence fields into + it's data items. */ + void ProcessStringL(const TDesC8& aData); + +private: +// enum TReadState {EWantStart, EWantTerminator}; + + enum TReadState {/* EStart, */ + EStartSection, + EProcessSection, + EStartSentence, + EProcessSentence, + EHalt}; + + + //const TDesC iConfigFileName; // can we try this, but we will not be able to add the path + /** Configuration ini filename to open and read. */ + TBuf iConfigFileName; + TBuf iConfigSection; + + /** State machine variable used while processing a sentence. */ + TReadState iReadState; + + /** The sentence buffer, to store a valid sentence ready for processing. */ + TBuf8 iSentence; + + + TBuf8 iReadSection; + +protected: + /** Field array. Each field is delimited by a ',' or '*' and will be converted into the + member variable of the data item defined in the derived class. */ + TPtrC8 iFields[KMaxFields]; + + /** Number of fields in the field array. */ + TInt iNumFields; + + /** Where the field starts in the sentence string. */ + TInt iFieldStart; + + /** Length of the field. */ + TInt iFieldLength; + }; + + + +// Default values for TPosition, +#define DEFAULT_NOTIFY_POS_UPDATE_LATITUDE 49.2 +#define DEFAULT_NOTIFY_POS_UPDATE_LONGITUDE 3.5 +#define DEFAULT_NOTIFY_POS_UPDATE_ALTITUDE 50.0 +#define DEFAULT_NOTIFY_POS_UPDATE_HORIZONTAL_ACCURACY 2.0 +#define DEFAULT_NOTIFY_POS_UPDATE_VERTICAL_ACCURACY 3.0 + +// TCourse and +#define DEFAULT_NOTIFY_POS_UPDATE_SPEED 26.66f +#define DEFAULT_NOTIFY_POS_UPDATE_HEADING 25.0 +#define DEFAULT_NOTIFY_POS_UPDATE_SPEED_ACCURACY 2.0 +#define DEFAULT_NOTIFY_POS_UPDATE_HEADING_ACCURACY 10.0 + +// TSatelliteData - first satellite +#define DEFAULT_NOTIFY_POS_UPDATE_SATELLITE_ID1 10 +#define DEFAULT_NOTIFY_POS_UPDATE_AZIMUTH1 50.0 +#define DEFAULT_NOTIFY_POS_UPDATE_ELEVATION1 27.0 +#define DEFAULT_NOTIFY_POS_UPDATE_IS_USED1 ETrue +#define DEFAULT_NOTIFY_POS_UPDATE_SIGNAL_STRENGTH1 4 + +// TSatelliteData - second stellite +#define DEFAULT_NOTIFY_POS_UPDATE_SATELLITE_ID2 11 +#define DEFAULT_NOTIFY_POS_UPDATE_AZIMUTH2 47.0 +#define DEFAULT_NOTIFY_POS_UPDATE_ELEVATION2 30.0 +#define DEFAULT_NOTIFY_POS_UPDATE_IS_USED2 EFalse +#define DEFAULT_NOTIFY_POS_UPDATE_SIGNAL_STRENGTH2 3 + + + + +class CUpdateConfigReader : public CConfigReaderBase + { +public: + + enum TUpdateFields + { + EUpdateType = 0, // Must be present + EUpdateRepeat, + ENumOfMeasurements, + + // TCoordinate + EPosLatitude, /** TCoordinate.iLatitude, TReal64 */ + EPosLongitude, /** TCoordinate.iLongitude, TReal64 */ + EPosAltitude, /** TCoordinate.iAltitude, TReal32 */ + + // TLocalitiy + EPosHorzAccuracy, /** TLocality.iHorizontalAccuracy, TReal32 */ + EPosVertAccuracy, /** TLocality.iVerticalAccuracy, TReal32 */ + + // Optional + EUpdateErr, + EUpdateDelay /** Time to delay, can be negative to force early update */ + }; + + + static CUpdateConfigReader* NewL(const TDesC &aConfigFileName, const TDesC& aConfigSection, RPointerArray& aUpdateArr); + +protected: + void HandleSentenceL(); + + void DefaultData(); + void ExtractDataL(); + +private: + CUpdateConfigReader(const TDesC &aConfigFileName, const TDesC& aConfigSection, RPointerArray& aUpdateArr); + void ConstructL(); + + RPointerArray& iUpdateArr; + TLbsModuleUpdateItem* iUpdate; + }; + + + + +class CPosInfoConfigReader : public CConfigReaderBase + { +public: + + enum TPosInfoFields + { + EPosType = 0, // Must be present + EposRepeat, + + // TCoordinate + EPosLatitude, /** TCoordinate.iLatitude, TReal64 */ + EPosLongitude, /** TCoordinate.iLongitude, TReal64 */ + EPosAltitude, /** TCoordinate.iAltitude, TReal32 */ + EPosDatum, /** TCoordinate.iDatum, TUid */ + + // TLocalitiy + EPosHorzAccuracy, /** TLocality.iHorizontalAccuracy, TReal32 */ + EPosVertAccuracy, /** TLocality.iVerticalAccuracy, TReal32 */ + + // TPosition + // EPosTime, /** TPosition.iTime, TTime */ // see comment below + + // TCourse + EPosSpeed, /** TCourse.iSpeed, TReal32 */ + EPosHeading, /** TCourse.iHeading, TReal32 */ + EPosSpeedAccuracy, /** TCourse.iSpeedAccuracy, TReal32 */ + EPosHeadingAccuracy, /** TCourse.iHeadingAccuracy, TReal32 */ + }; + + + static CPosInfoConfigReader* NewL(const TDesC &aConfigFileName, const TDesC& aConfigSection, RPointerArray& aPosInfoArr); + +protected: + void HandleSentenceL(); + + void DefaultData(); + void ExtractDataL(); + +private: + CPosInfoConfigReader(const TDesC &aConfigFileName, const TDesC& aConfigSection, RPointerArray& aPosInfoArr); + void ConstructL(); + + RPointerArray& iPosInfoArr; + TPositionInfoBase* iPosInfo; + }; + + + +/** CModuleStatusConfigReader is a reader class to process module status sentences. + Once processed the aModuleStatus item will be filled with field values held in + the sentence. + + The supported sentence is "modstatus", which MUST start with '$' and end with '*', + fields MUST be delimted by ',' and the sentence MUST NOT contain any white space. + + $modstatus,device_field,data_quality_field* + + where device_field is one of + device_error + device_disable + device_inactive + device_initialising + device_standby + device_ready + device_active + + where data_quality_field is one of + data_quality_loss + data_quality_partial + data_quality_normal + +*/ +class CModuleStatusConfigReader : public CConfigReaderBase + { +public: + + enum TModuleStatusFields + { + EModuleStatusType = 0, // Must be present, only 1 type 'modstatus'. + + // TPositionModuleStatus fields. + EModuleStatusDevice, /** TPositionModuleStatus.iDeviceStatus, TDeviceStatus */ + EModuleStatusDataQuality /** TPositionModuleStatus.iDataQualityStatus, TDataQualityStatus */ + }; + + static CModuleStatusConfigReader* NewL(const TDesC &aConfigFileName, const TDesC& aConfigSection, TPositionModuleStatus& aModuleStatus); + +protected: + /** Converts a string to a TPositionModuleStatus::TDeviceStatus enum value. */ + void ExtractValueDevice(const TPtrC8& aField, TPositionModuleStatus::TDeviceStatus& aValue); + + /** Converts a string to a TPositionModuleStatus::TDataQualityStatus enum value. */ + void ExtractValueDataQuality(const TPtrC8& aField, TPositionModuleStatus::TDataQualityStatus& aValue); + + /** See CConfigReaderBase for comments. */ + void HandleSentenceL(); + void DefaultData(); + void ExtractDataL(); + +private: + CModuleStatusConfigReader(const TDesC &aConfigFileName, const TDesC& aConfigSection, TPositionModuleStatus& aModuleStatus); + + /** Reference to the module status data item to be setup. */ + TPositionModuleStatus& iModuleStatus; + }; + + + +/* and a class reader for module update options +updateoptions,100,100,100,false +interval, +timeout +maxage +partialupdates +*/ + +class CUpdateOptsConfigReader : public CConfigReaderBase + { +public: + + enum TUpdateOptsFields + { + EUpdateOptsType = 0, // Must be present, only 1 type 'updateoptions' + + // TPositionUpdateOptions + EUpdateOptsInterval, /** TPositionUpdateOptions.iUpdateInterval, TTimeIntervalMicroSeconds */ + EUpdateOptsTimeOut, /** TPositionUpdateOptions.iUpdateTimeOut, TTimeIntervalMicroSeconds */ + EUpdateOptsMaxAge, /** TPositionUpdateOptions.iMaxUpdateAge, TTimeIntervalMicroSeconds */ + EUpdateOptsPartialUpdates /** TBool TPositionUpdateOptions.iAcceptPartialUpdates, TBool */ + }; + + + static CUpdateOptsConfigReader* NewL(const TDesC &aConfigFileName, const TDesC& aConfigSection, TPositionUpdateOptions& aUpdateOpts); + +protected: + /** Converts string to a TTimeIntervalMicroSeconds value. */ + void ExtractValueL(const TPtrC8& aField, TTimeIntervalMicroSeconds& aValue); + + /** Converts string to a TBool value. */ + void ExtractValue(const TPtrC8& aField, TBool& aValue); + + void HandleSentenceL(); + + void DefaultData(); + void ExtractDataL(); + +private: + CUpdateOptsConfigReader(const TDesC &aConfigFileName, const TDesC& aConfigSection, TPositionUpdateOptions& aUpdateOpts); + + TPositionUpdateOptions& iUpdateOpts; + }; + +/* + * Class reader for the expected modes in which the module is asked to run + */ +class CAgpsModuleModesConfigReader : public CConfigReaderBase + { +private: + enum TModuleModesFields + { + EModuleModesType = 0, // must be present and needs to be 'modulemodes' + EGpsModeField, // the GPS mode + EBegginingOfGpsOptionsArray // where the array of gps options items starts + }; +public: + static CAgpsModuleModesConfigReader* NewL(const TDesC &aConfigFileName, const TDesC& aConfigSection, + RPointerArray& aModuleModes); +private: + CAgpsModuleModesConfigReader(const TDesC &aConfigFileName, const TDesC& aConfigSection, + RPointerArray& aModuleModes); + void HandleSentenceL(); + + void DefaultData(); + void ExtractDataL(); + +private: + RPointerArray& iModuleModes; + }; + +/* + * Class reader for details of all clients making requests in a test + */ +class CClientDetailsConfigReader : public CConfigReaderBase + { +public: + static CClientDetailsConfigReader* NewL(const TDesC &aConfigFileName, const TDesC& aConfigSection, + RArray& aClientDetailsArray); +private: + CClientDetailsConfigReader(const TDesC &aConfigFileName, const TDesC& aConfigSection, + RArray& aClientDetailsArray); + void HandleSentenceL(); + + void DefaultData(); + void ExtractDataL(); + +private: + RArray& iClientDetailsArray; + }; +#endif //__CT_LBS_CONFIG_READER_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbstestlogger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbstestlogger.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,88 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef LBS_TEST_LOGGER_H +#define LBS_TEST_LOGGER_H + +//************************************************************************************************************ +#include + +//------------------------------------------------------------------------------- +/** Enum for log txt priority +Priorities 0 - 2 are for logging component internal events. +Priority 3 is for logging major component events that may have a major influence on other components. +Priorities 3 - 4 are for logging lbs system level events. +@InternalTechnology +@prototype +*/ +enum TLogPriority + { + /** The lowest priority. Use for hex dump and other low priority information. */ + ELogP0 = 0, + /** Use for method enter/exit logging. */ + ELogP1 = 1, + /** Use for low priority, component internal event and data logging. */ + ELogP2 = 2, + /** Use for important component events like timeouts, warnings and errors. */ + ELogP3 = 3, + /** Use for IPC only. */ + ELogP4 = 4, + /** The highest priority. Use only for really major user, network or hardware events.*/ + ELogP5 = 5 + }; + +/** Log entry type. +@InternalTechnology +@prototype +*/ +enum TLogType + { + ELogNormal = 0, + ELogWarning = 1, + ELogError = 2 + }; + +//------------------------------------------------------------------------------- +/** Logger for development and debug purpose +The log format will be + +Time File name Process Id Log Priority Log text +[08:51:00.997500] [File Name] [Process Id] [Log Text Priority] Any Log text + +note the maximum buffer size limitation KLogBufferSize=150 + +[File Name] see RProcess::FileName() +[Process Id]see RProcess::Id() +[Log Text Priority] - [P0]- [P5] + +@InternalTechnology +@prototype +*/ +class LbsTestLogger + { +public: + + static void Write(TLogType aType, TLogPriority aPrior, TRefByValue aFmt, ...); + static void Write(TLogType aType, TLogPriority aPrior, TRefByValue aFmt, ...); + + static void HexDump(TLogPriority aPrior, const TUint8 *aPtr, TInt aLen); + +private: + static void CreateLogDir(); + static void CreateLogTxt(TLogType aType, TLogPriority aPrior, TDes16& aBuf); + static void CreateLogTxt(TLogType aType, TLogPriority aPrior, TDes8& aBuf); + }; + +#endif //LBS_TEST_LOGGER_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbstestloggermacros.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbstestloggermacros.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,75 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef LBS_TEST_LOGGER_MACROS_H +#define LBS_TEST_LOGGER_MACROS_H + +#include "ctlbstestlogger.h" + +#ifdef ENABLE_LBS_TEST_LOGGER + #define TESTLOG(L1,L2) LbsTestLogger::Write(ELogNormal, L1, _L(L2)) + #define TESTLOG2(L1,L2,L3) LbsTestLogger::Write(ELogNormal, L1, _L(L2), L3) + #define TESTLOG3(L1,L2,L3,L4) LbsTestLogger::Write(ELogNormal, L1, _L(L2), L3, L4) + #define TESTLOG4(L1,L2,L3,L4,L5) LbsTestLogger::Write(ELogNormal, L1, _L(L2), L3, L4, L5) + #define TESTLOG5(L1,L2,L3,L4,L5,L6) LbsTestLogger::Write(ELogNormal, L1, _L(L2), L3, L4, L5, L6) + #define TESTLOG6(L1,L2,L3,L4,L5,L6,L7) LbsTestLogger::Write(ELogNormal, L1, _L(L2), L3, L4, L5, L6, L7) + #define TESTLOG7(L1,L2,L3,L4,L5,L6,L7,L8) LbsTestLogger::Write(ELogNormal, L1, _L(L2), L3, L4, L5, L6, L7, L8) + #define TESTLOG8(L1,L2,L3,L4,L5,L6,L7,L8,L9) LbsTestLogger::Write(ELogNormal, L1, _L(L2), L3, L4, L5, L6, L7, L8, L9) + #define TESTLOGHEX(L1,L2,L3) LbsTestLogger::HexDump(L1,L2,L3) + + + + + #define TESTLOG_ERR(L1,L2) LbsTestLogger::Write(ELogError, L1, _L(L2)) + #define TESTLOG_ERR2(L1,L2,L3) LbsTestLogger::Write(ELogError, L1, _L(L2), L3) + #define TESTLOG_ERR3(L1,L2,L3,L4) LbsTestLogger::Write(ELogError, L1, _L(L2), L3, L4) + #define TESTLOG_ERR4(L1,L2,L3,L4,L5) LbsTestLogger::Write(ELogError, L1, _L(L2), L3, L4, L5) + #define TESTLOG_ERR5(L1,L2,L3,L4,L5,L6) LbsTestLogger::Write(ELogError, L1, _L(L2), L3, L4, L5, L6) + #define TESTLOG_ERR6(L1,L2,L3,L4,L5,L6,L7) LbsTestLogger::Write(ELogError, L1, _L(L2), L3, L4, L5, L6, L7) + + #define TESTLOG_WARN(L1,L2) LbsTestLogger::Write(ELogWarning, L1, _L(L2)) + #define TESTLOG_WARN2(L1,L2,L3) LbsTestLogger::Write(ELogWarning, L1, _L(L2), L3) + #define TESTLOG_WARN3(L1,L2,L3,L4) LbsTestLogger::Write(ELogWarning, L1, _L(L2), L3, L4) + #define TESTLOG_WARN4(L1,L2,L3,L4,L5) LbsTestLogger::Write(ELogWarning, L1, _L(L2), L3, L4, L5) + #define TESTLOG_WARN5(L1,L2,L3,L4,L5,L6) LbsTestLogger::Write(ELogWarning, L1, _L(L2), L3, L4, L5, L6) + #define TESTLOG_WARN6(L1,L2,L3,L4,L5,L6,L7) LbsTestLogger::Write(ELogWarning, L1, _L(L2), L3, L4, L5, L6, L7) +#else + #define TESTLOG(L1,L2) + #define TESTLOG2(L1,L2,L3) + #define TESTLOG3(L1,L2,L3,L4) + #define TESTLOG4(L1,L2,L3,L4,L5) + #define TESTLOG5(L1,L2,L3,L4,L5,L6) + #define TESTLOG6(L1,L2,L3,L4,L5,L6,L7) + #define TESTLOG7(L1,L2,L3,L4,L5,L6,L7,L8) + #define TESTLOG8(L1,L2,L3,L4,L5,L6,L7,L8,L9) + + #define TESTLOGHEX(L1,L2,L3) + + #define TESTLOG_ERR(L1,L2) + #define TESTLOG_ERR2(L1,L2,L3) + #define TESTLOG_ERR3(L1,L2,L3,L4) + #define TESTLOG_ERR4(L1,L2,L3,L4,L5) + #define TESTLOG_ERR5(L1,L2,L3,L4,L5,L6) + #define TESTLOG_ERR6(L1,L2,L3,L4,L5,L6,L7) + + #define TESTLOG_WARN(L1,L2) + #define TESTLOG_WARN2(L1,L2,L3) + #define TESTLOG_WARN3(L1,L2,L3,L4) + #define TESTLOG_WARN4(L1,L2,L3,L4,L5) + #define TESTLOG_WARN5(L1,L2,L3,L4,L5,L6) + #define TESTLOG_WARN6(L1,L2,L3,L4,L5,L6,L7) +#endif // ENABLE_LBS_TEST_TESTLOGGER + +#endif //LBS_TEST_LOGGER_MACROS_H diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbstimerutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/inc/ctlbstimerutils.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,62 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbstimerutils.h +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __CT_LBS_TIMER_UTILS_H__ +#define __CT_LBS_TIMER_UTILS_H__ + +#include + +class MT_LbsTimerUtilsObserver + { +public: + virtual void HandleTimerL(TInt aTimerId, const TTime& aTargetTime) = 0; + }; + + +class CT_LbsTimerUtils : public CTimer + { +public: + IMPORT_C static CT_LbsTimerUtils* NewL(MT_LbsTimerUtilsObserver* aObserver, TInt aTimerId); + + IMPORT_C ~CT_LbsTimerUtils(); + + IMPORT_C void SetTimer(const TTimeIntervalMicroSeconds32 aPeriod); + IMPORT_C void SetTimer(const TTime& aUtcTargetTime); + + IMPORT_C void CancelTimer(); + +protected: + CT_LbsTimerUtils(MT_LbsTimerUtilsObserver* aObserver, TInt aTimerId); + void ConstructL(); + + void RunL(); + +private: + MT_LbsTimerUtilsObserver* iObserver; + TInt iTimerId; + TTime iTargetTime; + }; + +#endif //__CT_LBS_TIMER_UTILS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/inc/tlbsutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/inc/tlbsutils.h Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,404 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file tlbsutils.h +// This is the header file which contains the common utility functions +// +// + + + +/** + @file + @internalTechnology + @test +*/ + +#ifndef __T_LBS_UTILS_H__ +#define __T_LBS_UTILS_H__ + + +// Epoc includes +#include + +// LBS includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Forward Declaration + +// Includes for Log Comparison +#include +#include +#include +#include +#include +#include + + + + +// Property Keys +enum TLbsTestPropertyKeys + { + ELbsTestAGpsModuleIn = 1301, + ELbsTestAGpsModuleOut = 2301, + ELbsTestClockPluginOut = 3301, + ELbsTestAGpsModuleModeChanges = 4301, + ELbsTestAGpsModuleResetAssistanceDataFlag = 5301 + }; + +enum KLbsTestAGpsModuleResetAssistanceDataStates + { + ELbsTestAGpsResetAssistanceDataNotReceived, + ELbsTestAGpsResetAssistanceDataReceived + }; + + +const TInt KMaxModuleDataBusIniFileName = 100; + +// assistance data providers: +const TInt KSimpleAssistanceDataProviderPluginUidValue = 0x10281D77; +const TInt KSuplAssistanceDataProviderPluginUidValue = 0x1028225B; + + +/** Update structure to hold both measurement and position (location) information. +*/ +class TLbsModuleUpdateItem + { +public: + IMPORT_C TLbsModuleUpdateItem(); + + IMPORT_C const TPositionSatelliteInfo& Position() const; + IMPORT_C const TPositionGpsMeasurementInfo& Measurement() const; + IMPORT_C TInt Error() const; + IMPORT_C TInt Delay() const; + + IMPORT_C void SetPosition(const TPositionSatelliteInfo& aReport); + IMPORT_C void SetMeasurement(const TPositionGpsMeasurementInfo& aMeasurement); + IMPORT_C void SetError(TInt aError); + IMPORT_C void SetDelay(TInt aDelay); + + +protected: + TPositionSatelliteInfo iPosition; + TPositionGpsMeasurementInfo iMeasurement; + TInt iError; + TInt iDelay; + }; + + + +// Passing data to test module. +class TModuleDataIn + { +public: + /** Supported request types. */ + enum TModuleRequestType + { + EModuleRequestConfig, + EModuleRequestEventKickOff, + EModuleRequestTestMode, + EModuleRequestTimeOut, + EModuleRequestError, + EModuleRequestTimeStampOffset, + EModuleRequestOptionsChangeReportMode + }; + TModuleRequestType iRequestType; + + + /** Config request data. */ + TBuf iConfigFileName; + TBuf<40> iConfigSection; // bug if you make it bigger, more data we add, we get a -9 buf overflow on the property read + + + /** Event kick off request data. */ + enum _TKickOffEventType + { + EKickOffEventTypeDevice=0x01, + EKickOffEventTypeDataQuality=0x02 + }; + typedef TUint TKickOffEventType; + TKickOffEventType iKickOffEventType; + + + /** Assistance event data. */ + enum TAssDataEventType + { + EAssDataEventExpectSingle, + EAssDataEventExpectMultiple + }; + TAssDataEventType iAssDataEventType; + + + /** Module test mode. */ + enum TTestMode + { + EModuleTestModeAssDataOff, + EModuleTestModeAssDataOn, + EModuleTestModeAssDataOn_TimeStamp, + EModuleTestModeAssDataOn_Cancel_Stage1, + EModuleTestModeAssDataOn_Cancel_Stage2, + EModuleTestModeAssDataOn_Unsolicited, + EModuleTestModeAssDataOn_NoNetwork, + EModuleTestModeAssDataOn_DataNotAvailable, + EModuleTestModeAssDataOn_SomeDataNotAvailable, + EModuleTestModeAssDataOn_InvalidDataRequest, + EModuleTestModeAssDataOn_InvalidDataGet, + EModuleTestModeAssDataOn_EarlyPosUpdates + }; + TTestMode iAssDataTestMode; + + enum TGpsOptionsChangeReportMode + { + EGpsModuleDoReportOptionsChange, + EGpsModuleDoNotReportOptionsChange, + }; + TGpsOptionsChangeReportMode iOptionsChangeReportMode; + + /** Module time out. */ + TTimeIntervalMicroSeconds iTimeOut; + + /** Module Error Code */ + TInt iError; + + /** Used to alter the time stamp of the posinfo. */ + TTimeIntervalMicroSeconds iTimeStampOffset; + }; + + +// Retriving data from the test module. +class TModuleDataOut + { +public: + + enum TModuleRequestType + { + EModuleResponse, + EModuleGpsMode, + }; + TModuleRequestType iRequestType; + + enum TModuleResponseType + { + EModuleResponseOk, + EModuleAssDataRequestedOk, + EModuleAssDataOk, + EModuleAssDataCancelledOk, // may not be possible to verify from within module, hence may remove + EModuleStartupOk, + EModuleShutdownOk, + EModuleErr /** Set if any of the above failed. */ + }; + + TModuleResponseType iResponse; + CLbsAdmin::TGpsMode iGpsMode; /** Used to retrive GPS mode from the module. */ + }; + + +// Retriving data from the test clock plugin. +class TClockPluginDataOut + { +public: + enum TClockPluginResponseType + { + EClockPluginResponseOk, + EClockPluginErr /** Set if any of the above failed. */ + }; + + TClockPluginResponseType iResponse; + }; + + + +// Assistance Data Simple Provider Default values. +const TUint KAssistanceData_RefTime_Week = 12; +const TUint KAssistanceData_RefTime_Tow1MSec = 567; + +// Module Info values +/* + * the A-GPS value are from testproduct\agpsmodule\group\xtestmodule.ini + * most the AGPS module module info are the same as the LbsLocDataSourcePlugins\sirf\group\sirfdatasource.ini + * except "Module name", "Version", "ClassesSupported", "DataSourceId" + */ +//Module ID +#define APGS_MODINFO_MODULE_ID 271064388 +#define NETWORK_MODINFO_MODULE_ID 271064387 +//Module name +#define AGPS_MODINFO_MOD_NAME _L("TEST_Loc_AGPS_Module") +#define NETWORK_MODINFO_MOD_NAME _L("NetLocManager") +// +#define AGPS_MODINFO_IS_AVAILABLE (ETrue) +#define NETWORK_MODINFO_IS_AVAILABLE (ETrue) +//Technology type +#define AGPS_MODINFO_TECHNOLOGY_TYPE (TPositionModuleInfo::TTechnologyType(TPositionModuleInfo::ETechnologyTerminal | \ + TPositionModuleInfo::ETechnologyAssisted)) +#define NETWORK_MODINFO_TECHNOLOGY_TYPE (TPositionModuleInfo::TTechnologyType(TPositionModuleInfo::ETechnologyNetwork)) +//version +#define AGPS_MODINFO_VERSION (TVersion(1,2,3)) +#define NETWORK_MODINFO_VERSION (TVersion(0,1,1)) +//device location +#define AGPS_MODINFO_DEVICE_LOCATION (TPositionModuleInfo::TDeviceLocation(TPositionModuleInfo::EDeviceInternal)) +#define NETWORK_MODINFO_DEVICE_LOCATION (TPositionModuleInfo::TDeviceLocation(TPositionModuleInfo::EDeviceExternal)) +//capabilities +#define AGPS_MODINFO_CAPABILITIES (TPositionModuleInfo::TCapabilities(TPositionModuleInfo::ECapabilityHorizontal | \ + TPositionModuleInfo::ECapabilityVertical | \ + TPositionModuleInfo::ECapabilitySpeed | \ + TPositionModuleInfo::ECapabilityDirection | \ + TPositionModuleInfo::ECapabilitySatellite)) +#define NETWORK_MODINFO_CAPABILITIES (TPositionModuleInfo::TCapabilities(TPositionModuleInfo::ECapabilityHorizontal| \ + TPositionModuleInfo::ECapabilityVertical | \ + TPositionModuleInfo::ECapabilitySpeed | \ + TPositionModuleInfo::ECapabilityDirection)) +//classes supported +#define AGPS_MODINFO_CLASSES_SUPPORTED_POSITION_FAMILY (EPositionInfoClass|EPositionGenericInfoClass| \ + EPositionCourseInfoClass|EPositionSatelliteInfoClass) +#define NETWORK_MODINFO_CLASSES_SUPPORTED_POSITION_FAMILY (EPositionInfoClass|EPositionGenericInfoClass| \ + EPositionCourseInfoClass|EPositionSatelliteInfoClass) +//time to first fix +#define AGPS_MODINFO_TIME_TO_FIRST_FIX (TTimeIntervalMicroSeconds(90000000)) +#define NETWORK_MODINFO_TIME_TO_FIRST_FIX (TTimeIntervalMicroSeconds(20000000)) +//time to next fix +#define AGPS_MODINFO_TIME_TO_NEXT_FIX (TTimeIntervalMicroSeconds(1000000)) +#define NETWORK_MODINFO_TIME_TO_NEXT_FIX (TTimeIntervalMicroSeconds(20000000)) +//horizontal accuracy +#define AGPS_MODINFO_HORIZONTAL_ACCURACY 5.4f +#define NETWORK_MODINFO_HORIZONTAL_ACCURACY 100.0f +//vertical accuracy +#define AGPS_MODINFO_VERTICAL_ACCURACY 5.4f +#define NETWORK_MODINFO_VERTICAL_ACCURACY 100.0f +//cost indication +#define AGPS_MODINFO_COST_INDICATOR (TPositionQuality::ECostPossible) +#define NETWORK_MODINFO_COST_INDICATOR (TPositionQuality::ECostCharge) +//power consumption +#define AGPS_MODINFO_POWER_CONSUMPTION (TPositionQuality::EPowerLow) +#define NETWORK_MODINFO_POWER_CONSUMPTION (TPositionQuality::EPowerLow) + +/** + Current LBS system has two positioning module: A-GPS and Network Loc manager + This value might be changed if more positioning modules are added in the future +*/ +#define MAX_POSITIONING_MODULES 2 + +class TCTClientDetails + { +public: + inline TCTClientDetails() + : iSessionIdDelay(0), iSessionStepDelay(0), iCancelRequest(EFalse), iSessionIdCancel(0), iSessionStepCancel(0), iNumberOfNPUDs(1), iUpdateOptions(0) + {} +public: + TInt iSessionIdDelay; + TInt iSessionStepDelay; + TBool iCancelRequest; + TInt iSessionIdCancel; + TInt iSessionStepCancel; + TInt iNumberOfNPUDs; + TPositionUpdateOptions iUpdateOptions; + }; + +// Implements a class to contain the utility functions. +class T_LbsUtils + { +public: + enum TComparisonAccuracyType + { + ERoughAccuracy, EExactAccuracy + }; + + IMPORT_C T_LbsUtils(); + IMPORT_C ~T_LbsUtils(); + + IMPORT_C void CreateTestPropertiesL(); + // + IMPORT_C void GetConfigured_ModuleInfoL(const TDesC& aConfigFileName, const TDesC& aConfigSection, TPositionModuleInfo& aModInfo); + + IMPORT_C void GetConfigured_PosInfosL(const TDesC& aConfigFileName, const TDesC& aConfigSection, RPointerArray& aPosInfoArr); + IMPORT_C void GetConfigured_UpdateArrayL(const TDesC& aConfigFileName, const TDesC& aConfigSection, RPointerArray& aUpdateArr); + IMPORT_C void GetConfigured_ModuleStatusL(const TDesC& aConfigFileName, const TDesC& aConfigSection, TPositionModuleStatus& aModuleStatus); + IMPORT_C void GetConfigured_ModuleUpdateOptionsL(const TDesC& aConfigFileName, const TDesC& aConfigSection, TPositionUpdateOptions& aUpdateOpts); + IMPORT_C void GetConfigured_ClientDetailsL(const TDesC& aConfigFileName, const TDesC& aConfigSection, + RArray& aClientDetailsArray); + + IMPORT_C void GetExpected_ModuleModes(const TDesC& aConfigFileName, const TDesC& aConfigSection, RPointerArray& aModuleModes); + + IMPORT_C void NotifyModuleOfConfigChangeL(const TModuleDataIn& aModuleDataIn); + IMPORT_C void WaitForModuleToRequestAssistanceDataL(); + + IMPORT_C TBool Compare_PosInfo(const TPositionInfoBase& aPosInfoSideA, const TPositionInfoBase& aPosInfoSideB); + IMPORT_C TBool Compare_PosInfo(const TPositionInfoBase& aPosInfoSideA, const TPositionInfoBase& aPosInfoSideB, TComparisonAccuracyType aCmpAccuracy); + + IMPORT_C TBool Compare_PosInfoArr(RPointerArray& aPosInfoArrSideA, RPointerArray& aPosInfoArrSideB); + IMPORT_C TBool Compare_PosInfoArr(RPointerArray& aPosInfoArrSideA, RPointerArray& aPosInfoArrSideB, TComparisonAccuracyType aCmpAccuracy); + + IMPORT_C void ResetAndDestroy_PosInfoArr(RPointerArray& aPosInfoArr); + + IMPORT_C TPositionModuleId GetNetworkModuleIdL(RPositionServer& aServer); + IMPORT_C TPositionModuleId GetAGpsModuleIdL(RPositionServer& aServer); + IMPORT_C TPositionModuleId GetBadModuleId(); + + IMPORT_C TBool Compare_ModuleInfo(TPositionModuleInfo& aModInfoSideA, TPositionModuleInfo& aModInfoSideB); + IMPORT_C TBool Compare_PositionQuality(TPositionQuality& aQualitySideA, TPositionQuality& aQualitySideB); + IMPORT_C TBool Compare_ModuleStatus(TPositionModuleStatus& aModStatusSideA, TPositionModuleStatus& aModStatusSideB); + IMPORT_C TBool Compare_ModuleUpdateOptions(TPositionUpdateOptions& aModUpdateOptsSideA, TPositionUpdateOptions& aModUpdateOptsSideB); + IMPORT_C TBool Verify_PositionIsValid(TPositionInfo& aPosInfo); + + // Assistance data functions + // IMPORT_C void CreateSimpleAssistanceData(/*TLbsAssistanceDataGroup aDataMask, RDataReaderRootBase& aGpsRefTimeReader*/); + IMPORT_C TBool VerifySimpleAssistanceData(RUEPositioningGpsReferenceTimeReader& aGpsRefTimeReader); + IMPORT_C void Create_ModuleInfoL(TPositionModuleId aModuleId, TPositionModuleInfo& aModInfo); + + + IMPORT_C TBool Compare_LogBase(const CLbsLogEvent& aLogEventSideA, const CLbsLogEvent& aLogEventSideB); + IMPORT_C TBool Compare_SelfLocateLog(const CLbsSelfLocateLogEvent& aSelfLocateLogSideA, const CLbsSelfLocateLogEvent& aSelfLocateLogB); + IMPORT_C TBool Compare_NetworkLocateLog(const CLbsNetworkLocateLogEvent& aNetworkLocateLogSideA, const CLbsNetworkLocateLogEvent& aNetworkLocateLogB); + IMPORT_C TBool Compare_ExternalLocateLog(const CLbsExternalLocateLogEvent& aExternalLocateLogSideA, const CLbsExternalLocateLogEvent& aExternalLocateLogSideB); + IMPORT_C TBool Compare_TransmitLocationLog(const CLbsTransmitLocationLogEvent& aX3PLogSideA, const CLbsTransmitLocationLogEvent& aX3PLogSideB); + IMPORT_C TBool Compare_AssistanceDataLog(const CLbsAssistanceDataLogEvent& aAssistanceDataLogSideA, const CLbsAssistanceDataLogEvent& aAssistanceDataLogSideB); + + // Needed to compare destinations within TransmitLocation Logs + TBool Compare_Destinations(TDesC16& aDestinationFromRealLog, TDesC16& aDestinationFromExpectedLog); + + + IMPORT_C TInt SupportedType(const TUint32& aType, const TInt& aSize); + IMPORT_C TInt CopyPositionTypes(TPositionInfoBase& aTo, const TPositionInfoBase& aFrom); + +private: + TInt GetModIdByTechnology(RPositionServer& aServer, TPositionModuleInfo::TTechnologyType aTechnologyType, TPositionModuleId& aModuleId); + // Needed to compare external locate logs. + TBool Compare_ExternalRequestPrivacyRequestParams(const TLbsLoggingPrivacyRequestParams& aLogPrivacyRequestParamsSideA, const TLbsLoggingPrivacyRequestParams& aLogPrivacyRequestParamsSideB); + TBool Compare_ExternalRequestPrivacyResponseParams(const TLbsLoggingPrivacyResponseParams& aExternalRequestPrivacyResponseSideA, const TLbsLoggingPrivacyResponseParams& aExternalRequestPrivacyResponseSideB); + TBool Compare_ExternalRequestInfo(const TLbsExternalRequestInfo& aExternalRequestInfoSideA, const TLbsExternalRequestInfo& aExternalRequestInfoSideB); + TBool Compare_ExternalRequestPrivacy(const TLbsNetPosRequestPrivacy& aExternalRequestPrivacySideA, const TLbsNetPosRequestPrivacy& aExternalRequestPrivacySideB); + }; + + +/** Possible set of Module options. + Held by AGps Hybrid module as bits in a 32 bitmap. +*/ +enum TLbsHybridModuleOptions +{ + EHybridModuleOptions_ClearAll = 0x0000, + ELbsHybridModuleOptions_AssistanceDataOn = 0x0001, + ELbsHybridModuleOptions_MultiUpdatesOn = 0x0002, + ELbsHybridModuleOptions_DisableReqAssistData = 0x0004, + ELbsHybridModuleOptions_DynamicAssistanceData = 0x008, //Assistance Data delivery variant used in SUPL tests + ELbsHybridModuleOptions_SetAll = 0x000F +}; + +#endif //__T_LBS_UTILS_H__ diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/src/ctdumper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/src/ctdumper.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include +#include + +const TInt KLbsDevLogMaxBufSize = 150; +_LIT(KLbsDevLogFolder, "refFiles"); +_LIT(KLbsDevLogFile,"gpsUpdates.txt"); + + +/** Static function, overwrites de log file if it already exists. +@internalTechnology +@prototype +*/ +EXPORT_C void CT_Dumper::OverWrite() + { + RFileLogger logger; + TInt err = logger.Connect(); + + if (err == KErrNone) + { + logger.CreateLog(KLbsDevLogFolder, KLbsDevLogFile, EFileLoggingModeOverwrite); + } + + logger.Close(); + } + + +/** Static function, one parameter +@param aFmt TDes string reference +@internalTechnology +@prototype +*/ +EXPORT_C void CT_Dumper::Write(TRefByValue aFmt, ...) + { + RFileLogger logger; + TInt err = logger.Connect(); + + if (err == KErrNone) + { + VA_LIST list; + VA_START(list, aFmt); + TBuf16 strList; + strList.FormatList(aFmt, list); + VA_END(list); + TBuf16 txt; + + txt.Append(strList); + + logger.CreateLog(KLbsDevLogFolder, KLbsDevLogFile, EFileLoggingModeAppend); + logger.SetDateAndTime(EFalse, EFalse); + logger.Write(txt); + } + + logger.Close(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/src/ctlbsagpshandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/src/ctlbsagpshandler.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,170 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Implementation of Test Harness request handler component. +// +// + + +#include +#include "ctlbsagpshandler.h" + +const TInt KBufferedMsgMaxCount = 6; + +CT_LbsAGpsHandler::CT_LbsAGpsHandler(MT_ResponseObserver* aObserver) : + CActive(EPriorityStandard), + iObserver(aObserver) + { + } + +CT_LbsAGpsHandler::~CT_LbsAGpsHandler() + { + Cancel(); + iTHChannel.Close(); + iMsgBuffer.ResetAndDestroy(); + } + +EXPORT_C CT_LbsAGpsHandler* CT_LbsAGpsHandler::NewL(MT_ResponseObserver* aObserver) + { + CT_LbsAGpsHandler* self = new (ELeave) CT_LbsAGpsHandler(aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CT_LbsAGpsHandler::ConstructL() + { + RT_LbsChannel::InitializeL(RT_LbsChannel::EChannelTH2TAGPS); + iMsgBuffer.ReserveL(KBufferedMsgMaxCount); + iTHChannel.OpenL(RT_LbsChannel::EChannelTH2TAGPS, *this); + CActiveScheduler::Add(this); + } + +EXPORT_C void CT_LbsAGpsHandler::SendRequestUpdateInitMsg(const TDesC& aConfigFileName, + const TDesC& aConfigSection) + { + TT_LbsAGpsRequestUpdateInitMsg* aMsg = new TT_LbsAGpsRequestUpdateInitMsg(aConfigFileName, aConfigSection); + + BufferMessage(aMsg); + } + +EXPORT_C void CT_LbsAGpsHandler::SendRequestTimeOutMsg(const TTimeIntervalMicroSeconds& aTimeOut) + { + TT_LbsAGpsRequestTimeOut* aMsg = new TT_LbsAGpsRequestTimeOut(aTimeOut); + + BufferMessage(aMsg); + } + +EXPORT_C void CT_LbsAGpsHandler::SendRequestSetAllModuleOptions() + { + TT_LbsAGpsRequestOptions* aMsg = new TT_LbsAGpsRequestOptions(ELbsHybridModuleOptions_SetAll); + + BufferMessage(aMsg); + } + +EXPORT_C void CT_LbsAGpsHandler::SendRequestClearAllModuleOptions() + { + TT_LbsAGpsRequestOptions* aMsg = new TT_LbsAGpsRequestOptions(EHybridModuleOptions_ClearAll); + + BufferMessage(aMsg); + } + +EXPORT_C void CT_LbsAGpsHandler::SendRequestModuleOption(TLbsHybridModuleOptions aOption, TBool aValue) + { + TT_LbsAGpsRequestOptions* aMsg = new TT_LbsAGpsRequestOptions(aOption, aValue); + + BufferMessage(aMsg); + } + +EXPORT_C void CT_LbsAGpsHandler::SendRequestForcedUpdate() + { + TT_LbsAGpsRequestForcedUpdate* msg = new TT_LbsAGpsRequestForcedUpdate(); + + BufferMessage(msg); + } + +EXPORT_C void CT_LbsAGpsHandler::SendRequestError(TInt aError) + { + TT_LbsAGpsRequestError* aMsg = new TT_LbsAGpsRequestError(aError); + + BufferMessage(aMsg); + } + + +void CT_LbsAGpsHandler::RunL() + { + User::LeaveIfError(iStatus.Int()); + + if (iMsgBuffer.Count() > 0) + { + SendRequestMessage(iMsgBuffer[0]); + iMsgBuffer.Remove(0); + } + } + +void CT_LbsAGpsHandler::DoCancel() + { + iTHChannel.CancelSendMessageNotification(); + } + +TInt CT_LbsAGpsHandler::RunError(TInt aError) + { + return aError; + } + +void CT_LbsAGpsHandler::SendRequestMessage(const TT_LbsMsgBase* aMessage) + { + iTHChannel.SendMessage(*aMessage, iStatus); + // The msg has now been sent to the channel. We can now delete it. + delete(aMessage); + SetActive(); + } + +void CT_LbsAGpsHandler::BufferMessage(const TT_LbsMsgBase* aMessage) + { + if (!IsActive()) + { + // The AO is not active, so there should be no buffered messages. + __ASSERT_DEBUG(iMsgBuffer.Count() == 0, User::Invariant()); + + // Immediately send the new message. + SendRequestMessage(aMessage); + } + else + { + __ASSERT_ALWAYS(iMsgBuffer.Count() < KBufferedMsgMaxCount, User::Invariant()); + + // Still waiting for acknowledgement that a previous message + // was read, so buffer this new message. + iMsgBuffer.Append(aMessage); + } + } + +void CT_LbsAGpsHandler::ProcessChannelMessage(RT_LbsChannel::TT_LbsChannelId /*aChannelId*/, + const TT_LbsMsgBase& aMessage) + { + + switch (aMessage.Type()) + { + case TT_LbsMsgBase::EModuleResponse: + { + const TT_LbsAGpsResponseMsg& msg = static_cast(aMessage); + iObserver->ProcessAGpsResponseMessage(msg.ResponseType()); + break; + } + default: + //LBSLOG_ERR2(ELogP2, "Unexpected message type: %d \n", aMessage.Type()); + break; + } + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/src/ctlbsagpsmoduleeventlistener.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/src/ctlbsagpsmoduleeventlistener.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,67 @@ +// 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 the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + + +#include "ctlbsagpsmoduleeventlistener.h" + +EXPORT_C CT_AgpsModuleEventListener* CT_AgpsModuleEventListener::NewL(MT_AgpsModuleEventHandler& aHandler) + { + CT_AgpsModuleEventListener* self = new(ELeave) CT_AgpsModuleEventListener(aHandler); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +EXPORT_C CT_AgpsModuleEventListener::~CT_AgpsModuleEventListener() + { + Cancel(); + iModeChangesProperty.Close(); + } + +CT_AgpsModuleEventListener::CT_AgpsModuleEventListener(MT_AgpsModuleEventHandler& aHandler) + : CActive(EPriorityHigh), iHandler(aHandler) + { + CActiveScheduler::Add(this); + } + +void CT_AgpsModuleEventListener::ConstructL() + { + User::LeaveIfError(iModeChangesProperty.Attach(KUidSystemCategory, ELbsTestAGpsModuleModeChanges)); + iModeChangesProperty.Subscribe(iStatus); + SetActive(); + } + +void CT_AgpsModuleEventListener::RunL() + { + TInt err = iStatus.Int(); + iModeChangesProperty.Subscribe(iStatus); + SetActive(); + if(KErrNone == err) + { + TLbsGpsOptionsArray options; + TPckg pckgOptions(options); + err = iModeChangesProperty.Get(pckgOptions); + if(KErrNone == err) + { + iHandler.OnSetGpsOptions(options); + } + } + } + +void CT_AgpsModuleEventListener::DoCancel() + { + iModeChangesProperty.Cancel(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/src/ctlbsasyncwaiter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/src/ctlbsasyncwaiter.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,129 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsasyncwaiter.cpp +// +// + +// User includes +#include "ctlbsasyncwaiter.h" + + +/** + Function : NewL + Description : Creates an object of CT_LbsAsyncWaiter + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +EXPORT_C CT_LbsAsyncWaiter* CT_LbsAsyncWaiter::NewL() + { + CT_LbsAsyncWaiter* self = new(ELeave) CT_LbsAsyncWaiter(); + return self; + } + + +/** + Function : CT_LbsAsyncWaiter + Description : Constructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +CT_LbsAsyncWaiter::CT_LbsAsyncWaiter() : CActive(EPriorityStandard) + { + CActiveScheduler::Add(this); + } + + +/** + Function : CT_LbsAsyncWaiter + Description : Destructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +CT_LbsAsyncWaiter::~CT_LbsAsyncWaiter() + { + Cancel(); + } + + +/** + Function : StartAndWait + Description : Starts the Active scheduler + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +EXPORT_C void CT_LbsAsyncWaiter::StartAndWait() + { + SetActive(); + iError = iStatus.Int(); + CActiveScheduler::Start(); + } + + +/** + Function : Result + Description : Gives the error + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +EXPORT_C TInt CT_LbsAsyncWaiter::Result() const + { + return iError; + } + + +/** + Function : RunL + Description : + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +void CT_LbsAsyncWaiter::RunL() + { + iError = iStatus.Int(); + CActiveScheduler::Stop(); + } + + +/** + Function : DoCancel + Description : + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +void CT_LbsAsyncWaiter::DoCancel() + { + iError = KErrCancel; + CActiveScheduler::Stop(); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/src/ctlbsconfigreader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/src/ctlbsconfigreader.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,1027 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbsconfigreader.cpp +// This is the Cpp file which contains the ini file configuration reader classes +// +// + +// User includes +#include "ctlbsconfigreader.h" + +// Epoc includes +#include + +// Lbs includes +#include +#include + +// Literals Used +_LIT8(KNotANumber, "nan"); + + +CConfigReaderBase::CConfigReaderBase(const TDesC& aConfigFileName, const TDesC& aConfigSection) : iConfigFileName(aConfigFileName), iConfigSection(aConfigSection) + { + } + + +CConfigReaderBase::~CConfigReaderBase() + { + } + + +void CConfigReaderBase::AppendFieldChar(TUint aChar) + { + if (iSentence.Length() >= iSentence.MaxLength()) + { + return; + } + + iSentence.Append(aChar); + + // If aChar is not a field delimiter then just add it to buffer and return + if (aChar != ',' && aChar != '*') + { + iFieldLength++; + return; + } + + // Got a field delimiter increase the number of fields + // aChar == ',' || aChar == '*' + + TPtrC8 thisField = iSentence.Mid(iFieldStart, iFieldLength); + iFields[iNumFields].Set(thisField); + iNumFields++; + + // Next field starts here + iFieldStart = iSentence.Length(); + iFieldLength = 0; + } + + +void CConfigReaderBase::ProcessStringL(const TDesC8& aData) + { + TInt length = aData.Length(); + + for (TInt index = 0; index < length; index++) + { + TUint ch = aData[index]; + + switch(iReadState) + { + // Keep reading until a section is found. + case EStartSection: + { + if (ch == '[') + { + iReadSection.SetLength(0); + iReadState = EProcessSection; + } + break; + } + + // Found a section, keep reading until end of section found. + case EProcessSection: + { + // End of section, check if it's ours. + if (ch == ']') + { + // Need to convert from TBuf8 to TBuf for the comparision. + TBuf cmpSection; + cmpSection.Copy(iReadSection); + + // Not our section. + if (iConfigSection.Compare(cmpSection) != 0) + { + iReadState = EStartSection; + } + + // Is our section. + else + { + iReadState = EStartSentence; + } + } + else + { + iReadSection.Append(ch); + } + break; + } + + case EStartSentence: + { + // + if (ch == '$') + { + iReadState = EProcessSentence; + iSentence.SetLength(0); + iNumFields = 0; + iFieldStart = 0; + iFieldLength = 0; + for (TInt i = 0; i < KMaxFields; i++) + { + iFields[i].Set(KNullDesC8); + } + } + + // If we find a section we know to stop reading sentences for our section + // and we let the other section be handled, but it will not match ours. + else if (ch == '[') + { + iReadSection.SetLength(0); + iReadState = EProcessSection; + } + + break; + } + + case EProcessSentence: + { + AppendFieldChar(ch); // calling this don't you end up with a * in the field, does it matter + + if (ch == '*') + { + iReadState = EStartSentence; + HandleSentenceL(); + } + break; + } + } + } + } + + +void CConfigReaderBase::ExtractValueL(const TPtrC8& aField, TInt& aValue) + { + if (aField.Length() != 0) + { + TLex8 lex(aField); + TInt err = lex.Val(aValue); + User::LeaveIfError(err); + } + } + + +void CConfigReaderBase::ExtractValueL(const TPtrC8& aField, TReal32& aValue) + { + TRealX nan; + nan.SetNaN(); + + aValue = nan; + + if (aField.Length() != 0) + { + if (aField.CompareF(KNotANumber)) + { + TLex8 lex(aField); + TInt err = lex.Val(aValue); + User::LeaveIfError(err); + } + } + } + + +void CConfigReaderBase::ExtractValueL(const TPtrC8& aField, TReal64& aValue) + { + TRealX nan; + nan.SetNaN(); + + aValue = nan; + + if (aField.Length() != 0) + { + if (aField.CompareF(KNotANumber)) + { + TLex8 lex(aField); + TInt err = lex.Val(aValue); + User::LeaveIfError(err); + } + } + } + +/* +void CConfigReaderBase::ExtractDegreesL(const TPtrC8& aField, TReal64& aDegrees) + { + TRealX nan; + nan.SetNaN(); + + aDegrees = nan; + + if (aField.Length() != 0) + { + TLex8 lex(aField); + TInt err = lex.Val(aDegrees); + User::LeaveIfError(err); + + ConvertDecimalMinutesToDecimalDegrees(aDegrees); + } + } +*/ + + +void CConfigReaderBase::ProcessL() + { + if (iConfigFileName.Length() == 0) + { + User::LeaveIfError(KErrArgument); + } + + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + RFile iniFile; + + User::LeaveIfError(iniFile.Open(fs, iConfigFileName, EFileRead|EFileShareReadersOnly)); + + CleanupClosePushL(iniFile); + + TBuf8 buf; + + // Loop until EOF. + User::LeaveIfError(iniFile.Read(buf)); + while (buf.Length() > 0) + { + // Process data read from file. + ProcessStringL(buf); + + // Refresh buffer from file. + User::LeaveIfError(iniFile.Read(buf)); + } + + CleanupStack::PopAndDestroy(2, &fs); // iniFile, fs. + } + + + + + + + +/*********************** Update Info Reader ************************/ + +CUpdateConfigReader* CUpdateConfigReader::NewL(const TDesC &aConfigFileName, const TDesC& aConfigSection, RPointerArray& aUpdateArr) + { + return new (ELeave) CUpdateConfigReader(aConfigFileName, aConfigSection, aUpdateArr); + } + + +CUpdateConfigReader::CUpdateConfigReader(const TDesC &aConfigFileName, const TDesC& aConfigSection, RPointerArray& aUpdateArr) : CConfigReaderBase(aConfigFileName, aConfigSection), iUpdateArr(aUpdateArr) + { + } + + +void CUpdateConfigReader::HandleSentenceL() + { + // Not a update sentence, ignore all other valid sentences. + if ( (iNumFields == EUpdateType) || (iFields[EUpdateType].Compare(_L8("update")) != 0) ) + { + return; + } + + // Determine the number of times to repeat the update. + TInt repeat = 1; + + if (iFields[EUpdateRepeat].Length() != 0) + { + ExtractValueL(iFields[1], repeat); + } + + // Determine the number of measurements for each update. + TInt numOfMeasurements = 0; + + if (iFields[ENumOfMeasurements].Length() != 0) + { + ExtractValueL(iFields[ENumOfMeasurements], numOfMeasurements); // make this member, then set up this + error in the default + extract maybe + } + + // Add repeat items to the pos info array. + for (TInt i = 0; i < repeat; i++) + { + TPositionGpsMeasurementInfo measureInfo; + TPositionGpsMeasurementData measureData; + + + // Alloc a update item. + iUpdate = new(ELeave) TLbsModuleUpdateItem(); + + + // Set measurement info. + for (TInt j = 0; j < numOfMeasurements; j++) + { + measureData.SetSatelliteId(j + 1); + measureData.SetCarrierNoiseRatio((j+1) + 1); + measureData.SetDoppler((j+1) + 2); + measureData.SetWholeGpsChips((j+1) + 3); + measureData.SetFractionalGpsChips((j+1) + 4); + measureData.SetMultiPathIndicator(TPositionGpsMeasurementData::EMultiPathLow); + measureData.SetPseudoRangeRmsError((j+1) + 5); + + User::LeaveIfError(measureInfo.AppendMeasurementData(measureData)); + } + measureInfo.SetGpsTimeOfWeek(i + 1000); + iUpdate->SetMeasurement(measureInfo); + + + // Set position update. + // Optional fields are present fill out pos info based on them. + if (iFields[3].Length() != 0) + { + DefaultData(); // This will ensure the pos info items are set to a default value for any incomplete sentences. + ExtractDataL(); + } + + // Otherwise use default values. + else + { + DefaultData(); + } + + + // Optional error value is present. Set update error. + TInt updateErr = KErrNone; + if (iFields[EUpdateErr].Length() != 0) + { + ExtractValueL(iFields[EUpdateErr], updateErr); + } + iUpdate->SetError(updateErr); + + // Optional time delay(could be negative) + TInt updateDelay = 0; + if (iFields[EUpdateDelay].Length() != 0) + { + ExtractValueL(iFields[EUpdateDelay], updateDelay); + } + iUpdate->SetDelay(updateDelay); + + + // Add to array, and reset pointer. + iUpdateArr.AppendL(iUpdate); + iUpdate = NULL; + } + } + + +void CUpdateConfigReader::ExtractDataL() + { + // Access the position info from the update structure. + TPositionSatelliteInfo posInfo = iUpdate->Position(); + TPosition position; + + // Process fields. + TReal64 latitude; + TReal64 longitude; + TReal32 altitude; + TReal32 horzAccuracy; + TReal32 vertAccuracy; + + ExtractValueL(iFields[EPosLatitude], latitude); + ExtractValueL(iFields[EPosLongitude], longitude); + ExtractValueL(iFields[EPosAltitude], altitude); + ExtractValueL(iFields[EPosHorzAccuracy], horzAccuracy); + ExtractValueL(iFields[EPosVertAccuracy], vertAccuracy); + + // Set values. + position.SetCoordinate(latitude, longitude, altitude); + position.SetAccuracy(horzAccuracy, vertAccuracy); + position.SetCurrentTime(); + + posInfo.SetPosition(position); + + iUpdate->SetPosition(posInfo); + } + + +void CUpdateConfigReader::DefaultData() + { + // Access the position info from the update structure. + TPositionSatelliteInfo posSatalliteInfo = iUpdate->Position(); + + + // Fill out default position data. + TPosition position; + + position.SetCoordinate(DEFAULT_NOTIFY_POS_UPDATE_LATITUDE, DEFAULT_NOTIFY_POS_UPDATE_LONGITUDE, DEFAULT_NOTIFY_POS_UPDATE_ALTITUDE); + position.SetAccuracy(DEFAULT_NOTIFY_POS_UPDATE_HORIZONTAL_ACCURACY, DEFAULT_NOTIFY_POS_UPDATE_VERTICAL_ACCURACY); + position.SetCurrentTime(); + + posSatalliteInfo.SetPosition(position); + + + // Fill out default course data. + TCourse course; + + course.SetSpeed(DEFAULT_NOTIFY_POS_UPDATE_SPEED); + course.SetHeading(DEFAULT_NOTIFY_POS_UPDATE_HEADING); + course.SetSpeedAccuracy(DEFAULT_NOTIFY_POS_UPDATE_SPEED_ACCURACY); + course.SetHeadingAccuracy(DEFAULT_NOTIFY_POS_UPDATE_HEADING_ACCURACY); + + posSatalliteInfo.SetCourse(course); + + + // Fill out default satalliteInfo. + TSatelliteData satellite; + + satellite.SetSatelliteId(DEFAULT_NOTIFY_POS_UPDATE_SATELLITE_ID1); + satellite.SetAzimuth(DEFAULT_NOTIFY_POS_UPDATE_AZIMUTH1); + satellite.SetElevation(DEFAULT_NOTIFY_POS_UPDATE_ELEVATION1); + satellite.SetIsUsed(DEFAULT_NOTIFY_POS_UPDATE_IS_USED1); + satellite.SetSignalStrength(DEFAULT_NOTIFY_POS_UPDATE_SIGNAL_STRENGTH1); + + posSatalliteInfo.AppendSatelliteData(satellite); + + satellite.SetSatelliteId(DEFAULT_NOTIFY_POS_UPDATE_SATELLITE_ID2); + satellite.SetAzimuth(DEFAULT_NOTIFY_POS_UPDATE_AZIMUTH2); + satellite.SetElevation(DEFAULT_NOTIFY_POS_UPDATE_ELEVATION2); + satellite.SetIsUsed(DEFAULT_NOTIFY_POS_UPDATE_IS_USED2); + satellite.SetSignalStrength(DEFAULT_NOTIFY_POS_UPDATE_SIGNAL_STRENGTH2); + + posSatalliteInfo.AppendSatelliteData(satellite); + + + iUpdate->SetPosition(posSatalliteInfo); + } + + + + + + +/*********************** Position Info Reader ************************/ + +CPosInfoConfigReader* CPosInfoConfigReader::NewL(const TDesC &aConfigFileName, const TDesC& aConfigSection, RPointerArray& aPosInfoArr) + { + return new (ELeave) CPosInfoConfigReader(aConfigFileName, aConfigSection, aPosInfoArr); + } + + +CPosInfoConfigReader::CPosInfoConfigReader(const TDesC &aConfigFileName, const TDesC& aConfigSection, RPointerArray& aPosInfoArr) : CConfigReaderBase(aConfigFileName, aConfigSection), iPosInfoArr(aPosInfoArr) + { + } + + +void CPosInfoConfigReader::HandleSentenceL() + { + // Not a position info sentence, ignore all other valid sentences. + if ( (iNumFields == 0) || ( + (iFields[0].Compare(_L8("position")) != 0) && + (iFields[0].Compare(_L8("course")) != 0) && + (iFields[0].Compare(_L8("satellite")) != 0) )) + { + return; + } + + // Determine the number of times to repeat the pos info. + TInt repeat = 1; + + if (iFields[1].Length() != 0) + { + ExtractValueL(iFields[1], repeat); + } + + // Add repeat items to the pos info array. + for (TInt i = 0; i < repeat; i++) + { + // Alloc a Satellite type info. + iPosInfo = new(ELeave) TPositionSatelliteInfo(); + + // Optional fields are present fill out pos info based on them. + if (iFields[2].Length() != 0) + { + DefaultData(); // This will ensure the pos info items are set to a default value for any incomplete sentences. + ExtractDataL(); + } + + // Otherwise use default values. + else + { + DefaultData(); + } + + // Add to array, and reset pointer. + User::LeaveIfError(iPosInfoArr.Append(iPosInfo)); + iPosInfo = NULL; + } + } + +// i think we will always have to call default to ensure we set things for missing fields +void CPosInfoConfigReader::ExtractDataL() + { + // TODO: we need to support something like this, ie $position,1,10,2.3* which is lat, long only + // I think it will because extract value deals with empty strings + if (iPosInfo->PositionClassType() & EPositionInfoClass) + { + TPosition position; + TPositionInfo& posInfo = static_cast(*iPosInfo); + + TReal64 latitude; + TReal64 longitude; + TReal32 altitude; + // TODO: TUid datum; + TReal32 horzAccuracy; + TReal32 vertAccuracy; + + ExtractValueL(iFields[EPosLatitude], latitude); + ExtractValueL(iFields[EPosLongitude], longitude); + ExtractValueL(iFields[EPosAltitude], altitude); + // TODO: ExtractUidL() not sure what datum is + ExtractValueL(iFields[EPosHorzAccuracy], horzAccuracy); + ExtractValueL(iFields[EPosVertAccuracy], vertAccuracy); + + position.SetCoordinate(latitude, longitude, altitude); + position.SetAccuracy(horzAccuracy, vertAccuracy); + position.SetCurrentTime(); + + posInfo.SetPosition(position); + } + + if (iPosInfo->PositionClassType() & EPositionCourseInfoClass) + { + TCourse course; + TPositionCourseInfo& posCourseInfo = static_cast(*iPosInfo); + + TReal32 speed; + TReal32 heading; + TReal32 speedAccuracy; + TReal32 headingAccuracy; + + ExtractValueL(iFields[EPosSpeed], speed); + ExtractValueL(iFields[EPosHeading], heading); + ExtractValueL(iFields[EPosSpeedAccuracy], speedAccuracy); + ExtractValueL(iFields[EPosHeadingAccuracy], headingAccuracy); + + course.SetSpeed(speed); + course.SetHeading(heading); + course.SetSpeedAccuracy(speedAccuracy); + course.SetHeadingAccuracy(headingAccuracy); + + posCourseInfo.SetCourse(course); + } + + if (iPosInfo->PositionClassType() & EPositionSatelliteInfoClass) + { + // TODO satellite info + } + } + + +void CPosInfoConfigReader::DefaultData() + { + + if (iPosInfo->PositionClassType() & EPositionInfoClass) + { + TPosition position; + TPositionInfo& posInfo = static_cast(*iPosInfo); + + position.SetCoordinate(DEFAULT_NOTIFY_POS_UPDATE_LATITUDE, DEFAULT_NOTIFY_POS_UPDATE_LONGITUDE, DEFAULT_NOTIFY_POS_UPDATE_ALTITUDE); + position.SetAccuracy(DEFAULT_NOTIFY_POS_UPDATE_HORIZONTAL_ACCURACY, DEFAULT_NOTIFY_POS_UPDATE_VERTICAL_ACCURACY); + position.SetCurrentTime(); + + posInfo.SetPosition(position); + } + + if (iPosInfo->PositionClassType() & EPositionCourseInfoClass) + { + TCourse course; + TPositionCourseInfo& posCourseInfo = static_cast(*iPosInfo); + + course.SetSpeed(DEFAULT_NOTIFY_POS_UPDATE_SPEED); + course.SetHeading(DEFAULT_NOTIFY_POS_UPDATE_HEADING); + course.SetSpeedAccuracy(DEFAULT_NOTIFY_POS_UPDATE_SPEED_ACCURACY); + course.SetHeadingAccuracy(DEFAULT_NOTIFY_POS_UPDATE_HEADING_ACCURACY); + + posCourseInfo.SetCourse(course); + } + + if (iPosInfo->PositionClassType() & EPositionSatelliteInfoClass) + { + TSatelliteData satellite; + TPositionSatelliteInfo& posSatalliteInfo = static_cast(*iPosInfo); + + satellite.SetSatelliteId(DEFAULT_NOTIFY_POS_UPDATE_SATELLITE_ID1); + satellite.SetAzimuth(DEFAULT_NOTIFY_POS_UPDATE_AZIMUTH1); + satellite.SetElevation(DEFAULT_NOTIFY_POS_UPDATE_ELEVATION1); + satellite.SetIsUsed(DEFAULT_NOTIFY_POS_UPDATE_IS_USED1); + satellite.SetSignalStrength(DEFAULT_NOTIFY_POS_UPDATE_SIGNAL_STRENGTH1); + + posSatalliteInfo.AppendSatelliteData(satellite); + + satellite.SetSatelliteId(DEFAULT_NOTIFY_POS_UPDATE_SATELLITE_ID2); + satellite.SetAzimuth(DEFAULT_NOTIFY_POS_UPDATE_AZIMUTH2); + satellite.SetElevation(DEFAULT_NOTIFY_POS_UPDATE_ELEVATION2); + satellite.SetIsUsed(DEFAULT_NOTIFY_POS_UPDATE_IS_USED2); + satellite.SetSignalStrength(DEFAULT_NOTIFY_POS_UPDATE_SIGNAL_STRENGTH2); + + posSatalliteInfo.AppendSatelliteData(satellite); + } + +/* For extended tests when/if we have them. + if (infoBase.PositionClassType() & EPositionClassTestExtension) + { + TExtPosInfo* genInfo = reinterpret_cast(buffer); + + genInfo->iGalaxy = DEFAULT_NOTIFY_POS_UPDATE_EXT_GALAXY; + genInfo->iSolarSystem = DEFAULT_NOTIFY_POS_UPDATE_EXT_SOLARSYS; + genInfo->iStarDate = DEFAULT_NOTIFY_POS_UPDATE_EXT_STARDATE; + } +*/ + } + + +/*********************** Module Status Reader ************************/ + +CModuleStatusConfigReader* CModuleStatusConfigReader::NewL(const TDesC &aConfigFileName, const TDesC& aConfigSection, TPositionModuleStatus& aModuleStatus) + { + return new (ELeave) CModuleStatusConfigReader(aConfigFileName, aConfigSection, aModuleStatus); + } + + +CModuleStatusConfigReader::CModuleStatusConfigReader(const TDesC &aConfigFileName, const TDesC& aConfigSection, TPositionModuleStatus& aModuleStatus) : CConfigReaderBase(aConfigFileName, aConfigSection), iModuleStatus(aModuleStatus) + { + } + + +void CModuleStatusConfigReader::ExtractValueDevice(const TPtrC8& aField, TPositionModuleStatus::TDeviceStatus& aValue) + { + // Set device status. + if (aField.Length() != 0) + { + if (aField.Compare(_L8("device_error")) == 0) + { + aValue = TPositionModuleStatus::EDeviceError; + } + + else if (aField.Compare(_L8("device_disable")) == 0) + { + aValue = TPositionModuleStatus::EDeviceDisabled; + } + + else if (aField.Compare(_L8("device_inactive")) == 0) + { + aValue = TPositionModuleStatus::EDeviceInactive; + } + + else if (aField.Compare(_L8("device_initalising")) == 0) + { + aValue = TPositionModuleStatus::EDeviceInitialising; + } + + else if (aField.Compare(_L8("device_standby")) == 0) + { + aValue = TPositionModuleStatus::EDeviceStandBy; + } + + else if (aField.Compare(_L8("device_ready")) == 0) + { + aValue = TPositionModuleStatus::EDeviceReady; + } + + else if (aField.Compare(_L8("device_active")) == 0) + { + aValue = TPositionModuleStatus::EDeviceActive; + } + } + } + + +void CModuleStatusConfigReader::ExtractValueDataQuality(const TPtrC8& aField, TPositionModuleStatus::TDataQualityStatus& aValue) + { + // Set data quality. + if (aField.Length() != 0) + { + if (aField.Compare(_L8("data_quality_loss")) == 0) + { + aValue = TPositionModuleStatus::EDataQualityLoss; + } + + else if (aField.Compare(_L8("data_quality_partial")) == 0) + { + aValue = TPositionModuleStatus::EDataQualityPartial; + } + + else if (aField.Compare(_L8("data_quality_normal")) == 0) + { + aValue = TPositionModuleStatus::EDataQualityNormal; + } + } + } + + +void CModuleStatusConfigReader::HandleSentenceL() + { + // Not a 'updateoptions' sentence, ignore all other valid sentences. + if ( (iNumFields == 0) || (iFields[EModuleStatusType].Compare(_L8("modstatus")) != 0) ) + { + return; + } + + // Set default values for any fields not present in the sentence. + DefaultData(); + + // Set values from set fields in the sentence. + if (iNumFields == 3) + { + ExtractDataL(); + } + } + + +void CModuleStatusConfigReader::ExtractDataL() + { + + TPositionModuleStatus::TDeviceStatus device; + TPositionModuleStatus::TDataQualityStatus dataQuality; + + ExtractValueDevice(iFields[EModuleStatusDevice], device); + ExtractValueDataQuality(iFields[EModuleStatusDataQuality], dataQuality); + + iModuleStatus.SetDeviceStatus(device); + iModuleStatus.SetDataQualityStatus(dataQuality); + } + + +void CModuleStatusConfigReader::DefaultData() + { + iModuleStatus.SetDeviceStatus(TPositionModuleStatus::EDeviceReady); + iModuleStatus.SetDataQualityStatus(TPositionModuleStatus::EDataQualityNormal); + } + + + + +/*********************** Update Options Reader ************************/ + +CUpdateOptsConfigReader* CUpdateOptsConfigReader::NewL(const TDesC &aConfigFileName, const TDesC& aConfigSection, TPositionUpdateOptions& aUpdateOpts) + { + return new (ELeave) CUpdateOptsConfigReader(aConfigFileName, aConfigSection, aUpdateOpts); + } + + +CUpdateOptsConfigReader::CUpdateOptsConfigReader(const TDesC &aConfigFileName, const TDesC& aConfigSection, TPositionUpdateOptions& aUpdateOpts) : CConfigReaderBase(aConfigFileName, aConfigSection), iUpdateOpts(aUpdateOpts) + { + + } + + +void CUpdateOptsConfigReader::ExtractValueL(const TPtrC8& aField, TTimeIntervalMicroSeconds& aValue) + { + if (aField.Length() != 0) + { + TLex8 lex(aField); + TInt64 value; + TInt err = lex.Val(value); + User::LeaveIfError(err); + aValue = value; + } + } + + +void CUpdateOptsConfigReader::ExtractValue(const TPtrC8& aField, TBool& aValue) + { + aValue = EFalse; + if (aField.Length() != 0) + { + if (aField.Compare(_L8("true")) == 0) + { + aValue = ETrue; + } + } + } + + +void CUpdateOptsConfigReader::HandleSentenceL() + { + // Not a 'updateoptions' sentence, ignore all other valid sentences. + if ( (iNumFields == 0) || (iFields[EUpdateOptsType].Compare(_L8("updateoptions")) != 0) ) + { + return; + } + + // Set default values for any fields not present in the sentence. + DefaultData(); + + // Set values from set fields in the sentence. + if (iNumFields == 5) + { + ExtractDataL(); + } + } + + +void CUpdateOptsConfigReader::ExtractDataL() + { + TTimeIntervalMicroSeconds interval; + TTimeIntervalMicroSeconds timeout; + TTimeIntervalMicroSeconds maxage; + TBool partialUpdates; + + ExtractValueL(iFields[EUpdateOptsInterval], interval); + ExtractValueL(iFields[EUpdateOptsTimeOut], timeout); + ExtractValueL(iFields[EUpdateOptsMaxAge], maxage); + ExtractValue(iFields[EUpdateOptsPartialUpdates], partialUpdates); + + iUpdateOpts.SetUpdateInterval(interval); + iUpdateOpts.SetUpdateTimeOut(timeout); + iUpdateOpts.SetMaxUpdateAge(maxage); + iUpdateOpts.SetAcceptPartialUpdates(partialUpdates); + } + + +void CUpdateOptsConfigReader::DefaultData() + { + iUpdateOpts.SetUpdateInterval(0); + iUpdateOpts.SetUpdateTimeOut(0); + iUpdateOpts.SetMaxUpdateAge(0); + iUpdateOpts.SetAcceptPartialUpdates(EFalse); + } + + + + +CAgpsModuleModesConfigReader* CAgpsModuleModesConfigReader::NewL(const TDesC &aConfigFileName, const TDesC& aConfigSection, + RPointerArray& aModuleModes) + { + return new (ELeave) CAgpsModuleModesConfigReader(aConfigFileName, aConfigSection, aModuleModes); + } +CAgpsModuleModesConfigReader::CAgpsModuleModesConfigReader(const TDesC &aConfigFileName, const TDesC& aConfigSection, + RPointerArray& aModuleModes) + : CConfigReaderBase(aConfigFileName, aConfigSection), iModuleModes(aModuleModes) + { + } + +void CAgpsModuleModesConfigReader::HandleSentenceL() + { + // Not a 'modulemodes' sentence, ignore all other valid sentences. + if ( (iNumFields == 0) || (iFields[EModuleModesType].Compare(_L8("modulemodes")) != 0) ) + { + return; + } + + // Set default values for any fields not present in the sentence. + DefaultData(); + + // Set values from set fields in the sentence. + if (iNumFields > 1) + { + ExtractDataL(); + } + } + +void CAgpsModuleModesConfigReader::DefaultData() +/** + * Does nothing since there is no default data to be set for the expected gps mode + */ + { + } + +void CAgpsModuleModesConfigReader::ExtractDataL() + { + TInt gpsModeInt; + ExtractValueL(iFields[EGpsModeField], gpsModeInt); + CLbsAdmin::TGpsMode gpsMode(static_cast(gpsModeInt)); + + if(iNumFields == EGpsModeField+1) + { // there is no options array + TLbsGpsOptions* gpsOptions = new(ELeave) TLbsGpsOptions; + gpsOptions->SetGpsMode(gpsMode); + iModuleModes.AppendL(gpsOptions); + } + else + { + TLbsGpsOptionsArray* gpsOptionsArray = new(ELeave) TLbsGpsOptionsArray; + gpsOptionsArray->SetGpsMode(gpsMode); + + for(TInt index = EBegginingOfGpsOptionsArray; index < iNumFields; ++index) + { + TLbsGpsOptionsItem optionsItem; + TInt posUpdateTypeInt; + ExtractValueL(iFields[index], posUpdateTypeInt); + TLbsGpsOptionsItem::TPosUpdateType posUpdateType(static_cast(posUpdateTypeInt)); + optionsItem.SetLocUpdateType(posUpdateType); + gpsOptionsArray->AppendOptionItem(optionsItem); + } + + iModuleModes.AppendL(gpsOptionsArray); + } + } + + +CClientDetailsConfigReader* CClientDetailsConfigReader::NewL(const TDesC &aConfigFileName, const TDesC& aConfigSection, + RArray& aClientDetailsArray) + { + return new (ELeave) CClientDetailsConfigReader(aConfigFileName, aConfigSection, aClientDetailsArray); + } +CClientDetailsConfigReader::CClientDetailsConfigReader(const TDesC &aConfigFileName, const TDesC& aConfigSection, + RArray& aClientDetailsArray) + : CConfigReaderBase(aConfigFileName, aConfigSection), + iClientDetailsArray(aClientDetailsArray) + { + } + +void CClientDetailsConfigReader::HandleSentenceL() + { + // Not a 'clientdetails' sentence, ignore all other valid sentences. + if ( (iNumFields == 0) || (iFields[0].Compare(_L8("clientdetails")) != 0) ) + { + return; + } + + ExtractDataL(); + } + +void CClientDetailsConfigReader::DefaultData() +/** + * Does nothing since there is no default data to be set for the expected gps mode + */ + { + } + +void CClientDetailsConfigReader::ExtractDataL() + { + TCTClientDetails clientDetails; + TInt value; + + if(iNumFields > 1) + { // initial delay - after which session ID it should start - default is 0 + ExtractValueL(iFields[1], value); + clientDetails.iSessionIdDelay = value; + } + + if(iNumFields > 2) + { // initial delay - after which step in the session it should start - default is 0 + ExtractValueL(iFields[2], value); + clientDetails.iSessionStepDelay = value; + } + + if(iNumFields > 3) + { // number of NPUDs issued by the client - default is 1 + ExtractValueL(iFields[3], value); + clientDetails.iNumberOfNPUDs = value > 0 ? value : 1; + } + + if(iNumFields > 4) + { // the update interval - default is 0 (no tracking) + ExtractValueL(iFields[4], value); + clientDetails.iUpdateOptions.SetUpdateInterval(value); + } + + if(clientDetails.iNumberOfNPUDs == 1 || clientDetails.iUpdateOptions.UpdateInterval() == 0) + { // if one of the params indicates no tracking then set the others to say the same + clientDetails.iUpdateOptions.SetUpdateInterval(0); + } + + if(iNumFields > 5) + { // the max fix time - default is 0 (no timeout) + ExtractValueL(iFields[5], value); + clientDetails.iUpdateOptions.SetUpdateTimeOut(value); + } + + if(iNumFields > 6) + { // the max update age - default is 0 + ExtractValueL(iFields[6], value); + clientDetails.iUpdateOptions.SetMaxUpdateAge(value); + } + + if(iNumFields > 7) + { // if partial updates should be accepted - default is EFalse + if (iFields[7].Compare(_L8("true")) == 0) + { + clientDetails.iUpdateOptions.SetAcceptPartialUpdates(ETrue); + } + } + + if(iNumFields > 8) + { + { // if partial updates should be accepted - default is EFalse + if (iFields[8].Compare(_L8("cancel")) == 0) + { + clientDetails.iCancelRequest = ETrue; + } + } + } + + if(iNumFields > 9) + { // delay after which step in the session the last request should be cancelled - default is 0 + ExtractValueL(iFields[9], value); + clientDetails.iSessionIdCancel = value; + } + + if(iNumFields > 10) + { // delay after which session ID the last request should be cancelled - default is 0 + ExtractValueL(iFields[10], value); + clientDetails.iSessionStepCancel = value; + } + + iClientDetailsArray.AppendL(clientDetails); + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/src/ctlbstestlogger.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/src/ctlbstestlogger.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,273 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// lbstestlogger.cpp +// System +// +// + +#include +#include +#include +#include + +// Component +#include "ctlbstestlogger.h" + +const TInt KLbsDevLogMaxBufSize = 256; +_LIT(KTimeFormat, "%H:%T:%S.%C"); +_LIT(KLogPath, "\\logs\\LbsTestLogs\\"); +_LIT(KLbsDevLogFolder, "LbsTestLogs"); +_LIT(KLbsDevLogFile,"lbstest.txt"); +_LIT(KLbsDevLogError, "Error: "); +_LIT(KLbsDevLogWarning, "Warning: "); +_LIT(KLbsDevLogSep," | "); +_LIT(KLbsDevLog, "LbsDevLog"); + + +const TInt KLbsHexDumpWidth=16; +_LIT(KLbsFirstFormatString,"%04x : "); +_LIT(KLbsSecondFormatString,"%02x "); +_LIT(KLbsThirdFormatString,"%c"); +_LIT(KLbsThreeSpaces," "); +_LIT(KLbsTwoSpaces," "); +const TText KLbsFullStopChar='.'; + +//----------------------------------------------------------------------------- +// LbsTestLogger +//----------------------------------------------------------------------------- + +void LbsTestLogger::CreateLogDir() + { + TInt err; + + // Create the directory + RFs fs; + err = fs.Connect(); + if(KErrNone == err) + { + err = fs.MkDirAll(KLogPath); + fs.Close(); + } + } + + +/** Static function, one parameter +@param aPrior Log entry priority +@param aFmt TDes string reference +@InternalTechnology +@prototype +*/ +void LbsTestLogger::Write(TLogType aType, TLogPriority aPrior, TRefByValue aFmt, ...) + { + RFileLogger logger; + TInt err = logger.Connect(); + + if (err == KErrNone) + { + VA_LIST list; + VA_START(list, aFmt); + TBuf16 strList; + strList.FormatList(aFmt, list); + VA_END(list); + TBuf16 txt; + + CreateLogTxt(aType, aPrior, txt); + txt.Append(strList.Left(KLbsDevLogMaxBufSize - txt.Length())); + + CreateLogDir(); + + logger.CreateLog(KLbsDevLogFolder, KLbsDevLogFile, EFileLoggingModeAppend); + logger.SetDateAndTime(EFalse, EFalse); + logger.Write(txt); + + } + + logger.Close(); + } + +/** Static function to dump the hex data +@param aPrior Log entry priority +@param aPtr TUnit8 pointer to hex data +@param aLen length of hex data +@InternalTechnology +@prototype +*/ +void LbsTestLogger::HexDump(TLogPriority aPrior, const TUint8 *aPtr, TInt aLen) + { + if (aPtr==NULL) // nothing to do + return; + + RFileLogger logger; + TInt err = logger.Connect(); + CreateLogDir(); + logger.CreateLog(KLbsDevLogFolder, KLbsDevLogFile, EFileLoggingModeAppend); + logger.SetDateAndTime(EFalse, EFalse); + + // based on RFileLogger + TBuf buf; + TBuf8 temp; + TInt i=0; + TBuf8 prefix; + CreateLogTxt(ELogNormal, aPrior, prefix); + + while (aLen>0) + { + TInt n=(aLen>KLbsHexDumpWidth ? KLbsHexDumpWidth : aLen); + buf.Copy(prefix); + buf.AppendFormat(KLbsFirstFormatString,i); + + TInt j; + for (j=0; j126) ? KLbsFullStopChar : aPtr[i+j]); + + logger.Write(buf); + + buf.SetLength(0); + temp.SetLength(0); + aLen-=n; + i+=n; + } + + logger.Close(); + } + +/** private function, create common log text +@param aPrior Log entry priority +@param aBuf The log prefix buffer +@InternalTechnology +@prototype +*/ +void LbsTestLogger::CreateLogTxt(TLogType aType, TLogPriority aPrior, TDes16& aBuf) + { + TTime currentTime; + currentTime.UniversalTime(); + TBuf16<32> cTimeStr; + TInt err = KErrNone; + TRAP(err, currentTime.FormatL(cTimeStr, KTimeFormat);) + if(err) + User::Panic(KLbsDevLog, err); + + TFileName dirName = RProcess().FileName(); + TInt16 pos = dirName.LocateReverse('\\') + 1; + TPtr16 fileName = dirName.MidTPtr(pos); + TUint64 procId = RProcess().Id().Id(); + + aBuf.Append(cTimeStr); + aBuf.Append(KLbsDevLogSep); + + aBuf.Append(fileName); + aBuf.Append(KLbsDevLogSep); + + //aBuf.AppendFormat(_L16("%LX"),procId); + //aBuf.Append(KLbsDevLogSep); + + aBuf.AppendFormat(_L16("P%d"),aPrior); + aBuf.Append(KLbsDevLogSep); + + if (aType == ELogError) + { + aBuf.Append(KLbsDevLogError); + } + else if (aType == ELogWarning) + { + aBuf.Append(KLbsDevLogWarning); + } + } + + +/** Static function, one parameter +@param aPrior Log entry priority +@param aFmt Log entry +@InternalTechnology +@prototype +*/ +void LbsTestLogger::Write(TLogType aType, TLogPriority aPrior, TRefByValue aFmt, ...) + { + RFileLogger logger; + TInt err = logger.Connect(); + + if (err == KErrNone) + { + VA_LIST list; + VA_START(list, aFmt); + TBuf8 strList; + strList.FormatList(aFmt, list); + VA_END(list); + + TBuf8 txt; + CreateLogTxt(aType, aPrior, txt); + txt.Append(strList.Left(KLbsDevLogMaxBufSize - txt.Length())); + + CreateLogDir(); + logger.CreateLog(KLbsDevLogFolder, KLbsDevLogFile, EFileLoggingModeAppend); + logger.SetDateAndTime(EFalse, EFalse); + logger.Write(txt); + + } + + logger.Close(); + } + +/** private function, create common log text +@param aPrior Log entry priority +@param aBuf The log prefix buffer +@InternalTechnology +@prototype +*/ +void LbsTestLogger::CreateLogTxt(TLogType aType, TLogPriority aPrior, TDes8& aBuf) + { + TTime currentTime; + currentTime.UniversalTime(); + TBuf<32> cTimeStr; + TInt err = KErrNone; + TRAP(err, currentTime.FormatL(cTimeStr, KTimeFormat);) + if(err) + User::Panic(KLbsDevLog, err); + + TBuf8<32> cTimeStr8; + cTimeStr8.Copy(cTimeStr); + + TFileName dirName = RProcess().FileName(); + TInt pos = dirName.LocateReverse('\\') + 1; + TPtr fileName = dirName.MidTPtr(pos); + TUint64 procId = RProcess().Id().Id(); + + aBuf.Append(cTimeStr8); + aBuf.Append(KLbsDevLogSep); + + aBuf.Append(fileName); + aBuf.Append(KLbsDevLogSep); + + //aBuf.AppendFormat(_L8("%LX"),procId); + //aBuf.Append(KLbsDevLogSep); + + aBuf.AppendFormat(_L8("P%d"),aPrior); + aBuf.Append(KLbsDevLogSep); + + if (aType == ELogError) + { + aBuf.Append(KLbsDevLogError); + } + else if (aType == ELogWarning) + { + aBuf.Append(KLbsDevLogWarning); + } + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/src/ctlbstimerutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/src/ctlbstimerutils.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,154 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file ctlbstimerutils.cpp +// +// + + +#include "ctlbstimerutils.h" + + +/** + Function : NewL + Description : It performs the two construction and returns an object + of type CT_MsgTimerUtils + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +EXPORT_C CT_LbsTimerUtils* CT_LbsTimerUtils::NewL(MT_LbsTimerUtilsObserver* aObserver, TInt aTimerId) + { + CT_LbsTimerUtils* self = new(ELeave) CT_LbsTimerUtils(aObserver, aTimerId); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + + +/** + Function : CT_MsgTimerUtils + Description : Constructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +CT_LbsTimerUtils::CT_LbsTimerUtils(MT_LbsTimerUtilsObserver* aObserver, TInt aTimerId) + : + CTimer(CTimer::EPriorityHigh), + iObserver(aObserver), + iTimerId(aTimerId) + { + CActiveScheduler::Add(this); + } + + +/** + Function : ~CT_MsgTimerUtils + Description : Destructor + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +EXPORT_C CT_LbsTimerUtils::~CT_LbsTimerUtils() + { + Cancel(); + } + +void CT_LbsTimerUtils::ConstructL() + { + CTimer::ConstructL(); + } + + +/** + Function : After + Description : Calls the After function CTimer for the given number of secs + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +EXPORT_C void CT_LbsTimerUtils::SetTimer(const TTimeIntervalMicroSeconds32 aPeriod) +{ + iTargetTime = 0; + HighRes(aPeriod); +} + + +EXPORT_C void CT_LbsTimerUtils::SetTimer(const TTime& aUtcTargetTime) + { + Cancel(); + + iTargetTime = aUtcTargetTime; + + TTime zeroTime(0); + + if (aUtcTargetTime == zeroTime) + { + return; + } + + TTime timeNow; + timeNow.UniversalTime(); + + TTimeIntervalMicroSeconds delay(0); + + if (timeNow < aUtcTargetTime) + { + delay = aUtcTargetTime.MicroSecondsFrom(timeNow); + } + + TInt delay32 = static_cast(I64LOW(delay.Int64())); + + if (delay32 < 0) + { + delay32 = 0; + } + + TTimeIntervalMicroSeconds32 time32 = TTimeIntervalMicroSeconds32(delay32); + + HighRes(time32); + } + +EXPORT_C void CT_LbsTimerUtils::CancelTimer() + { + Cancel(); + } + +/** + Function : RunL + Description : Gives the status of the operation + @internalTechnology + @param : + @return : N/A + @precondition : none + @postcondition : none +*/ +void CT_LbsTimerUtils::RunL() + { + if (iObserver) + { + iObserver->HandleTimerL(iTimerId, iTargetTime); + } + } diff -r 76f9aaeefbab -r e13acd883fbe common/tools/ats/smoketest/lbs/lbstestutils/src/tlbsutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/ats/smoketest/lbs/lbstestutils/src/tlbsutils.cpp Tue Nov 10 13:50:58 2009 +0000 @@ -0,0 +1,1318 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// @file CT_Utils.cpp +// This is the Cpp file which contains the utility functions common across the servers +// +// + +// User includes +#include "tlbsutils.h" +#include "ctlbsconfigreader.h" +#include "ctlbsasyncwaiter.h" +#include "ctlbstestloggermacros.h" + +// Epoc includes +#include +#include +#include + +// Lbs includes +#include +#include + + +// defines +#define BAD_MODULE_ID 0x87654321 + + +/** +*/ +EXPORT_C TLbsModuleUpdateItem::TLbsModuleUpdateItem() + { + } + + +/** +*/ +EXPORT_C const TPositionSatelliteInfo& TLbsModuleUpdateItem::Position() const + { + return iPosition; + } + +/** +*/ +EXPORT_C void TLbsModuleUpdateItem::SetPosition(const TPositionSatelliteInfo& aPosition) + { + iPosition = aPosition; + } + + +/** +*/ +EXPORT_C const TPositionGpsMeasurementInfo& TLbsModuleUpdateItem::Measurement() const + { + return iMeasurement; + } + +/** +*/ +EXPORT_C void TLbsModuleUpdateItem::SetMeasurement(const TPositionGpsMeasurementInfo& aMeasurement) + { + iMeasurement = aMeasurement; + } + + +/** +*/ +EXPORT_C TInt TLbsModuleUpdateItem::Error() const + { + return iError; + } + +/** +*/ +EXPORT_C void TLbsModuleUpdateItem::SetDelay(TInt aDelay) + { + iDelay = aDelay; + } + +/** +*/ +EXPORT_C TInt TLbsModuleUpdateItem::Delay() const + { + return iDelay; + } + +/** +*/ +EXPORT_C void TLbsModuleUpdateItem::SetError(TInt aError) + { + iError = aError; + } + + + +EXPORT_C T_LbsUtils::T_LbsUtils() +/** Constructor. +*/ + { + } + + +EXPORT_C T_LbsUtils::~T_LbsUtils() +/** Destructor. +*/ + { + } + + +/*EXPORT_C static*/ /*void GetDefault_ModuleStatusInfo(TModuleConfiguredStatus& aStatusInfo) + { + (void)aStatusInfo; + } +*/ + + +EXPORT_C void T_LbsUtils::CreateTestPropertiesL() +/** Creates the test properties for the test module. To allow data to be passed between + test steps and the test module. +*/ + { + const TSecurityPolicy KReadPolicy(ECapability_None); + const TSecurityPolicy KWritePolicy(ECapabilityWriteDeviceData); + + + // Create the test module data bus properties. + TInt err; + + // Data to the test module. + err = RProperty::Define(KUidSystemCategory, ELbsTestAGpsModuleIn, RProperty::ELargeByteArray, KReadPolicy, KWritePolicy, sizeof(TModuleDataIn)); + if ((KErrNone != err) && (KErrAlreadyExists != err)) + { + User::LeaveIfError(err); + } + + // Data from the test module. + err = RProperty::Define(KUidSystemCategory, ELbsTestAGpsModuleOut, RProperty::ELargeByteArray, KReadPolicy, KWritePolicy, sizeof(TModuleDataOut)); + if ((KErrNone != err) && (KErrAlreadyExists != err)) + { + User::LeaveIfError(err); + } + + // Data from the test clock plugin. + err = RProperty::Define(KUidSystemCategory, ELbsTestClockPluginOut, RProperty::ELargeByteArray, KReadPolicy, KWritePolicy, sizeof(TClockPluginDataOut)); + if ((KErrNone != err) && (KErrAlreadyExists != err)) + { + User::LeaveIfError(err); + } + + // Creating the property for allowing the AGPS module to report when the mode it's running in changes + err = RProperty::Define(KUidSystemCategory, ELbsTestAGpsModuleModeChanges, RProperty::ELargeByteArray, KReadPolicy, KWritePolicy, sizeof(TLbsGpsOptionsArray)); + if ((KErrNone != err) && (KErrAlreadyExists != err)) + { + User::LeaveIfError(err); + } + + // Create other test properties here also - just update the TLbsTestPropertyKeys enum don't add extra Categories. + + } + + +EXPORT_C void T_LbsUtils::GetConfigured_PosInfosL(const TDesC& aConfigFileName, const TDesC& aConfigSection, RPointerArray& aPosInfoArr) +/** Fills a position info array with values read from a configuration ini file. + +@param aConfigFileName The name of the ini file to read. If the file name is empty (0 length) then + the array will contain a single pos info item with default values. +@param aConfigSection The section within the ini file to read data from. +@param aPosInfoArr The pos info array to which the items are added. The array will cleared of + existing items. +*/ + { + // Clear array. + ResetAndDestroy_PosInfoArr(aPosInfoArr); + + // Check for config file, if not present create a single default TPositionInfo. + if (aConfigFileName.Length() == 0) + { + TPositionSatelliteInfo* posInfo = new(ELeave) TPositionSatelliteInfo(); + TPosition position; + + position.SetCoordinate(DEFAULT_NOTIFY_POS_UPDATE_LATITUDE, DEFAULT_NOTIFY_POS_UPDATE_LONGITUDE, DEFAULT_NOTIFY_POS_UPDATE_ALTITUDE); + position.SetAccuracy(DEFAULT_NOTIFY_POS_UPDATE_HORIZONTAL_ACCURACY, DEFAULT_NOTIFY_POS_UPDATE_VERTICAL_ACCURACY); + position.SetCurrentTime(); + + posInfo->SetPosition(position); + + User::LeaveIfError(aPosInfoArr.Append(posInfo)); + } + + else + { + CPosInfoConfigReader* reader; + + reader = CPosInfoConfigReader::NewL(aConfigFileName, aConfigSection, aPosInfoArr); + CleanupStack::PushL(reader); + + reader->ProcessL(); + + CleanupStack::PopAndDestroy(reader); + } + } + +EXPORT_C void T_LbsUtils::GetConfigured_UpdateArrayL(const TDesC& aConfigFileName, const TDesC& aConfigSection, RPointerArray& aUpdateArr) +/** Fills an updata array structure with values read from a configuration ini file. + +@param aConfigFileName The name of the ini file to read. If the file name is empty (0 length) then + default values will be used. +@param aConfigSection The section within the ini file to read data from. +@param aUpdateArr The update array to be populated. +*/ + { + // Use default values if file name not given. + if (aConfigFileName.Length() == 0) + { + // I am not sure we want to fill in the array with default values - ?? + } + + else + { + CUpdateConfigReader* reader; + + reader = CUpdateConfigReader::NewL(aConfigFileName, aConfigSection, aUpdateArr); + CleanupStack::PushL(reader); + + reader->ProcessL(); + + CleanupStack::PopAndDestroy(reader); + } + } + + +// don't think we need this... +EXPORT_C void T_LbsUtils::GetConfigured_ModuleStatusL(const TDesC& aConfigFileName, const TDesC& aConfigSection, TPositionModuleStatus& aModuleStatus) + { + // Use default values if file name not given. + if (aConfigFileName.Length() == 0) + { + aModuleStatus.SetDeviceStatus(TPositionModuleStatus::EDeviceReady); + aModuleStatus.SetDataQualityStatus(TPositionModuleStatus::EDataQualityNormal); + } + else + { + CModuleStatusConfigReader* reader; + + reader = CModuleStatusConfigReader::NewL(aConfigFileName, aConfigSection, aModuleStatus); + CleanupStack::PushL(reader); + + reader->ProcessL(); + + CleanupStack::PopAndDestroy(reader); + } + } + + +EXPORT_C void T_LbsUtils::GetConfigured_ModuleUpdateOptionsL(const TDesC& aConfigFileName, const TDesC& aConfigSection, TPositionUpdateOptions& aUpdateOpts) +/** Fills a module updata options class/structure with values read from a configuration ini file. + +@param aConfigFileName The name of the ini file to read. If the file name is empty (0 length) then + default values will be used. +@param aConfigSection The section within the ini file to read data from. +@param aUpdateOpts The modified update options structure. +*/ + { + // Use default values if file name not given. + if (aConfigFileName.Length() == 0) + { + aUpdateOpts.SetUpdateInterval(0); + aUpdateOpts.SetUpdateTimeOut(0); + aUpdateOpts.SetMaxUpdateAge(0); + aUpdateOpts.SetAcceptPartialUpdates(EFalse); + } + + else + { + CUpdateOptsConfigReader* reader; + + reader = CUpdateOptsConfigReader::NewL(aConfigFileName, aConfigSection, aUpdateOpts); + CleanupStack::PushL(reader); + + reader->ProcessL(); + + CleanupStack::PopAndDestroy(reader); + } + } + +EXPORT_C void T_LbsUtils::GetConfigured_ClientDetailsL(const TDesC& aConfigFileName, const TDesC& aConfigSection, + RArray& aClientDetailsArray) +/** Gets the delays for each client with values read from a configuration ini file. + +@param aConfigFileName The name of the ini file to read. If the file name is empty (0 length) then + default values will be used. +@param aConfigSection The section within the ini file to read data from. +@param aClientDelayArray The array of client delays. +*/ + { + // Use default values if file name not given. + if (aConfigFileName.Length() == 0) + { // by default have one client + TCTClientDetails client; + aClientDetailsArray.AppendL(client); + return; + } + + else + { + CClientDetailsConfigReader* reader; + reader = CClientDetailsConfigReader::NewL(aConfigFileName, aConfigSection, aClientDetailsArray); + CleanupStack::PushL(reader); + + reader->ProcessL(); + + CleanupStack::PopAndDestroy(reader); + if(aClientDetailsArray.Count() == 0) + { // by default have one client + TCTClientDetails client; + aClientDetailsArray.AppendL(client); + } + } + } + +EXPORT_C void T_LbsUtils::GetExpected_ModuleModes(const TDesC& aConfigFileName, const TDesC& aConfigSection, RPointerArray& aModuleModes) + { + if (aConfigFileName.Length() == 0) + { + return; + } + + CAgpsModuleModesConfigReader* reader; + reader = CAgpsModuleModesConfigReader::NewL(aConfigFileName, aConfigSection, aModuleModes); + CleanupStack::PushL(reader); + reader->ProcessL(); + CleanupStack::PopAndDestroy(reader); + } + + +EXPORT_C void T_LbsUtils::NotifyModuleOfConfigChangeL(const TModuleDataIn& aModuleDataIn) +/** Notify the module of a configuration change. + +Used when the test harness has read a configuration file and wishes to notify the test module +that it should also do a read of the configuration file. To ensure both the test harness and +the test module are using the same reference data. + +The ELbsTestAGpsModuleIn property is used to pass the ini file and section names to the +test module. The ELbsTestAGpsModuleOut is then used to receive an response from the test module. + +@param aConfigFileName The file name string to send to the test mdoule. +@param aConfigSection The ini section name string to send to the test module. +*/ + { + // Ask to be notified when the module receives the ini file re-read request. + + // Attach and subscribe to listen for data bus updates. Use the async waiter to process + // the update. + RProperty modDataOutProperty; + User::LeaveIfError(modDataOutProperty.Attach(KUidSystemCategory, ELbsTestAGpsModuleOut)); + + CT_LbsAsyncWaiter* waiter = CT_LbsAsyncWaiter::NewL(); + CleanupStack::PushL(waiter); + + modDataOutProperty.Subscribe(waiter->iStatus); + + + // Publish the file and section names to the module, to inform the module it has to + // carry out a re-read of the ini file. + TPckgBuf modDataInBuf; + TModuleDataIn& modDataIn = modDataInBuf(); + + // Copy across all the data items. + modDataIn.iRequestType = aModuleDataIn.iRequestType; + modDataIn.iConfigFileName = aModuleDataIn.iConfigFileName; + modDataIn.iConfigSection = aModuleDataIn.iConfigSection; + modDataIn.iAssDataEventType = aModuleDataIn.iAssDataEventType; + modDataIn.iAssDataTestMode = aModuleDataIn.iAssDataTestMode; + modDataIn.iKickOffEventType = aModuleDataIn.iKickOffEventType; + modDataIn.iTimeOut = aModuleDataIn.iTimeOut; + modDataIn.iError = aModuleDataIn.iError; + modDataIn.iTimeStampOffset = aModuleDataIn.iTimeStampOffset; + modDataIn.iOptionsChangeReportMode = aModuleDataIn.iOptionsChangeReportMode; + + User::LeaveIfError(RProperty::Set(KUidSystemCategory, ELbsTestAGpsModuleIn, modDataInBuf)); + + TBool noResponse = ETrue; + + // Wait for the notification from the test module. + while(noResponse) + { + waiter->StartAndWait(); + User::LeaveIfError(waiter->Result()); + + // Now ensure the notification response was good. + TModuleDataOut modDataOut; + TPckg modDataOutPckg(modDataOut); + + User::LeaveIfError(modDataOutProperty.Get(modDataOutPckg)); + + if ((TModuleDataOut::EModuleResponse == modDataOut.iRequestType) && (TModuleDataOut::EModuleResponseOk == modDataOut.iResponse)) + { + noResponse = EFalse; + } + } + + CleanupStack::PopAndDestroy(waiter); + } + + +EXPORT_C void T_LbsUtils::WaitForModuleToRequestAssistanceDataL() +/** Wait for notification that the test AGPS module as requested assistance data. + + Blocking function used to determine when the test module has requested assistance data as part of its location update. +*/ + { + RProperty modDataOutProperty; + User::LeaveIfError(modDataOutProperty.Attach(KUidSystemCategory, ELbsTestAGpsModuleOut)); + + CT_LbsAsyncWaiter* waiter = CT_LbsAsyncWaiter::NewL(); + CleanupStack::PushL(waiter); + + modDataOutProperty.Subscribe(waiter->iStatus); + + // Wait for the notification from the test module. + waiter->StartAndWait(); + User::LeaveIfError(waiter->Result()); + + // Ensure the correct response is given. + TModuleDataOut modDataOut; + TPckg modDataOutPckg(modDataOut); + + User::LeaveIfError(modDataOutProperty.Get(modDataOutPckg)); + + if (TModuleDataOut::EModuleAssDataRequestedOk != modDataOut.iResponse) + { + User::LeaveIfError(KErrArgument); + } + + CleanupStack::PopAndDestroy(waiter); + } + +EXPORT_C TBool T_LbsUtils::Compare_PosInfo(const TPositionInfoBase& aPosInfoSideA, const TPositionInfoBase& aPosInfoSideB) +/** Compare two position info structures. Ensure all fields match excatly. + +@param aPosInfoSideA The first structure to compare. +@param aPosInfoSideB The second structure to compare. +@return ETrue if both structure match excatly else EFalse. +*/ + { + return Compare_PosInfo(aPosInfoSideA, aPosInfoSideB, EExactAccuracy); + } + + +EXPORT_C TBool T_LbsUtils::Compare_PosInfo(const TPositionInfoBase& aPosInfoSideA, const TPositionInfoBase& aPosInfoSideB, TComparisonAccuracyType aCmpAccuracy) + { + // TODO compare base class items, such as module id, position mode, etc. + + TUint32 typeA = aPosInfoSideA.PositionClassType(); + TUint32 typeB = aPosInfoSideB.PositionClassType(); + + // Compare TPositionInfo type items. + if(typeA & typeB & EPositionInfoClass) + { + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Both positions are of type EPositionInfoClass"); + const TPositionInfo& posInfoSideA = reinterpret_cast(aPosInfoSideA); + const TPositionInfo& posInfoSideB = reinterpret_cast(aPosInfoSideB); + + TPosition posSideA; + TPosition posSideB; + posInfoSideA.GetPosition(posSideA); + posInfoSideB.GetPosition(posSideB); + + // Carry out an exact check when comparing items. + if (EExactAccuracy == aCmpAccuracy) + { + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Comparing positions for exact match"); + // Compare latitude. + if (Math::IsNaN(posSideA.Latitude()) && Math::IsNaN(posSideB.Latitude())) + ; + else if (posSideA.Latitude() != posSideB.Latitude()) + { + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match!"); + TESTLOG3(ELogP1, "Latitudes %d and %d respectively", posSideA.Latitude(), posSideB.Latitude()); + return EFalse; + } + + // Compare longitude. + if (Math::IsNaN(posSideA.Longitude()) && Math::IsNaN(posSideB.Longitude())) + ; + else if (posSideA.Longitude() != posSideB.Longitude()) + { + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match!"); + TESTLOG3(ELogP1, "Longitudes %d and %d respectively", posSideA.Longitude(), posSideB.Longitude()); + return EFalse; + } + + // Compare altitude. + if (Math::IsNaN(posSideA.Altitude()) && Math::IsNaN(posSideB.Altitude())) + ; + else if (posSideA.Altitude() != posSideB.Altitude()) + { + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match!"); + TESTLOG3(ELogP1, "Altitudes %d and %d respectively", posSideA.Altitude(), posSideB.Altitude()); + return EFalse; + } + + // Compare datum. + if (posSideA.Datum() != posSideB.Datum()) + { + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match!"); + TESTLOG3(ELogP1, "Datums %d and %d respectively", posSideA.Datum(), posSideB.Datum()); + return EFalse; + } + + // Compare horizontal accuracy. + if (Math::IsNaN(posSideA.HorizontalAccuracy()) && Math::IsNaN(posSideB.HorizontalAccuracy())) + ; + else if (posSideA.HorizontalAccuracy() != posSideB.HorizontalAccuracy()) + { + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match!"); + TESTLOG3(ELogP1, "Horizontal Accuracies %d and %d respectively", posSideA.HorizontalAccuracy(), posSideB.HorizontalAccuracy()); + return EFalse; + } + + // Compare vertical accuracy. + if (Math::IsNaN(posSideA.VerticalAccuracy()) && Math::IsNaN(posSideB.VerticalAccuracy())) + ; + else if (posSideA.VerticalAccuracy() != posSideB.VerticalAccuracy()) + { + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match!"); + TESTLOG3(ELogP1, "Vertical Accuracies %d and %d respectively", posSideA.VerticalAccuracy(), posSideB.VerticalAccuracy()); + return EFalse; + } + } + else + { + // Check latitude + longitude using horz accuracy. + TReal horzAct = posSideA.HorizontalAccuracy(); // Use the verify accuracy value (which is side A). + TReal distance ; + + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Comparing positions for 'rough' match"); + // if(NAN != horzAct) + { + // The following is a temporary patch until TPositionInfo.Distance() is implemented: +/* + from http://www.movable-type.co.uk/scripts/GIS-FAQ-5.1.html + + presuming a spherical Earth with radius R (see below), and the locations of the two points in spherical coordinates (longitude and latitude) are lon1,lat1 and lon2,lat2 then the + + Haversine Formula (from R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159): + + dlon = lon2 - lon1 + dlat = lat2 - lat1 + a = sin^2(dlat/2) + cos(lat1) * cos(lat2) * sin^2(dlon/2) + c = 2 * arcsin(min(1,sqrt(a))) + d = R * c + + will give mathematically and computationally exact results. + +*/ + const TReal pi = 3.141592653589793; + const TReal earthRadius = 6367 * 1000; // earth radius in metres + + TReal32 latA = posSideA.Latitude() * (pi/180); + TReal32 latB = posSideB.Latitude() * (pi/180); + TReal32 lonA = posSideA.Longitude() * (pi/180); + TReal32 lonB = posSideB.Longitude() * (pi/180); + + TReal dlon = (lonB - lonA); + TReal dlat = (latB - latA); + TReal sin_half_dlat, sin_half_dlon, coslatA, coslatB; + + Math::Sin(sin_half_dlat, dlat/2); + Math::Sin(sin_half_dlon, dlon/2); + Math::Cos(coslatA, latA); + Math::Cos(coslatB, latB); + + TReal a = (sin_half_dlat * sin_half_dlat) + (coslatA * coslatB * (sin_half_dlon * sin_half_dlon)); + TReal sqrt_a; + Math::Sqrt(sqrt_a, a); + TReal arcsinmin; + + TReal min = Min(static_cast(1), sqrt_a); + Math::ASin(arcsinmin, min); + + distance = earthRadius * (2 * arcsinmin); + + //__ASSERT_ALWAYS(!Math::IsNaN(distance), User::Panic(_L("Lbs Test Utils"), KErrGeneral)); + if(Math::IsNaN(latA) || Math::IsNaN(lonA) || Math::IsNaN(horzAct)) + { + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match because contains NaNs!"); + return EFalse; + } + else if(distance > horzAct + 30) // lrm allow for 30m discrepency for now TO DO figure out whether we should be able to check finer accuracy + { + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Positions don't match because distance greater than reported accuracy + margin!"); + return EFalse; + } + } + + /* put back later: + TReal32 horzAct = posSideA.HorizontalAccuracy(); // Use the verify accuracy value (which is side A). + TReal32 distance ; + + posSideA.Distance(posSideB, distance); + if (distance > horzAct) + return EFalse; + + // Check altitude using vert accuracy. + TReal32 vertAct = posSideA.VerticalAccuracy(); // Use the verify accuracy value (which is side A). + TReal32 height = Abs(posSideA.Altitude() - posSideB.Altitude()); + if (height > vertAct) + return EFalse; + */ + + } + + // TODO, we don't compare times, not sure if this is something we would do later on +// if (posSideA.Time() != posSideB.Time()) +// return EFalse; + + return ETrue; + } + + // Compare TPositionCourseInfo type items. + if (typeA & typeB & EPositionCourseInfoClass) + { + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Both positions are of type EPositionCourseInfoClass"); + // TODO + } + + // Compare TPositionSatelliteInfo type items. + if (typeA & typeB & EPositionSatelliteInfoClass) + { + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfo() Both positions are of type EPositionSatelliteInfoClass"); + // TODO + } + +/* For extended tests when we have them. + if (infoBase.PositionClassType() & EPositionClassTestExtension) + { + } +*/ + return EFalse; + } + + +EXPORT_C TBool T_LbsUtils::Compare_PosInfoArr(RPointerArray& aPosInfoArrSideA, RPointerArray& aPosInfoArrSideB) + { + return Compare_PosInfoArr(aPosInfoArrSideA, aPosInfoArrSideB, EExactAccuracy); + } + +EXPORT_C TBool T_LbsUtils::Compare_PosInfoArr(RPointerArray& aPosInfoArrSideA, RPointerArray& aPosInfoArrSideB, TComparisonAccuracyType aCmpAccuracy) + { + // Only compare items if the arrays are the same size. + if (aPosInfoArrSideA.Count() == aPosInfoArrSideB.Count()) + { + TPositionInfoBase* posInfoA; + TPositionInfoBase* posInfoB; + TBool res; + + for (TInt i = 0; i < aPosInfoArrSideA.Count(); ++i) + { + posInfoA = reinterpret_cast(aPosInfoArrSideA[i]); + posInfoB = reinterpret_cast(aPosInfoArrSideB[i]); + + res = Compare_PosInfo(*posInfoA, *posInfoB, aCmpAccuracy); + if (!res) + return EFalse; + } + } + + else + { + TESTLOG(ELogP1, "T_LbsUtils::Compare_PosInfoArr() Failed because different number of positions in arrays being compared!"); + return EFalse; + } + return ETrue; + } + + +EXPORT_C void T_LbsUtils::ResetAndDestroy_PosInfoArr(RPointerArray& aPosInfoArr) + { + for (TInt i = 0; i < aPosInfoArr.Count(); ++i) + delete aPosInfoArr[i]; + aPosInfoArr.Reset(); + } + + +EXPORT_C TPositionModuleId T_LbsUtils::GetNetworkModuleIdL(RPositionServer& aServer) + { + TPositionModuleId modId; + + User::LeaveIfError(GetModIdByTechnology(aServer, TPositionModuleInfo::ETechnologyNetwork, modId)); + + return modId; + } + + +EXPORT_C TPositionModuleId T_LbsUtils::GetAGpsModuleIdL(RPositionServer& aServer) + { + TPositionModuleId modId; + + User::LeaveIfError(GetModIdByTechnology(aServer, (TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted), modId)); + + return modId; + } + +EXPORT_C TPositionModuleId T_LbsUtils::GetBadModuleId() + { + TPositionModuleId modId; + + modId.iUid = BAD_MODULE_ID; + + return modId; + } + + +EXPORT_C TBool T_LbsUtils::Compare_ModuleInfo(TPositionModuleInfo& aModInfoSideA, TPositionModuleInfo& aModInfoSideB) + { + // Compare all module information items and quality. + + // Compare module id. + if (aModInfoSideA.ModuleId() != aModInfoSideB.ModuleId()) + { + return EFalse; + } + + // Compare is available flag. + if (aModInfoSideA.IsAvailable() != aModInfoSideB.IsAvailable()) + { + return EFalse; + } + + // Compare technology type. + if (aModInfoSideA.TechnologyType() != aModInfoSideB.TechnologyType()) + { + return EFalse; + } + + // Compare device location. + if (aModInfoSideA.DeviceLocation() != aModInfoSideB.DeviceLocation()) + { + return EFalse; + } + + // Compare capabilities. + if (aModInfoSideA.Capabilities() != aModInfoSideB.Capabilities()) + { + return EFalse; + } + + // Compare each of the family classes. Use min and max enum values. + for (TInt i = EPositionInfoFamily; i <= EPositionUpdateOptionsFamily; i++) + { + if (aModInfoSideA.ClassesSupported(static_cast(i)) != aModInfoSideB.ClassesSupported(static_cast(i))) + { + return EFalse; + } + } + + // Compare version. + if ((aModInfoSideA.Version().iMajor != aModInfoSideB.Version().iMajor) || + (aModInfoSideA.Version().iMinor != aModInfoSideB.Version().iMinor) || + (aModInfoSideA.Version().iBuild != aModInfoSideB.Version().iBuild)) + { + return EFalse; + } + + // Compare module name. + TBuf modNameSideA; + TBuf modNameSideB; + + aModInfoSideA.GetModuleName(modNameSideA); + aModInfoSideB.GetModuleName(modNameSideB); + if (0 != modNameSideA.Compare(modNameSideB)) + { + return EFalse; + } + + // Compare module quality. + TPositionQuality qualitySideA; + TPositionQuality qualitySideB; + + aModInfoSideA.GetPositionQuality(qualitySideA); + aModInfoSideB.GetPositionQuality(qualitySideB); + + return Compare_PositionQuality(qualitySideA, qualitySideB); + } + +EXPORT_C TBool T_LbsUtils::Compare_ModuleStatus(TPositionModuleStatus& aModStatusSideA, TPositionModuleStatus& aModStatusSideB) + { + // Compare device status. + if (aModStatusSideA.DeviceStatus() != aModStatusSideB.DeviceStatus()) + { + return EFalse; + } + + // Compare quality status. + if (aModStatusSideA.DataQualityStatus() != aModStatusSideB.DataQualityStatus()) + { + return EFalse; + } + + return TRUE; + } + + +EXPORT_C TBool Compare_ModuleUpdateOptions(TPositionUpdateOptions& aModUpdateOptsSideA, TPositionUpdateOptions& aModUpdateOptsSideB) + { + // Compare base class items. + if(aModUpdateOptsSideA.PositionClassSize() != aModUpdateOptsSideB.PositionClassSize()) + { + return EFalse; + } + + if(aModUpdateOptsSideA.PositionClassType() != aModUpdateOptsSideB.PositionClassType()) + { + return EFalse; + } + + // Compare interval option. + if(aModUpdateOptsSideA.UpdateInterval() != aModUpdateOptsSideB.UpdateInterval()) + { + return EFalse; + } + + // Compare timeout option. + if(aModUpdateOptsSideA.UpdateTimeOut() != aModUpdateOptsSideB.UpdateTimeOut()) + { + return EFalse; + } + + // Compare maxage option. + if(aModUpdateOptsSideA.MaxUpdateAge() != aModUpdateOptsSideB.MaxUpdateAge()) + { + return EFalse; + } + + // Compare partial update option. + if(aModUpdateOptsSideA.AcceptPartialUpdates() != aModUpdateOptsSideB.AcceptPartialUpdates()) + { + return EFalse; + } + + return ETrue; + } + + +EXPORT_C TBool T_LbsUtils::Compare_PositionQuality(TPositionQuality& aQualitySideA, TPositionQuality& aQualitySideB) +/** Compare two position quality structures. + +@param aQualitySideA +@param aQualitySideB +*/ + { + // Check if each quality contains the same number of assigned quality items. + if (aQualitySideA.HighWaterMark() != aQualitySideB.HighWaterMark()) + { + return EFalse; + } + + // Compare each quality item. + TInt endId = aQualitySideA.HighWaterMark(); + + for (TInt i = 0; i <= endId; i++) + { + // Element for each side must be defined. + if (!aQualitySideA.IsDefined(i) || !aQualitySideB.IsDefined(i)) + { + return EFalse; + } + + // Now compare the actual element. + TPositionQualityItem::TResult res; + if (KErrNone != aQualitySideA.Compare(aQualitySideB, i, res)) + { + return EFalse; + } + if (TPositionQualityItem::EIsEqual != res) + { + return EFalse; + } + } + + return ETrue; + } + + +/** + * Verifies that the supplied position is 'reasonable' + * + */ +EXPORT_C TBool T_LbsUtils::Verify_PositionIsValid(TPositionInfo& aPosInfo) + { + TBool valid = TRUE; + TPosition pos; + TReal32 alt; + TReal64 lat, longt; + + aPosInfo.GetPosition(pos); + + alt = pos.Altitude(); + lat = pos.Latitude(); + longt = pos.Longitude(); + + // TO DO figure out what values are reasonable here (in Milton somewhere!?) + // We could use the normal verify posinfo stuff, and check to see if the values are roughly equal. + // Either update this func (add a parameter) or new func like the compare posinfo func we have + if(alt == 0 || lat == 0 || longt == 0) + { + valid = FALSE; + } + + + return valid; + } + + +// May not be required. +//EXPORT_C void T_LbsUtils::CreateSimpleAssistanceData(/*TLbsAssistanceDataGroup aDataMask, RDataReaderRootBase& aGpsRefTimeReader*/) +// { + +// } + +/** Ensure the simple assistance data is correct. Typically the data is given by the simple + assistance data provider module used by the Net Sim. + +@param aRefTimeReader The assistance data reader which holds the reference time data, the + reader must be opened (use OpenL()) before calling this function. +*/ +EXPORT_C TBool T_LbsUtils::VerifySimpleAssistanceData(RUEPositioningGpsReferenceTimeReader& aRefTimeReader) + { + TUint week; + TUint tow1MSec; + + // Access the reference time values. + aRefTimeReader.GetField(TUEPositioningGpsReferenceTime::EGpsWeek, week); + aRefTimeReader.GetField(TUEPositioningGpsReferenceTime::EGpsTow1Msec, tow1MSec); + + // Verify the reference time values. + TBool passed = ETrue; + + passed &= (week == KAssistanceData_RefTime_Week); + passed &= (tow1MSec == KAssistanceData_RefTime_Tow1MSec); + + return passed; + } + +/** Create the module information depending on module id(i'e either agps_manager or network location manager) + Fills a module info class/structure with values depending on the module id. + + @param aModuleId module id within the ini file + @param aModInfo The modified module info structure. +*/ +EXPORT_C void T_LbsUtils::Create_ModuleInfoL(TPositionModuleId aModuleId, TPositionModuleInfo& aModInfo) + + { + TPositionQuality posQuality; + + // Use these values if the module is a-gps manager + if (aModuleId == (TUid::Uid(APGS_MODINFO_MODULE_ID))) + { + aModInfo.SetModuleId(TUid::Uid(APGS_MODINFO_MODULE_ID)); + aModInfo.SetIsAvailable(AGPS_MODINFO_IS_AVAILABLE); + aModInfo.SetModuleName(AGPS_MODINFO_MOD_NAME); + aModInfo.SetTechnologyType(AGPS_MODINFO_TECHNOLOGY_TYPE); + aModInfo.SetDeviceLocation(AGPS_MODINFO_DEVICE_LOCATION); + aModInfo.SetCapabilities(AGPS_MODINFO_CAPABILITIES); + + // Classes Supported - this is a binary bitmap, but support for each class + // has to be set individually. + + TInt supportedClasses = AGPS_MODINFO_CLASSES_SUPPORTED_POSITION_FAMILY; + TPositionClassFamily currentClass = EPositionInfoFamily; + while(currentClass <= EPositionUpdateOptionsFamily) + { + aModInfo.SetClassesSupported(currentClass, supportedClasses & 1); + supportedClasses >>= 1; + currentClass = static_cast(static_cast(currentClass) + 1); + } + + aModInfo.SetVersion(AGPS_MODINFO_VERSION); + posQuality.SetTimeToFirstFix(AGPS_MODINFO_TIME_TO_FIRST_FIX); + posQuality.SetTimeToNextFix(AGPS_MODINFO_TIME_TO_NEXT_FIX); + posQuality.SetHorizontalAccuracy(AGPS_MODINFO_HORIZONTAL_ACCURACY); + posQuality.SetVerticalAccuracy(AGPS_MODINFO_VERTICAL_ACCURACY); + posQuality.SetCostIndicator(AGPS_MODINFO_COST_INDICATOR); + posQuality.SetPowerConsumption(AGPS_MODINFO_POWER_CONSUMPTION); + aModInfo.SetPositionQuality(posQuality); + } + + //need to change after network location manager module is avaliable + //Use these values if the module is network location manager + else if(aModuleId ==(TUid::Uid(NETWORK_MODINFO_MODULE_ID))) + { + aModInfo.SetModuleId(TUid::Uid(NETWORK_MODINFO_MODULE_ID)); + aModInfo.SetIsAvailable(NETWORK_MODINFO_IS_AVAILABLE); + aModInfo.SetModuleName(NETWORK_MODINFO_MOD_NAME); + aModInfo.SetTechnologyType(NETWORK_MODINFO_TECHNOLOGY_TYPE); + aModInfo.SetDeviceLocation(NETWORK_MODINFO_DEVICE_LOCATION); + aModInfo.SetCapabilities(NETWORK_MODINFO_CAPABILITIES); + // Classes Supported - this is a binary bitmap, but support for each class + // has to be set individually. + + TInt supportedClasses = NETWORK_MODINFO_CLASSES_SUPPORTED_POSITION_FAMILY; + TPositionClassFamily currentClass = EPositionInfoFamily; + while(currentClass <= EPositionUpdateOptionsFamily) + { + aModInfo.SetClassesSupported(currentClass, supportedClasses & 1); + supportedClasses >>= 1; + currentClass = static_cast(static_cast(currentClass) + 1); + } + + aModInfo.SetVersion(NETWORK_MODINFO_VERSION); + posQuality.SetTimeToFirstFix(NETWORK_MODINFO_TIME_TO_FIRST_FIX); + posQuality.SetTimeToNextFix(NETWORK_MODINFO_TIME_TO_NEXT_FIX); + posQuality.SetHorizontalAccuracy(NETWORK_MODINFO_HORIZONTAL_ACCURACY); + posQuality.SetVerticalAccuracy(NETWORK_MODINFO_VERTICAL_ACCURACY); + posQuality.SetCostIndicator(NETWORK_MODINFO_COST_INDICATOR); + posQuality.SetPowerConsumption(NETWORK_MODINFO_POWER_CONSUMPTION); + aModInfo.SetPositionQuality(posQuality); + } + else + { + User::Leave(KErrArgument); + + } + } + +TInt T_LbsUtils::GetModIdByTechnology(RPositionServer& aServer, TPositionModuleInfo::TTechnologyType aTechnologyType, TPositionModuleId& aModuleId) +/** Searchs for a module which matches the required technology type. Once found the module id of the matched module + is given. The first module found which supports the technology will be returned. + +@param aServer A position server. A client must have a connection with the server. +@param aTechnologyType The technology to match. +@param aModuleId The returned module id of the module which supports the required technology. +@return Err code: KErrNone it module found. + KErrNotFound if no module is found which matches the required technology. + Any other system errors. +*/ +{ + TInt err; + TUint numMods; + + err = aServer.GetNumModules(numMods); + if (KErrNone == err) + { + TInt i = 0; + TPositionModuleInfo modInfo; + + // Look at each module until we find the required technology type. + while (i < numMods) + { + err = aServer.GetModuleInfoByIndex(i, modInfo); + + // Found it. + if (modInfo.TechnologyType() == aTechnologyType) + { + aModuleId = modInfo.ModuleId(); + + return err; + } + i++; + } + } + + else + { + return err; + } + + return KErrNotFound; +} + + +/** + * Method for comparing base class member variables in Logevent types + */ +TBool T_LbsUtils::Compare_LogBase(const CLbsLogEvent& aLogEventSideA, const CLbsLogEvent& aLogEventSideB) +{ + if(aLogEventSideA.Direction() != aLogEventSideB.Direction()) + return EFalse; + + if(aLogEventSideA.EventType() != aLogEventSideB.EventType()) + return EFalse; + + if(aLogEventSideA.RequestOutcome() != aLogEventSideB.RequestOutcome()) + return EFalse; + + if(aLogEventSideA.IsCostInformationAvailable() != aLogEventSideB.IsCostInformationAvailable()) + return EFalse; + else + { + //check cost info for each side + if(aLogEventSideA.CostInformation() != aLogEventSideB.CostInformation()) + return EFalse; + } + + TPositionInfoBase* sideAPosInfo = reinterpret_cast(aLogEventSideA.PositionInfo()); + TPositionInfoBase* sideBPosInfo = reinterpret_cast(aLogEventSideB.PositionInfo()); + if(sideAPosInfo != NULL) + { + // If the actual log has a non-NULL posinfo... + if((*aLogEventSideA.PositionInfo()).ModuleId() != (*aLogEventSideB.PositionInfo()).ModuleId()) + return EFalse; + + if(!Compare_PosInfo(*aLogEventSideA.PositionInfo(), *aLogEventSideB.PositionInfo())) + return EFalse; + } + else + { + // else cheach that both sides have NULL + if(!(sideAPosInfo == NULL && sideBPosInfo == NULL)) + return EFalse; + } + + + +return ETrue; +} +/** + * Method for comparing SelfLocateLog + */ +EXPORT_C TBool T_LbsUtils::Compare_SelfLocateLog(const CLbsSelfLocateLogEvent& aSelfLocateLogSideA, const CLbsSelfLocateLogEvent& aSelfLocateLogSideB) +{ + //Compare base class member variables + if(!Compare_LogBase(aSelfLocateLogSideA, aSelfLocateLogSideB)) + return EFalse; + + if(aSelfLocateLogSideA.LocalApp() != aSelfLocateLogSideB.LocalApp()) + return EFalse; + + return ETrue; +} + +/** + * Method for comparing NetworkLocateLog + */ +EXPORT_C TBool T_LbsUtils::Compare_NetworkLocateLog(const CLbsNetworkLocateLogEvent& aNetworkLocateLogSideA, const CLbsNetworkLocateLogEvent& aNetworkLocateLogSideB) +{ + //Compare base class member variables + if(!Compare_LogBase(aNetworkLocateLogSideA, aNetworkLocateLogSideB)) + return EFalse; + + if(aNetworkLocateLogSideA.LocalApp() != aNetworkLocateLogSideB.LocalApp()) + return EFalse; + + return ETrue; +} + +/** + * Method for comparing ExternalLocateLog + */ +EXPORT_C TBool T_LbsUtils::Compare_ExternalLocateLog(const CLbsExternalLocateLogEvent& aExternalLocateLogSideA, const CLbsExternalLocateLogEvent& aExternalLocateLogSideB) +{ + //Compare base class member variables + if(!Compare_LogBase(aExternalLocateLogSideA, aExternalLocateLogSideB)) + return EFalse; + + if(!Compare_PosInfo(*aExternalLocateLogSideA.ReferenceLocation(), *aExternalLocateLogSideB.ReferenceLocation())) + return EFalse; + + if(aExternalLocateLogSideA.RequestOriginator() != aExternalLocateLogSideB.RequestOriginator()) + return EFalse; + + if(!Compare_ExternalRequestPrivacyRequestParams(aExternalLocateLogSideA.PrivacyRequestParams(), aExternalLocateLogSideB.PrivacyRequestParams())) + return EFalse; + + if(!Compare_ExternalRequestPrivacyResponseParams(aExternalLocateLogSideA.PrivacyResponseParams(), aExternalLocateLogSideB.PrivacyResponseParams())) + return EFalse; + +return ETrue; +} + + + +/** + * Method for comparing X3PLog + */ +EXPORT_C TBool T_LbsUtils::Compare_TransmitLocationLog(const CLbsTransmitLocationLogEvent& aX3PLogSideA, const CLbsTransmitLocationLogEvent& aX3PLogSideB) +{ + //Compare base class member variables + if(!Compare_LogBase(aX3PLogSideA, aX3PLogSideB)) + return EFalse; + + if(aX3PLogSideA.X3PApp() != aX3PLogSideB.X3PApp()) + return EFalse; + + if(!Compare_Destinations(aX3PLogSideA.Destination(), aX3PLogSideB.Destination())) + return EFalse; + + return ETrue; +} + + +/** + * Method for comparing AssistanceDataLog + */ +EXPORT_C TBool T_LbsUtils::Compare_AssistanceDataLog(const CLbsAssistanceDataLogEvent& aAssistanceDataLogSideA, const CLbsAssistanceDataLogEvent& aAssistanceDataLogSideB) +{ + //Compare base class member variables + if(!Compare_LogBase(aAssistanceDataLogSideA, aAssistanceDataLogSideB)) + return EFalse; + + if(aAssistanceDataLogSideA.RequestAssistanceDataType() != aAssistanceDataLogSideB.RequestAssistanceDataType()) + return EFalse; + + + if(aAssistanceDataLogSideA.ReceiveAssistanceDataType() != aAssistanceDataLogSideB.ReceiveAssistanceDataType()) + return EFalse; + + return ETrue; +} + + +/** + * Method needed to compare external locate logs. + */ +TBool T_LbsUtils::Compare_ExternalRequestPrivacyRequestParams(const TLbsLoggingPrivacyRequestParams& aLogPrivacyRequestParamsSideA, const TLbsLoggingPrivacyRequestParams& aLogPrivacyRequestParamsSideB) +{ + if(aLogPrivacyRequestParamsSideA.iSessionId != aLogPrivacyRequestParamsSideB.iSessionId) + return EFalse; + + if(!Compare_ExternalRequestInfo(aLogPrivacyRequestParamsSideA.iRequestInfo, aLogPrivacyRequestParamsSideB.iRequestInfo)) + return EFalse; + + if(!Compare_ExternalRequestPrivacy(aLogPrivacyRequestParamsSideA.iRequestPrivacy, aLogPrivacyRequestParamsSideB.iRequestPrivacy)) + return EFalse; + + + + return ETrue; +} + + +/** + * Method needed to compare external locate logs. + * Compares TLbsExternalRequestInfo class. + */ +TBool T_LbsUtils::Compare_ExternalRequestInfo(const TLbsExternalRequestInfo& aExternalRequestInfoSideA, const TLbsExternalRequestInfo& aExternalRequestInfoSideB) +{ + TLbsRequesterId requesterIdSideA, requesterIdSideB; + TLbsClientName clientNameSideA, clientNameSideB; + TLbsClientExternalId clientExternalIdSideA, clientExternalIdSideB; + + aExternalRequestInfoSideA.GetRequesterId(requesterIdSideA); + aExternalRequestInfoSideA.GetClientName(clientNameSideA); + aExternalRequestInfoSideA.GetClientExternalId(clientExternalIdSideA); + + aExternalRequestInfoSideB.GetRequesterId(requesterIdSideB); + aExternalRequestInfoSideB.GetClientName(clientNameSideB); + aExternalRequestInfoSideB.GetClientExternalId(clientExternalIdSideB); + + // If these values are different, then return false + if(requesterIdSideA.Compare(requesterIdSideB)) // Should return 0 if equal + return EFalse; + + if(clientNameSideA.Compare(clientNameSideB)) + return EFalse; + + if(clientExternalIdSideA.Compare(clientExternalIdSideB)) + return EFalse; + + + return ETrue; +} + + +/** + * Method needed to compare external locate logs. + * Compares TLbsNetPosRequestPrivacy class. + */ +TBool T_LbsUtils::Compare_ExternalRequestPrivacy(const TLbsNetPosRequestPrivacy& aExternalRequestPrivacySideA, const TLbsNetPosRequestPrivacy& aExternalRequestPrivacySideB) +{ + if(aExternalRequestPrivacySideA.RequestAdvice() != aExternalRequestPrivacySideB.RequestAdvice()) + return EFalse; + + if(aExternalRequestPrivacySideA.RequestAction() != aExternalRequestPrivacySideB.RequestAction()) + return EFalse; + + return ETrue; +} + + +/** + * Method needed to compare external locate logs. + * Compares TPrivacyResponseParams class. + */ +TBool T_LbsUtils::Compare_ExternalRequestPrivacyResponseParams(const TLbsLoggingPrivacyResponseParams& aExternalRequestPrivacyResponseSideA, const TLbsLoggingPrivacyResponseParams& aExternalRequestPrivacyResponseSideB) +{ + if(aExternalRequestPrivacyResponseSideA.iSessionId != aExternalRequestPrivacyResponseSideB.iSessionId) + return EFalse; + + if(aExternalRequestPrivacyResponseSideA.iResult != aExternalRequestPrivacyResponseSideB.iResult) + return EFalse; + + return ETrue; +} + +/** + * Method needed to Transmit to 3rd party destinations + * Compares TDesC16. + */ +TBool T_LbsUtils::Compare_Destinations(TDesC16& aDestinationFromRealLog, TDesC16& aDestinationFromExpectedLog) + { + if(aDestinationFromRealLog != aDestinationFromExpectedLog) + return EFalse; + + return ETrue; + } +