Revision: 201027 RCL_3 PDK_3.0.3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 15 Sep 2010 00:02:22 +0300
branchRCL_3
changeset 58 87622fad6b51
parent 55 c92d4f3c47c5
child 65 a796fdeeb33c
Revision: 201027 Kit: 201035
lbstest/lbstestproduct/common/testdata/lbstestconfig.txt
lbstest/lbstestproduct/lbsclient/group/bld.inf
lbstest/lbstestproduct/lbsclient/scripts/lbsclientlastknownposarea.script
lbstest/lbstestproduct/lbsclient/src/ctlbsclientsteplastknownposarea.cpp
lbstest/lbstestproduct/lbsclient/testdata/lbsclientlastknownposarea.ini
lbstest/lbstestproduct/lbsclient/testdata/lbsclientlastknownposarea0003.txt
lbstest/lbstestproduct/lbsclient/testdata/lbsclientlastknownposarea0009.txt
lbstest/lbstestproduct/tdxml/LbsSuite/LbsIntegrationSuite/LbsClientSuite/lbsclientlastknownposarea.xml
locationmgmt/locmonitor/lbslocmonitorapis/ConversionDataTypes/BWINS/lbslocationinfodatatypesu.def
locationmgmt/locmonitor/lbslocmonitorapis/ConversionDataTypes/EABI/lbslocationinfodatatypesu.def
locationmgmt/locmonitor/lbslocmonitorapis/ConversionDataTypes/inc/lbslocationwcdmainfo.h
locationmgmt/locmonitor/lbslocmonitorapis/ConversionDataTypes/src/lbslocationwcdmainfo.cpp
locationmgmt/locmonitor/lbslocmonitorserver/inc/clbslocmonitordbengine.h
locationmgmt/locmonitor/lbslocmonitorserver/inc/lbslocmonitorareainfodefs.h
locationmgmt/locmonitor/lbslocmonitorserver/inc/lbslocmonitordbenginedefs.h
locationmgmt/locmonitor/lbslocmonitorserver/src/clbslocmonitorconversionhandler.cpp
locationmgmt/locmonitor/lbslocmonitorserver/src/clbslocmonitordbengine.cpp
locationmgmt/locmonitor/lbslocmonitorserver/src/clbslocmonitornetworkinfofinder.cpp
locationmgmt/locmonitor/lbslocmonitorserver/src/clbslocmonitorrequesthandler.cpp
locationmgmt/locmonitor/lbslocmonitorserver/src/lbslocmonitorareainfodefs.cpp
locationmgmt/locmonitor/lbslocmonitorserver/src/rlbslocmonitordb.cpp
locationmgmt/locmonitor/test/ExampleLocationConverter/src/ExampleLocationConverter.cpp
locationmgmt/locmonitor/test/te_geolocmonitorsuite/src/te_geolocmonitorstep5.cpp
locationmgmt/locmonitor/test/te_lbslocationinforconvertertef/inc/step.h
locationmgmt/locmonitor/test/te_lbslocationinforconvertertef/scripts/LbsLocationInfoConverter.ini
locationmgmt/locmonitor/test/te_lbslocationinforconvertertef/scripts/te_LbsLocationInfoConverterSuite.script
locationmgmt/locmonitor/test/te_lbslocationinforconvertertef/src/step.cpp
locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/inc/dbstep.h
locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/scripts/te_LbsLocationMonitorDbSuite.script
locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/scripts/te_LbsLocationMonitorDbSuite2.script
locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/clearstep.cpp
locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/dbstep.cpp
locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/negativestep.cpp
locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/persistencestep.cpp
locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/replacestep.cpp
locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/timestampstep.cpp
locationmgmt/locmonitor/test/testlocationmonitor/inc/lbslocmonitorareainfodefs.h
locationrequestmgmt/locationserver/test/te_locsrv/testdata/te_locsrv_testconfig.txt
--- a/lbstest/lbstestproduct/common/testdata/lbstestconfig.txt	Wed Sep 01 12:35:25 2010 +0100
+++ b/lbstest/lbstestproduct/common/testdata/lbstestconfig.txt	Wed Sep 15 00:02:22 2010 +0300
@@ -15,16 +15,28 @@
 SubscriberId= 56789012345678
 
 # Current Network Name
-
-NetworkInfo= ABCD, Network0, Vodafone, Voda, Vodafone_UK, 2
+# Note that network type 2 is GSM, network type 6 is CDMA.
+# NetworkInfo= <CountryCode>, <NetworkId>, <DisplayTag>, <NetworkShortName>, <NetworkLongName> , <NetworkAccess> <Network Type>"
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,          0,                   2
 
 # Network Registration Status
+# duration of 0 => does not change
 #RegStatus= <Duration>, <RegStatus>, <NetworkIndex>
- 
-RegStatus= 0,5,0 
+RegStatus=     0,           5,                0 
+
+# LocationArea = <AreaKnown>, <LocationAreaCode>, <CellId> . Where <AreaKnown> is -1 for true and 0 for false?! 
+LocationArea =    -1,          1911,              65530
 
 # ONStore= <max number of entries>, <max size of telephone number>, <max text length>
 ONStore= 5, 50, 60
-# ONStoreEntry= <index>, <telephone number>, <TMobileTON type of number>, <TMobileService service type>, <Number Plan>, <name>
-ONStoreEntry= 1, 07747012341, 2, 0, 8, OwnNumber1
+
+# ONStoreEntry= <index>, <telephone number>, <TMobileTON type of number>, <TMobileService service type>, <Number Plan>,   <name>
+ONStoreEntry=       1,        07747012341,        2,                              0,                           8,        OwnNumber1
 
+# <Timeout> is time in sec while this status is valid. The last record lasts until shutdown.
+# <NetworkMode> - the set here has no effect. Please use NetworkInfo records instead.
+# <CellId> set here applies only to GetCellInfo/NotifyCellInfoChanges calls, which are not used. 
+# for getting CellId by our code. We use LocationArea records and GetCurrentNetwork/NotifyCurrentNetworkChange instead.
+# <CellInfoStatus> - The status of cell info. Look at TCellInfoStatus for the list of values.
+# CellInfo = <Timeout>, <NetworkMode>, <CellId>, <TimingAdvance>, <CellInfoStatus> .
+CellInfo =    0,         2,             0,        0,               2
--- a/lbstest/lbstestproduct/lbsclient/group/bld.inf	Wed Sep 01 12:35:25 2010 +0100
+++ b/lbstest/lbstestproduct/lbsclient/group/bld.inf	Wed Sep 15 00:02:22 2010 +0300
@@ -82,6 +82,7 @@
 ../testdata/lbsclientlastknownposareacommon.txt	c:/testdata/configs/lbsclientlastknownposareacommon.txt
 ../testdata/lbsclientlastknownposarea0001.txt	c:/testdata/configs/lbsclientlastknownposarea0001.txt
 ../testdata/lbsclientlastknownposarea0003.txt	c:/testdata/configs/lbsclientlastknownposarea0003.txt
+../testdata/lbsclientlastknownposarea0009.txt	c:/testdata/configs/lbsclientlastknownposarea0009.txt
 ../testdata/lbsclientlastknownposareasources.txt	c:/testdata/configs/lbsclientlastknownposareasources.txt
 
 
--- a/lbstest/lbstestproduct/lbsclient/scripts/lbsclientlastknownposarea.script	Wed Sep 01 12:35:25 2010 +0100
+++ b/lbstest/lbstestproduct/lbsclient/scripts/lbsclientlastknownposarea.script	Wed Sep 15 00:02:22 2010 +0300
@@ -112,11 +112,22 @@
 //! @SYMTestCaseID              LBS-Client-LastKnownPosArea-0003
 //! @SYMTestCaseDesc            verify that the last position is returned if current network position is unavailable
 //! @SYMTestPriority            Medium
-//! @SYMTestActions             1. Set up SIM TSY so that the cell id is unknown
+//! @SYMTestActions             1. Set up SIM TSY so that the cell area is unknown
 //!                             2. NPUD
-//!                             3. LastKnown Pos Area
-//!                             7. Clear Database
-//! @SYMTestExpectedResults     Step 3: Lastknown Pos Area should return position from 2, with match level unknown
+//!                             3. LastKnown Pos Area, to check position with invalid area params didn't go into database
+//!                             4. Move to GSM cell 234.15.1911.36463 (all valid) and do a NPUD
+//!								5. Do LastKnownPosArea and check match level
+//!                             6. Move to 'invalid' WCDMA cell 234.15.1911.36463 and do lastknown pos area
+//!                             7. Move to invalid GSM cell of 234.15.1911.90000 and do lastknown pos area
+//!                             8. Move to valid GSM cell of 234.15.1911.36000 and do lastknown pos area 
+//!                             9. Clear Database
+//! @SYMTestExpectedResults     Generally all methods should return KErrNone unless stated otherwise. Note the following:
+//!								Step 3: Lastknown Pos Area should return KErrUnknown
+//!                             Step 5: Lastknown Pos Area should return position from 4, with match level EAreaCity
+//!                             Step 6: Lastknown Pos Area should return position from 4, with match level EAreaCountry (match country and network)
+//!                             Step 7: Lastknown Pos Area should return position from 4, with match level EAreaUknown
+//!								Step 8: LastKnown Pos Area shoulr return position from 4, with match level EAreaRegion (match on all except cell)
+
 //! @SYMTestType                CIT
 //! @SYMCreationDate            13/2/2009
 //! @SymTestReq	REQ11527
@@ -274,6 +285,55 @@
 END_TESTCASE                  LBS-Client-LastKnownPosArea-0008
 
 
+DELAY 5000
+
+START_TESTCASE                LBS-Client-LastKnownPosArea-0009
+//! @SYMTestCaseID              LBS-Client-LastKnownPosArea-0009
+//! @SYMTestCaseDesc            With both GSM and WCDMA positions in the database, we check that GetLastKnownPosArea returns the correct 
+//!                             position and match level as we switch between GSM and WCDMA cells.
+//! @SYMTestPriority            Medium
+//! @SYMTestActions             1.  NPUD at 234.15.1911.65535 (GSM)
+//!                             2.  NPUD at 234.15.1913.65536 (WCDMA)
+//!                             3.  LastKnownPosInfo without change of cell
+//!                             4.  LastknownPosArea at 234.15.1913.32121
+//!                             5.  LastKnownPosArea at 234.15.1911.88880
+//!                             6.  LastKnownPosArea at 234.15.1913.76554
+//!                             7.  LastKnownPosArea at 234.15.1911.19980
+//!                             8.  LastKnownPosArea at 234.30.1511.66003
+//!                             9.  NPUD at 234.15.1911.100
+//!                             10. LastKnownPosArea at 234.15.1911.88880
+//!                             11. Clear Database
+//!
+//! @SYMTestExpectedResults     for LbsClientStep_LastKnownPosArea step
+//!                             1.  Completes successfully
+//!                             2.  Completes successfully
+//!								3.  WCDMA position with EAreaCity (all area fields match)
+//!                             4.  Get WCDMA position, accuracy EAreaCountry
+//!                             5.  Get WCDMA position, accuracy EAreaCountry
+//!                             6.  Get WCDMA position, accuracy EAreaRegion
+//!								7.  Get GSM position, accuracy EAreaRegion
+//!								8.  Get WCDMA position, accuracy EAreaCountry
+//!                             9.  Completes Sucessfully
+//!                             10. Gets GSM position with EAreaCountry.
+//!                             11. Completes successfully 
+//!
+//! @SYMTestType                CIT
+//! @SYMCreationDate            12/10/2010
+//! @SYMAuthor                  ajw
+RUN_UTILS CopyFile c:\testdata\configs\lbsclientlastknownposarea0009.txt c:\config.txt
+RUN_TEST_STEP 010 LbsClientTestServer LbsStep_StartLbs
+RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetAutonomousMode
+RUN_TEST_STEP 010 LbsClientTestServer LbsStep_InstallScheduler
+RUN_TEST_STEP 020 LbsClientTestServer LbsStep_SetUpPsy c:\testdata\configs\lbsclientlastknownposarea.ini LBS-Client-LastKnownPosArea
+RUN_TEST_STEP 020 LbsClientTestServer LbsStep_CreateVerifyPosInfos c:\testdata\configs\lbsclientlastknownposarea.ini LBS-Client-LastKnownPosArea-0009
+RUN_TEST_STEP 120 LbsClientTestServer LbsClientStep_LastKnownPosArea c:\testdata\configs\lbsclientlastknownposarea.ini LBS-Client-LastKnownPosArea-0009
+//RUN_TEST_STEP 010 LbsClientTestServer LbsStep_VerifyPosInfos
+RUN_TEST_STEP 010 LbsClientTestServer LbsStep_StopLbs
+END_TESTCASE                  LBS-Client-LastKnownPosArea-0009
+
+
+
+
 PREFIX RUN_UTILS
 	DeleteFile c:\config.txt
 REMOVE_PREFIX
--- a/lbstest/lbstestproduct/lbsclient/src/ctlbsclientsteplastknownposarea.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/lbstest/lbstestproduct/lbsclient/src/ctlbsclientsteplastknownposarea.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -98,6 +98,11 @@
  * 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.
+ * Here we will test the lastknownposarea call as we switch between a variety of network
+ * paremeters. All of these will be held in the config.txt file used by the Sim tsy.
+ * This file is overwritten by test steps as necessary. We set the KPSSimTsyTimersReduceTime
+ * property to initiate a change.in the network parameters.
+ * 
  */
 TVerdict CT_LbsClientStep_LastKnownPosArea::doTestStepL()
 	{
@@ -265,29 +270,70 @@
 				// Verify that the last position is returned if current network position is unavailable
 				case 3:
 					{
+					// The SIM config file used by this test switches between valid and non-valid area configs.
+					// If we move from a valid config to an invalid config,	GetLastKnownPositionArea should return
+					// with the last stored position (posInfo) together with area information that shows the
+                    // area accuracy to be TPositionAreaInfo::EAreaUnknown.
+
 					TPositionInfo* posInfo = new(ELeave) TPositionInfo();
 					posInfoArr.Append(posInfo);
 					TInt err = KErrNone;
 					
-					// The SIM config file used by this test contains an
-					// invalid global cell-id (LAC is zero). A transition to
-					// a new valid cell is not provoked by this test. Therefore
-					// the Location Monitor never gets to know a valid cell in this test.
+	                // Empty Database					
+                    TRequestStatus emptyStatus;
+                    iServer.EmptyLastKnownPositionStore(emptyStatus);
+                    User::WaitForRequest(emptyStatus);
+					
+					// Whilst the area is not known, request a position. This shouldn't go into the database.
+					// Therefore a subsequent getlastknownposarea will return KErrUnknown
+					INFO_PRINTF1(_L("Check invalid positions don't go into the database"));
 
-					// Request a position so that the position goes into the database
 					err = DoNotifyUpdateL(*posInfo);
 					if (KErrNone != err)
 						{
 						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
 						SetTestStepResult(EFail);
 						}
+                    
+					TPositionInfo posInfo2;
+					TPositionAreaExtendedInfo matchLevel;
+					err = DoLastKnownPosAreaL(posInfo2, matchLevel);
+					if (KErrUnknown != err)
+						{
+						ERR_PRINTF2(_L("Expected KErrUnknown, incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}
 
-					// Since the Location Monitor never received a valid value of
-					// GCI, the call to GetLastKnownPositionArea should return 
-					// the last stored position (posInfo) together with area information
-					// that shows the "rough area accuracy" to be TPositionAreaInfo::EAreaUnknown.
-					TPositionInfo posInfo2;
-					TPositionAreaExtendedInfo matchLevel, expectedMatchLevel;
+					//1. Move to GSM cell 234.15.1911.36463 - all valid
+					err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers);
+					User::After(KSimTsyTransitionDelay);
+						
+					// Request a position so that the position goes into the database 
+					// then call GetLastKnownPosArea and check everything now matches.
+					INFO_PRINTF1(_L("Check that we get EAreaCity once a position is available"));
+					err = DoNotifyUpdateL(*posInfo);
+					if (KErrNone != err)
+						{
+						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}
+					err = DoLastKnownPosAreaL(posInfo2, matchLevel);
+					if (KErrNone != err)
+						{
+						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}
+					Validate(*posInfo, posInfo2, matchLevel, TPositionAreaInfo::EAreaCity, ETrue, ETrue, ETrue, ETrue);
+
+					// Next error condition, WCDMA network and cell id is too low...
+					INFO_PRINTF1(_L("Check that invalid current WCDMA cell id is accepted and we get EAreaCountry match"));
+
+					//1. Move to WCDMA cell 234.15.1911.36463 - the WCDMA spec expects a non-zero
+					//   RNC ID which implies the cell id should be greater than 0x10000. However,
+					//   certain networks break the rule, so check this 'illegal' cell id accepted. 
+					err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers);
+					User::After(KSimTsyTransitionDelay);
+
 					err = DoLastKnownPosAreaL(posInfo2, matchLevel);
 					if (KErrNone != err)
 						{
@@ -295,13 +341,44 @@
 						SetTestStepResult(EFail);
 						}
 						
-					// Verify that the position received in the call to GLKPA is the last known position
-					// due to the NPUD and also that the accuracy is set to TPositionAreaInfo::EAreaUnknown
-					// (in this case the rest of boolean values passed in Validate() are irrelevant).
+					// Expect EAreaCountry. The current 'broken' cell position should have been accepted
+					// and we match on country and network code (but not LAC as earlier one was GSM LAC!).
+					Validate(*posInfo, posInfo2, matchLevel, TPositionAreaInfo::EAreaCountry, ETrue, ETrue, EFalse, EFalse);
+
+					// Next error condition, GSM network with too high a cell id. In this case, the cell will
+					// have been rejected and effectively we are unregistered, so EAreaUnknown is correct.
+					INFO_PRINTF1(_L("Check that invalid GSM cell id is identified and we get EAreaUnknown returned"));
+
+					//1. Move to GSM cell 234.15.1911.90000 - 90000 is too high a cell id for GSM
+					err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers);
+					User::After(KSimTsyTransitionDelay);
+
+					err = DoLastKnownPosAreaL(posInfo2, matchLevel);
+					if (KErrNone != err)
+						{
+						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}						
+                    // As current position information is broken, expect area EAreaUknown etc.
 					Validate(*posInfo, posInfo2, matchLevel, TPositionAreaInfo::EAreaUnknown, EFalse, EFalse, EFalse, EFalse);
 					
+					// Go back to a valid cell, differing only in the cell-id, check that the 
+					//correct accuracy is returned.
+					INFO_PRINTF1(_L("Valid GSM area, only cell id varies from earlier location, so should return EAreaRegion"));
+					
+                    //1. Move to GSM cell 234.15.1911.36000 
+                    err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers);
+                    User::After(KSimTsyTransitionDelay);
+
+                    err = DoLastKnownPosAreaL(posInfo2, matchLevel);
+                    if (KErrNone != err)
+                        {
+                        ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+                        SetTestStepResult(EFail);
+                        }                    
+                    Validate(*posInfo, posInfo2, matchLevel, TPositionAreaInfo::EAreaRegion, ETrue, ETrue, ETrue, EFalse);
+                                        
 					//7. Clear Database
-					TRequestStatus emptyStatus;
 					iServer.EmptyLastKnownPositionStore(emptyStatus);
 					User::WaitForRequest(emptyStatus);
 					break;
@@ -533,6 +610,194 @@
 					User::WaitForRequest(emptyStatus);
 					break;
 					}
+				case 9:
+					{
+					// Here we have both GSM and WCDMA positions in the database and we check that GetLastKnownPosArea returns the correct
+					// position and match level as we switch between GSM and WCDMA cells.
+
+					// Empty Database
+					TRequestStatus emptyStatus;
+					iServer.EmptyLastKnownPositionStore(emptyStatus);
+					User::WaitForRequest(emptyStatus);
+
+					TPositionInfo lastKnownPosInfo;
+					TPositionAreaExtendedInfo matchLevel;
+
+					//1. Get a position in the database.for a GSM cell of 234.15.1911.65535. Note that
+					//this is the highest possible GSM cell id)
+					INFO_PRINTF1(_L("Get a position in the database.for a GSM cell of 234.15.1911.65535"));
+	                TPositionInfo* gsmPosInfo = new(ELeave) TPositionInfo();
+	                posInfoArr.Append(gsmPosInfo);
+					err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers);
+					User::After(KSimTsyTransitionDelay);
+					if (KErrNone == err)
+						{
+						err = DoNotifyUpdateL(*gsmPosInfo);
+						}
+					if (KErrNone != err)
+						{
+						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}
+
+					//2. Move to WCDMA cell 234.15.1913.65536 (lowest possible WCDMA cell id) and get this in the database
+                    TPositionInfo* wcdmaPosInfo = new(ELeave) TPositionInfo();
+                    posInfoArr.Append(wcdmaPosInfo);
+					INFO_PRINTF1(_L("Move to WCDMA cell 234.15.1913.65536 and get this in the database"));
+					err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers);
+					User::After(KSimTsyTransitionDelay);
+
+					//2. NPUD
+					if (KErrNone == err)
+						{
+						err = DoNotifyUpdateL(*wcdmaPosInfo);
+						}
+					if (KErrNone != err)
+						{
+						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}
+
+					// Check that GetLastKnownPosArea returns the WCDMA position with area as TPositionAreaInfo::EAreaCity.
+                    INFO_PRINTF1(_L("check GetLastKnownPosArea returns WCDMA position - all area fields matching"));					
+					err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel);
+					if (KErrNone != err)
+						{
+						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}
+					Validate(*wcdmaPosInfo, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaCity, ETrue, ETrue, ETrue, ETrue);
+
+
+					// Move to GSM cell 234.15.1913.32121 and check GetLastKnownPosArea returns the WCDMA 
+					// position (as it is the most recent) with area as TPositionAreaInfo::EAreaCountry
+					INFO_PRINTF1(_L("Move to GSM cell 234.15.1913.32121 and check GetLastKnownPosArea returns the WCDMA position"));
+					err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers);
+					User::After(KSimTsyTransitionDelay);
+
+					if (KErrNone == err)
+						{
+						err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel);
+						}
+					if (KErrNone != err)
+						{
+						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}
+					Validate(*wcdmaPosInfo, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaCountry, ETrue, ETrue,
+							EFalse, EFalse);
+
+					// Move to WDCMA cell 234.15.1911.88880 and check GetLastKnownPosArea returns the WDCMA position
+					// (as it is the most recent) with area as TPositionAreaInfo::EAreaCountry.
+					INFO_PRINTF1(_L("Move to WDCMA cell 234.15.1911.88880 and check GetLastKnownPosArea returns the WDCMA position"));
+					err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers);
+					User::After(KSimTsyTransitionDelay);
+					if (KErrNone == err)
+						{
+						err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel);
+						}
+					if (KErrNone != err)
+						{
+						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}
+					Validate(*wcdmaPosInfo, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaCountry, ETrue, ETrue,
+							EFalse, EFalse);
+
+					// Move to WDCMA cell 234.15.1913.76554 and check GetLastKnownPosArea returns the WDCMA position
+					// (since it matches with most fields) with area as TPositionAreaInfo::EAreaRegion. 
+					INFO_PRINTF1(_L("Move to WDCMA cell 234.15.1913.76554 and check GetLastKnownPosArea returns the WDCMA position"));
+					err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers);
+					User::After(KSimTsyTransitionDelay);
+					if (KErrNone == err)
+						{
+						err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel);
+						}
+					if (KErrNone != err)
+						{
+						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}
+					Validate(*wcdmaPosInfo, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaRegion, ETrue, ETrue,
+							ETrue, EFalse);
+
+
+					// Move to GSM cell 234.15.1911.19980 and check GetLastKnownPosArea returns the GSM position
+					// (since it matches on most fields) with area as TPositionAreaInfo::EAreaRegion. 
+					INFO_PRINTF1(_L("Move to GSM cell 234.15.1911.19980 and check GetLastKnownPosArea returns the GSM position"));
+					err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers);
+					User::After(KSimTsyTransitionDelay);
+					if (KErrNone == err)
+						{
+						err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel);
+						}
+					if (KErrNone != err)
+						{
+						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}
+					Validate(*gsmPosInfo, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaRegion, ETrue, ETrue,
+							ETrue, EFalse);
+
+					// Move to an ENetworkModeTdcdma cell 234.15.1911.66003 on a different  network and check GetLastKnownPosArea
+					// returns the WCDMA position (the most recent matching on 'Country') with area as TPositionAreaInfo::EAreaCountry. 
+					INFO_PRINTF1(_L("Move to an ENetworkModeTdcdma cell 234.15.1911.66003 on a different network"));
+					err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers);
+					User::After(KSimTsyTransitionDelay);
+					if (KErrNone == err)
+						{
+						err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel);
+						}
+					if (KErrNone != err)
+						{
+						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}
+					Validate(*wcdmaPosInfo, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaCountry, ETrue, EFalse,
+							EFalse, EFalse);
+
+					//1. Now get a position in the database.for a GSM cell of 234.15.1911.100. 
+					INFO_PRINTF1(_L("Now get a position in the database.for a GSM cell of 234.15.1911.100"));
+                    TPositionInfo* gsmPosInfo2 = new(ELeave) TPositionInfo();
+                    posInfoArr.Append(gsmPosInfo2);
+
+					err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers);
+					User::After(KSimTsyTransitionDelay);
+					if (KErrNone == err)
+						{
+						err = DoNotifyUpdateL(*gsmPosInfo2);
+						}
+					if (KErrNone != err)
+						{
+						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}
+
+					// Move to WDCMA cell 234.15.1911.88880 and check GetLastKnownPosArea returns the most recent
+					// GSM position with area as TPositionAreaInfo::EAreaCountry.
+					INFO_PRINTF1(_L("Move to WDCMA cell 234.15.1911.88880, check GetLastKnownPosArea returns recent GSM position"));
+					err = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, KReduceSimTsyTimers);
+					User::After(KSimTsyTransitionDelay);
+					if (KErrNone == err)
+						{
+						err = DoLastKnownPosAreaL(lastKnownPosInfo, matchLevel);
+						}
+					if (KErrNone != err)
+						{
+						ERR_PRINTF2(_L("Incorrect err %d returned"), err);
+						SetTestStepResult(EFail);
+						}
+					Validate(*gsmPosInfo2, lastKnownPosInfo, matchLevel, TPositionAreaInfo::EAreaCountry, ETrue, ETrue,
+							EFalse, EFalse);
+
+					//7. Clear Database
+					iServer.EmptyLastKnownPositionStore(emptyStatus);
+					User::WaitForRequest(emptyStatus);
+					break;
+
+					}
+
+
 				default:
 					User::Panic(KLbsClientStepLastKnownPosArea, KErrUnknown);					
     		    }
@@ -564,7 +829,8 @@
 		{
 		if (aActualArea.Area() != TPositionAreaInfo::EAreaUnknown)
 			{
-			ERR_PRINTF1(_L("Incorrect area reported when EAreaUnknown was expected"));	
+			ERR_PRINTF2(_L("Incorrect area of %d reported when EAreaUnknown was expected"), aActualArea.Area());	
+			SetTestStepResult(EFail);
 			}
 		}
 
--- a/lbstest/lbstestproduct/lbsclient/testdata/lbsclientlastknownposarea.ini	Wed Sep 01 12:35:25 2010 +0100
+++ b/lbstest/lbstestproduct/lbsclient/testdata/lbsclientlastknownposarea.ini	Wed Sep 15 00:02:22 2010 +0300
@@ -51,3 +51,11 @@
 $position,1,52.2,0.2,10,0,100,100*
 $position,1,50.0,0.5,10,0,100,100*
 type / repeat / lat / long / alt / dat / H / V /...
+
+[LBS-Client-LastKnownPosArea-0009]
+tc_id=9
+pos_infos_file=c:\testdata\configs\lbsclientlastknownposarea.ini
+$position,1,52.2,0.2,10,0,100,100*
+$position,1,50.2,0.4,10,0,101,101*
+$position,1,50.6,0.5,10,0,105,103*
+type / repeat / lat / long / alt / dat / H / V /...
--- a/lbstest/lbstestproduct/lbsclient/testdata/lbsclientlastknownposarea0003.txt	Wed Sep 01 12:35:25 2010 +0100
+++ b/lbstest/lbstestproduct/lbsclient/testdata/lbsclientlastknownposarea0003.txt	Wed Sep 15 00:02:22 2010 +0300
@@ -5,13 +5,16 @@
 // sim.tsy config used for simulating only the network registration
 // status
 //
-//! @SYMTestActions             1. Move to cell 234.15.1911.36464
+//! @SYMTestActions             1. Set up SIM TSY so that the cell area is unknown
 //!                             2. NPUD
-//!                             3. Move to cell 234.15.1911.47622
-//!                             4. NPUD
-//!                             5. Move to cell unknown
-//!                             6. LastKnown Pos Area
-//!                             7. Clear Database
+//!                             3. LastKnown Pos Area
+//!                             4. Move to GSM cell 234.15.1911.36463 (all valid) and do a NPUD
+//!                             5. Do LastKnownPosArea and check match level
+//!                             6. Move to 'invalid' WCDMA cell 234.15.1911.36463 and do lastknown pos area
+//!                             7. Move to invalid GSM cell of 234.15.1911.90000 and do lastknown pos area
+//!                             8. Move to valid GSM cell of 234.15.1911.36000 and do lastknown pos area 
+//!                             9. Clear Database
+//!
 // Original name file: lbsclientlastknownposarea0003.txt
 
 [TEST0]
@@ -25,11 +28,13 @@
 
 # multiple
 # Current Network Name
-# NetworkInfo= <CountryCode>, <NetworkId>, <DisplayTag>, <NetworkShortName>, <NetworkLongName> , <NetworkAccess> "
-NetworkInfo = 0,              0,          Unknown,      UnKn,               Unknown_Network,    0
-NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,        0
-NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,        0
-NetworkInfo = 0,              0,          Unknown,      UnKn,               Unknown_Network,    0
+# Note that network type 2 is GSM, network type 6 is CDMA.
+# NetworkInfo= <CountryCode>, <NetworkId>, <DisplayTag>, <NetworkShortName>, <NetworkLongName> , <NetworkAccess> <Network Type>"
+NetworkInfo = 0,              0,          Unknown,      UnKn,               Unknown_Network,		0,                 2
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,	        0,                 2
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,                0,                 6
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,                0,                 2
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,                0,                 2
 
 
 # multiple
@@ -39,13 +44,15 @@
 RegStatus =    5000,       5,           1
 RegStatus =    5000,       5,           2
 RegStatus =    5000,       5,           3
+RegStatus =    5000,       5,           4
 
 
 # LocationArea = <AreaKnown>, <LocationAreaCode>, <CellId> . Where <AreaKnown> is -1 for true and 0 for false?! 
 LocationArea =    0,           0,                 0
 LocationArea =    -1,          1911,              36463
-LocationArea =    -1,          1911,              47622
-LocationArea =    0,           0,                 0
+LocationArea =    -1,          1911,              36463
+LocationArea =    -1,          1911,              90000
+LocationArea =    -1,          1911,              36000
 
 
 # ONStore= <max number of entries>, <max size of telephone number>, <max text length>
@@ -64,3 +71,4 @@
 CellInfo =    0,         2,             0,        0,               2
 CellInfo =    0,         2,             0,        0,               2
 CellInfo =    0,         2,             0,        0,               2
+CellInfo =    0,         2,             0,        0,               2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lbstest/lbstestproduct/lbsclient/testdata/lbsclientlastknownposarea0009.txt	Wed Sep 15 00:02:22 2010 +0300
@@ -0,0 +1,96 @@
+// lbsclientlastknownposarea0009.txt
+//
+// Copyright (c) 2009 Symbian Software Ltd.  All rights reserved.
+//
+// sim.tsy config used for simulating only the network registration
+// status
+//
+//! @SYMTestActions             1. NPUD at 234.15.1911.65535 (GSM)
+//!                             2. NPUD at 234.15.1913.65536 (WCDMA)
+//!                             3. LastKnownPosInfo without change of cell
+//!                             3. LastknownPosArea at 234.15.1913.32121
+//!                             4. LastKnownPosArea at 234.15.1911.88880
+//!                             5. LastKnownPosArea at 234.15.1913.76554
+//!                             6. LastKnownPosArea at 234.15.1911.19980
+//!				7. LastKnownPosArea at 234.30.1511.66003
+//!                             8. NPUD at 234.15.1911.100
+//!                             9. LastKnownPosArea at 234.15.1911.88880
+//!                             10. Clear Database
+
+// Original file name: lbsclientlastknownposarea0001.txt
+
+[TEST0]
+#single
+# PhoneId = <manufacturer>,<model>,<revision>, <serialnumber>, <error>
+PhoneId =    Generic,       123,    1.1,        1234567890
+
+#single
+#SubscriberId = <Id>, <err>
+SubscriberId = 56789012345678
+
+# multiple
+# Current Network Name
+# Note that network type 2 is GSM, network type 6 is CDMA.
+# NetworkInfo= <CountryCode>, <NetworkId>, <DisplayTag>, <NetworkShortName>, <NetworkLongName> , <NetworkAccess> <Network Type>"
+NetworkInfo = 0,              0,          Unknown,      UnKn,               Unknown_Network,      0,                   2
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,          0,                   2
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,          0,                   6
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,          0,                   2
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,          0,                   6
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,          0,                   6
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,          0,                   2
+NetworkInfo = 234,            30,         T-Mobile,     T-M,                T-Mobile_UK,          0,                   6
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,          0,                   2
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,          0,                   6
+
+# multiple
+# <NetworkIndex> is one of above
+# RegStatus = <Duration>, <RegStatus>, <NetworkIndex>
+RegStatus =    50,       5,           0
+RegStatus =    50,       5,           1
+RegStatus =    50,       5,           2
+RegStatus =    50,       5,           3
+RegStatus =    50,       5,           4
+RegStatus =    50,       5,           5
+RegStatus =    50,       5,           6
+RegStatus =    50,       5,           7
+RegStatus =    50,       5,           8
+RegStatus =    50,       5,           9
+
+
+# LocationArea = <AreaKnown>, <LocationAreaCode>, <CellId> . Where <AreaKnown> is -1 for true and 0 for false?! 
+LocationArea =    0,           0,                 0
+LocationArea =    -1,          1911,              65535
+LocationArea =    -1,          1913,              65536
+LocationArea =    -1,          1913,              32121
+LocationArea =    -1,          1911,              88880
+LocationArea =    -1,          1913,              76554
+LocationArea =    -1,          1911,              19980
+LocationArea =    -1,          1511,              66003
+LocationArea =    -1,          1911,              100
+LocationArea =    -1,          1911,              88880
+
+
+
+# ONStore= <max number of entries>, <max size of telephone number>, <max text length>
+ONStore=    5,                       50,                             60
+# ONStoreEntry= <index>, <telephone number>, <TMobileTON type of number>, <TMobileService service type>, <Number Plan>,<name>
+ONStoreEntry =   1,       447511699393,       2,                           0,                            8,       OwnNumber1
+
+
+# <Timeout> is time in sec while this status is valid. The last record lasts until shutdown.
+# <NetworkMode> - the set here has no effect. Please use NetworkInfo records instead.
+# <CellId> set here applies only to GetCellInfo/NotifyCellInfoChanges calls, which are not used. 
+# for getting CellId by our code. We use LocationArea records and GetCurrentNetwork/NotifyCurrentNetworkChange instead.
+# <CellInfoStatus> - The status of cell info. Look at TCellInfoStatus for the list of values.
+# CellInfo = <Timeout>, <NetworkMode>, <CellId>, <TimingAdvance>, <CellInfoStatus> .
+CellInfo =    0,         2,             0,        0,               2
+CellInfo =    0,         2,             0,        0,               2
+CellInfo =    0,         2,             0,        0,               2
+CellInfo =    0,         2,             0,        0,               2
+CellInfo =    0,         2,             0,        0,               2
+CellInfo =    0,         2,             0,        0,               2
+CellInfo =    0,         2,             0,        0,               2
+CellInfo =    0,         2,             0,        0,               2
+CellInfo =    0,         2,             0,        0,               2
+CellInfo =    0,         2,             0,        0,               2
--- a/lbstest/lbstestproduct/tdxml/LbsSuite/LbsIntegrationSuite/LbsClientSuite/lbsclientlastknownposarea.xml	Wed Sep 01 12:35:25 2010 +0100
+++ b/lbstest/lbstestproduct/tdxml/LbsSuite/LbsIntegrationSuite/LbsClientSuite/lbsclientlastknownposarea.xml	Wed Sep 15 00:02:22 2010 +0300
@@ -35,6 +35,10 @@
 			<hostPath>lbstest\lbstestproduct\lbsclient\testdata\lbsclientlastknownposarea0003.txt</hostPath>
 			<devicePath>c:\testdata\configs\lbsclientlastknownposarea0003.txt</devicePath>
 		</data>
+		<data>
+			<hostPath>lbstest\lbstestproduct\lbsclient\testdata\lbsclientlastknownposarea0009.txt</hostPath>
+			<devicePath>c:\testdata\configs\lbsclientlastknownposarea0009.txt</devicePath>
+		</data>
 	</dependencies>
 
 </testExecuteTest>
--- a/locationmgmt/locmonitor/lbslocmonitorapis/ConversionDataTypes/BWINS/lbslocationinfodatatypesu.def	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/lbslocmonitorapis/ConversionDataTypes/BWINS/lbslocationinfodatatypesu.def	Wed Sep 15 00:02:22 2010 +0300
@@ -82,4 +82,7 @@
 	?NewL@CLbsWlanInfo@@SAPAV1@ABV1@@Z @ 81 NONAME ; class CLbsWlanInfo * CLbsWlanInfo::NewL(class CLbsWlanInfo const &)
 	?SetSignalStrength@CLbsWcdmaCellInfo@@QAEXH@Z @ 82 NONAME ; void CLbsWcdmaCellInfo::SetSignalStrength(int)
 	?SignalStrength@CLbsWcdmaCellInfo@@QBEHXZ @ 83 NONAME ; int CLbsWcdmaCellInfo::SignalStrength(void) const
+	?LocalAreaCode@CLbsWcdmaCellInfo@@QBEHXZ @ 84 NONAME ; int CLbsWcdmaCellInfo::LocalAreaCode(void) const
+	?NewL@CLbsWcdmaCellInfo@@SAPAV1@HHHH@Z @ 85 NONAME ; class CLbsWcdmaCellInfo * CLbsWcdmaCellInfo::NewL(int, int, int, int)
+	?SetLocalAreaCode@CLbsWcdmaCellInfo@@QAEXH@Z @ 86 NONAME ; void CLbsWcdmaCellInfo::SetLocalAreaCode(int)
 
--- a/locationmgmt/locmonitor/lbslocmonitorapis/ConversionDataTypes/EABI/lbslocationinfodatatypesu.def	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/lbslocmonitorapis/ConversionDataTypes/EABI/lbslocationinfodatatypesu.def	Wed Sep 15 00:02:22 2010 +0300
@@ -100,4 +100,7 @@
 	_ZN17CLbsWcdmaCellInfo4NewLERKS_ @ 99 NONAME
 	_ZN17CLbsWcdmaCellInfo17SetSignalStrengthEi @ 100 NONAME
 	_ZNK17CLbsWcdmaCellInfo14SignalStrengthEv @ 101 NONAME
+	_ZN17CLbsWcdmaCellInfo16SetLocalAreaCodeEi @ 102 NONAME
+	_ZN17CLbsWcdmaCellInfo4NewLEiiii @ 103 NONAME
+	_ZNK17CLbsWcdmaCellInfo13LocalAreaCodeEv @ 104 NONAME
 
--- a/locationmgmt/locmonitor/lbslocmonitorapis/ConversionDataTypes/inc/lbslocationwcdmainfo.h	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/lbslocmonitorapis/ConversionDataTypes/inc/lbslocationwcdmainfo.h	Wed Sep 15 00:02:22 2010 +0300
@@ -64,7 +64,25 @@
      */    
     IMPORT_C static CLbsWcdmaCellInfo* NewL( const TInt aCountryCode,
                                              const TInt aNetworkCode,
-                                             const TInt aUniqueCellId );     
+                                             const TInt aUniqueCellId );
+
+		/**
+     * Allocates and constructs a new WCDMA cell info object. 
+     *
+     * @param[in] aCountryCode Network country code.
+     * @param[in] aNetworkCode Network code.
+	 * @param[in] aLocalAreaCode Local Area Code (LAC)
+     * @param[in] aUniqueCellId Cell ID of a cell in WCDMA PLMN.
+     * @return Pointer to the new WCDMA cell info object.
+     * @leave KErrArgument in case of invalid input or other standard symbian 
+     * error codes, such as KErrNoMemory.
+     */    
+
+	IMPORT_C static CLbsWcdmaCellInfo* NewL( const TInt aCountryCode,
+											 const TInt aNetworkCode,
+											 const TInt aLocalAreaCode,
+                                             const TInt aUniqueCellId );
+
     /**
       * Allocates and constructs a WCDMA cell info object, a copy of another one.
       * 
@@ -106,6 +124,22 @@
      *        KErrNotFound if the value is undefined.
      */    
     IMPORT_C TInt MobileNetworkCode() const;
+
+
+    /**
+     * Sets the Local Area Code (LAC).
+     *
+     * @param[in] aLocalAreaCode Local Area Code (LAC), range 0..0xffff.
+     */
+    IMPORT_C void SetLocalAreaCode( const TInt aLocalAreaCode );
+    
+    /**
+     * Retrieves the Local Area Code.
+     *
+     * @return Local Area Code (LAC), range 0..0xffff.
+     *        KErrNotFound if the value is undefined.
+     */    
+    IMPORT_C TInt LocalAreaCode(void) const; 
     
     /**
      * Sets the Cell Identity.
@@ -242,10 +276,11 @@
     void ConstructL();
     
     /**
-     * Symbian 2 phase constructor 
+     * Symbian 2 phase constructor # 2
      */
     void ConstructL( const TInt aCountryCode, 
                      const TInt aNetworkCode,
+					 const TInt aLocalAreaCode,
                      const TInt aUniqueCellId );
     
 private: // data
@@ -258,6 +293,7 @@
         EWcdmaUCid = 0x04,
         EWcdmaSC = 0x08,
         EWcdmaRSSI = 0x10,
+		EWcdmaLAC = 0x20,
         };
     
     /**
@@ -294,6 +330,11 @@
      * Neighbouring cell info
      */
     RLbsWcdmaNeighbourCellInfoArray  iNeighbourCellInfo;
+
+    /**
+     * Local Area Code (LAC)
+     */
+	TInt32		iLAC;
     
     };
 
--- a/locationmgmt/locmonitor/lbslocmonitorapis/ConversionDataTypes/src/lbslocationwcdmainfo.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/lbslocmonitorapis/ConversionDataTypes/src/lbslocationwcdmainfo.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -47,7 +47,24 @@
     {
     CLbsWcdmaCellInfo* self = new( ELeave ) CLbsWcdmaCellInfo;
     CleanupStack::PushL( self );
-    self->ConstructL( aCountryCode, aNetworkCode, aUniqueCellId );
+    self->ConstructL( aCountryCode, aNetworkCode, (-1), aUniqueCellId );
+    CleanupStack::Pop();
+    return self;    
+    }
+
+// ---------------------------------------------------------------------------
+// CLbsWcdmaCellInfo::NewL()
+// other items were commented in the header
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CLbsWcdmaCellInfo* CLbsWcdmaCellInfo::NewL( const TInt aCountryCode,
+                                               const TInt aNetworkCode,
+											   const TInt aLocalAreaCode,
+                                               const TInt aUniqueCellId )
+    {
+    CLbsWcdmaCellInfo* self = new( ELeave ) CLbsWcdmaCellInfo;
+    CleanupStack::PushL( self );
+    self->ConstructL( aCountryCode, aNetworkCode, aLocalAreaCode, aUniqueCellId );
     CleanupStack::Pop();
     return self;    
     }
@@ -55,7 +72,7 @@
 EXPORT_C  CLbsWcdmaCellInfo* CLbsWcdmaCellInfo::NewL( const CLbsWcdmaCellInfo& aPositionInfo )
 	{
 	
-	CLbsWcdmaCellInfo* self = CLbsWcdmaCellInfo::NewL( aPositionInfo.iMCC,aPositionInfo.iMNC,aPositionInfo.iUCid);
+	CLbsWcdmaCellInfo* self = CLbsWcdmaCellInfo::NewL( aPositionInfo.iMCC,aPositionInfo.iMNC, aPositionInfo.iLAC, aPositionInfo.iUCid);
 	self->iSCode = aPositionInfo.iSCode;
 	
 	RLbsWcdmaNeighbourCellInfoArray  neighbourCellInfoArray;
@@ -125,6 +142,28 @@
     return iMNC;
     }
 
+
+// ---------------------------------------------------------------------------
+// CLbsWcdmaCellInfo::SetLocalAreaCode()
+// other items were commented in the header
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CLbsWcdmaCellInfo::SetLocalAreaCode( const TInt aLocalAreaCode )
+    {
+    iLAC = aLocalAreaCode;
+    iDataValidationMask |= EWcdmaLAC;
+    }
+    
+// ---------------------------------------------------------------------------
+// CLbsWcdmaCellInfo::LocalAreaCode()
+// other items were commented in the header
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CLbsWcdmaCellInfo::LocalAreaCode(void) const
+    {
+    return iLAC;
+    }
+
 // ---------------------------------------------------------------------------
 // CLbsWcdmaCellInfo::SetUniqueCellId()
 // other items were commented in the header
@@ -265,7 +304,9 @@
         cellInfo.SetPathloss( aStream.ReadInt16L() );
         cellInfo.SetSignalStrength( aStream.ReadInt16L() );
         iNeighbourCellInfo.Append( cellInfo );
-        }    
+        }
+    
+	iLAC = aStream.ReadInt32L();
     }
 
 // ---------------------------------------------------------------------------
@@ -290,6 +331,9 @@
         aStream.WriteInt16L( iNeighbourCellInfo[i].Pathloss() );
         aStream.WriteInt16L( iNeighbourCellInfo[i].SignalStrength() );
         }
+
+    aStream.WriteInt32L( iLAC );
+
     }
 
 // ---------------------------------------------------------------------------
@@ -343,6 +387,14 @@
             User::Leave( KErrArgument );
             }
         }
+
+	if ( iDataValidationMask & EWcdmaLAC)
+		{
+		if (iLAC > 0xffff)
+			{
+            User::Leave( KErrArgument );
+			}
+		}
     }
 
 // ---------------------------------------------------------------------------
@@ -366,6 +418,7 @@
     iUCid = -1;
     iSCode = -1;
     iRssi  = -1;
+	iLAC = -1;
     iDataValidationMask = EWcdmaDataNull;
     }
 
@@ -376,11 +429,20 @@
 //
 void CLbsWcdmaCellInfo::ConstructL( const TInt aCountryCode, 
                                     const TInt aNetworkCode,
+									const TInt aLocalAreaCode,
                                     const TInt aUniqueCellId )
     {
     SetMobileCountryCode( aCountryCode );
     SetMobileNetworkCode( aNetworkCode );
     SetUniqueCellId( aUniqueCellId );
+	if (aLocalAreaCode == -1)
+		{
+		iLAC = -1;
+		}
+	else
+		{
+		SetLocalAreaCode(aLocalAreaCode);
+		}
     iSCode = -1;
     iRssi  = -1;
     }
--- a/locationmgmt/locmonitor/lbslocmonitorserver/inc/clbslocmonitordbengine.h	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/lbslocmonitorserver/inc/clbslocmonitordbengine.h	Wed Sep 15 00:02:22 2010 +0300
@@ -38,9 +38,9 @@
 	static CLbsLocMonitorDbEngine* NewL();
 	virtual ~CLbsLocMonitorDbEngine();
 	TInt SavePosition(TUint aMcc, TUint aMnc, TUint aLac, 
-			TUint aCid, const TPosition& aPosition, TBool aUserPosition, TRequestStatus& aStatus);
+			TUint aCid, TBool aIs3gMode, const TPosition& aPosition, TBool aUserPosition, TRequestStatus& aStatus);
 	TInt GetPosition(TUint aMcc, TUint aMnc, TUint aLac, 
-			TUint aCid, TPosition& aPosition, TPositionAreaExtendedInfo& aMatchingAreaInfo, TRequestStatus& aStatus);
+			TUint aCid, TBool aIs3gMode, TPosition& aPosition, TPositionAreaExtendedInfo& aMatchingAreaInfo, TRequestStatus& aStatus);
 	TInt GetPosition(TPosition& aPosition, TRequestStatus& aStatus);
 	TInt ClearDatabase();
 	
@@ -57,7 +57,7 @@
 			TInt aLac = KErrNotFound, TInt aCid = KErrNotFound);
 	void CheckFlush();
 	void Flush(TBool aShutdown);
-	TPositionAreaExtendedInfo CacheMatchLevel(TInt aMcc, TInt aMnc, TInt aLac, TInt aCid);
+	TPositionAreaExtendedInfo CacheMatchLevel(TInt aMcc, TInt aMnc, TInt aLac, TInt aCid, TBool aIs3gMode);
 	TInt Insert(TBool aShutdown);
 	TInt DbSize();
 	virtual void RunL();
@@ -81,6 +81,7 @@
 	TPosition iLastKnownPosition;
 	TTime iLastTime;
 	TBool iIsLastValid;
+	TBool iLastModeIs3g;
 	};
 	
 
--- a/locationmgmt/locmonitor/lbslocmonitorserver/inc/lbslocmonitorareainfodefs.h	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/lbslocmonitorserver/inc/lbslocmonitorareainfodefs.h	Wed Sep 15 00:02:22 2010 +0300
@@ -71,8 +71,12 @@
 public:
 	TUint iMcc; 
 	TUint iMnc; 
-	TUint iLac; 
+	TInt iLac;		// this can be set to -1 to indicate not valid
 	TUint iCid;
+
+	TBool iValidity;
+
+	TBool iIs3gNetworkMode;
 };
 
 #endif // LBSLOCMONITORAREAINFODEFS_H
--- a/locationmgmt/locmonitor/lbslocmonitorserver/inc/lbslocmonitordbenginedefs.h	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/lbslocmonitorserver/inc/lbslocmonitordbenginedefs.h	Wed Sep 15 00:02:22 2010 +0300
@@ -50,17 +50,21 @@
 //_LIT(KUpsertLastPosRowActual, "INSERT OR REPLACE INTO lastpos (rowid, date, data) VALUES (1, :timestamp, :data);");
 
 _LIT(KSelectRow4, "SELECT data FROM monitorstore WHERE mcc = :mcc AND mnc = :mnc AND lac = :lac AND cid = :cid;");
-_LIT(KSelectRow3, "SELECT data FROM monitorstore WHERE mcc = :mcc AND mnc = :mnc AND lac = :lac ORDER BY date DESC LIMIT 1;");
+_LIT(KSelectRow3, "SELECT data FROM monitorstore WHERE mcc = :mcc AND mnc = :mnc AND lac = :lac %S ORDER BY date DESC LIMIT 1;");
 _LIT(KSelectRow2, "SELECT data FROM monitorstore WHERE mcc = :mcc AND mnc = :mnc ORDER BY date DESC LIMIT 1;");
 _LIT(KSelectRow1, "SELECT data FROM monitorstore WHERE mcc = :mcc ORDER BY date DESC LIMIT 1;");
 _LIT(KSelectRowLatest, "SELECT data FROM lastpos ORDER BY date DESC LIMIT 1;");
 
 _LIT(KSelectTempRow4, "SELECT data FROM monitorstore_temp WHERE mcc = :mcc AND mnc = :mnc AND lac = :lac AND cid = :cid;");
-_LIT(KSelectTempRow3, "SELECT data FROM monitorstore_temp WHERE mcc = :mcc AND mnc = :mnc AND lac = :lac ORDER BY date DESC LIMIT 1;");
+_LIT(KSelectTempRow3, "SELECT data FROM monitorstore_temp WHERE mcc = :mcc AND mnc = :mnc AND lac = :lac %S ORDER BY date DESC LIMIT 1;");
 _LIT(KSelectTempRow2, "SELECT data FROM monitorstore_temp WHERE mcc = :mcc AND mnc = :mnc ORDER BY date DESC LIMIT 1;");
 _LIT(KSelectTempRow1, "SELECT data FROM monitorstore_temp WHERE mcc = :mcc ORDER BY date DESC LIMIT 1;");
 _LIT(KSelectTempRowLatest, "SELECT data FROM lastpos_temp ORDER BY date DESC LIMIT 1;");
 
+_LIT(KSelectGsmCells, "AND cid < 268435456");
+_LIT(KSelectWcdmaCells, "AND cid >= 268435456");
+
+
 _LIT(KCount, "SELECT COUNT(*) FROM monitorstore;");
 _LIT(KPrune, "DELETE FROM monitorstore WHERE ROWID IN (SELECT rowid FROM monitorstore ORDER BY date LIMIT 100)");
 
--- a/locationmgmt/locmonitor/lbslocmonitorserver/src/clbslocmonitorconversionhandler.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/lbslocmonitorserver/src/clbslocmonitorconversionhandler.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -740,8 +740,9 @@
         CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*>(iLocationInfoArray[i]);
         RLbsAreaInfoBaseArray areaArray;
         CleanupStack::PushL(TCleanupItem(*CleanUpResetAndDestroy, &areaArray));
-        // NOTE! When locmonitor is expanded to cache 3g / wlan this call must be changed!
-        locationInfo->GetAreaInfoL(areaArray, ELbsAreaGsmCellInfoClass);
+        // NOTE! When locmonitor is expanded to cache wlan etc. this call must be changed! 
+		// Currently we know about GSM and 3g (WCDMA).
+        locationInfo->GetAreaInfoL(areaArray, CLbsLocationInfo::ELbsGsmInfo|CLbsLocationInfo::ELbsWcdmaInfo);
         
         TInt areaCount = areaArray.Count();
         TBool saved = EFalse;
@@ -766,6 +767,23 @@
                     areaInfoGci.iMnc = area->MobileNetworkCode();
                     areaInfoGci.iLac = area->LocationAreaCode();
                     areaInfoGci.iCid = area->CellId();
+                    areaInfoGci.iValidity = ETrue;
+                    areaInfoGci.iIs3gNetworkMode = EFalse;
+                    
+                    resolved = ETrue;
+                    break;
+                    }
+
+                case ELbsAreaWcmdaCellInfoClass :
+                    {
+                    CLbsWcdmaCellInfo* area = static_cast<CLbsWcdmaCellInfo*>(areaArray[j]);
+                    areaInfoGci.iMcc = area->MobileCountryCode();
+                    areaInfoGci.iMnc = area->MobileNetworkCode();
+                    areaInfoGci.iLac = area->LocalAreaCode();
+                    areaInfoGci.iCid = area->UniqueCellId();
+                    areaInfoGci.iValidity = ETrue;
+                    areaInfoGci.iIs3gNetworkMode = ETrue;
+                    
                     resolved = ETrue;
                     break;
                     }
@@ -850,7 +868,7 @@
         
         RLbsAreaInfoBaseArray cellArray;
         CleanupStack::PushL(TCleanupItem(*CleanUpResetAndDestroy, &cellArray));
-        locationInfo->GetAreaInfoL(cellArray, CLbsLocationInfo::ELbsGsmInfo);
+        locationInfo->GetAreaInfoL(cellArray, CLbsLocationInfo::ELbsGsmInfo | CLbsLocationInfo::ELbsWcdmaInfo);
         
         RLbsAreaInfoBaseArray locationArray;
         CleanupStack::PushL(TCleanupItem(*CleanUpResetAndDestroy, &locationArray));
@@ -870,12 +888,34 @@
                 {
                 for(TInt i = 0; i < cellArray.Count(); i++)
                     {
-                    CLbsGsmCellInfo* cell = static_cast<CLbsGsmCellInfo*>(cellArray[i]);
-                    TLbsLocMonitorAreaInfoGci areaInfoGci;
-                    areaInfoGci.iMcc = cell->MobileCountryCode();
-                    areaInfoGci.iMnc = cell->MobileNetworkCode();
-                    areaInfoGci.iLac = cell->LocationAreaCode();
-                    areaInfoGci.iCid = cell->CellId();
+					TLbsLocMonitorAreaInfoGci areaInfoGci;
+					if (cellArray[i]->Type() == ELbsAreaGsmCellInfoClass)
+						{
+						CLbsGsmCellInfo* cell = static_cast<CLbsGsmCellInfo*>(cellArray[i]);
+						areaInfoGci.iMcc = cell->MobileCountryCode();
+						areaInfoGci.iMnc = cell->MobileNetworkCode();
+						areaInfoGci.iLac = cell->LocationAreaCode();
+						areaInfoGci.iCid = cell->CellId();
+                        areaInfoGci.iValidity = ETrue;
+						areaInfoGci.iIs3gNetworkMode = EFalse;
+						}
+					else 
+						{ 
+						// by elimination type must be ELbsAreaWcmdaCellInfoClass!
+						CLbsWcdmaCellInfo* cell = static_cast<CLbsWcdmaCellInfo*>(cellArray[i]);
+
+						// If we don't have a valid LAC (which may happen with WCDMA) then we cannot
+						// save to the cache and we should go to the next cell immediately.
+						if (cell->LocalAreaCode() == -1)
+							continue;
+						areaInfoGci.iMcc = cell->MobileCountryCode();
+						areaInfoGci.iMnc = cell->MobileNetworkCode();
+						areaInfoGci.iLac = cell->LocalAreaCode();
+						areaInfoGci.iCid = cell->UniqueCellId();
+						areaInfoGci.iValidity = ETrue;
+						areaInfoGci.iIs3gNetworkMode = ETrue;
+						}
+
                     RPointerArray<TLbsLocMonitorAreaInfoBase> areaArray;
                     areaArray.Append(&areaInfoGci);
                     TTime now;
--- a/locationmgmt/locmonitor/lbslocmonitorserver/src/clbslocmonitordbengine.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/lbslocmonitorserver/src/clbslocmonitordbengine.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -21,7 +21,7 @@
 #include "lbslocmonitordbenginedefs.h"
 #include "lbsdevloggermacros.h"
 
-
+const TInt KMaskInBit28 = 0x10000000;
 
 CLbsLocMonitorDbEngine* CLbsLocMonitorDbEngine::NewL()
 	{
@@ -109,10 +109,12 @@
 	}
 
 
-TInt CLbsLocMonitorDbEngine::SavePosition(TUint aMcc, TUint aMnc, TUint aLac, TUint aCid, const TPosition& aPosition, TBool aUserPosition, TRequestStatus& aStatus)
+TInt CLbsLocMonitorDbEngine::SavePosition(TUint aMcc, TUint aMnc, TUint aLac, TUint aCid, TBool aIs3gMode, const TPosition& aPosition, TBool aUserPosition, TRequestStatus& aStatus)
 	{
-    iSaveLastPos = aUserPosition;
 	LBSLOG(ELogP1,"->CLbsLocMonitorDbEngine::SavePosition");
+
+	iSaveLastPos = aUserPosition;
+
 	if(aMcc > KMaxTInt || aMnc > KMaxTInt || aLac > KMaxTInt || aCid > KMaxTInt)
 		{
 		return KErrArgument;
@@ -133,6 +135,7 @@
 		iLastMnc = aMnc;
 		iLastLac = aLac;
 		iLastCid = aCid;
+		iLastModeIs3g = aIs3gMode;
 		iLastTime.UniversalTime();
 		iLastPosition = aPosition;
 		if(iSaveLastPos)
@@ -145,7 +148,7 @@
 		} 
 	// If this cell is the same as the the cache, update the cache's position and timestamp
 	
-	else if(CacheMatchLevel(aMcc, aMnc, aLac, aCid).CellIdMatch())
+	else if(CacheMatchLevel(aMcc, aMnc, aLac, aCid, aIs3gMode).CellIdMatch())
 		{
 		iLastPosition = aPosition;
 	    if(iSaveLastPos)
@@ -153,6 +156,7 @@
             iLastKnownPosition = aPosition;
             }
 		iLastTime.UniversalTime();
+		iLastModeIs3g = aIs3gMode;
 		User::RequestComplete(iClientStatus, KErrNone);
 		return KErrNone;
 		}
@@ -168,6 +172,7 @@
 			iLastCid = aCid;
 			iLastTime.UniversalTime();
 			iLastPosition = aPosition;
+			iLastModeIs3g = aIs3gMode;
 			iIsLastValid = ETrue;
 			}
 		return result;
@@ -193,7 +198,13 @@
 		iSqlSaveStatement.BindInt(indexMcc, iLastMcc);
 		iSqlSaveStatement.BindInt(indexMnc, iLastMnc);
 		iSqlSaveStatement.BindInt(indexLac, iLastLac);
-		iSqlSaveStatement.BindInt(indexCid, iLastCid);
+		// Set bit 28 if 3g to distinguish from 2g equivalent...
+		TInt effectiveCid = iLastCid;
+		if (iLastModeIs3g)
+			{
+			effectiveCid |= KMaskInBit28;
+			}
+		iSqlSaveStatement.BindInt(indexCid, effectiveCid);
 		iSqlSaveStatement.BindInt64(indexStamp, iLastTime.Int64());
 		iSqlSaveStatement.BindBinary(indexData, positionDes);
 		
@@ -230,7 +241,7 @@
 	}
 
 
-TInt CLbsLocMonitorDbEngine::GetPosition(TUint aMcc, TUint aMnc, TUint aLac, TUint aCid, TPosition& aPosition, TPositionAreaExtendedInfo& aMatchingAreaInfo, TRequestStatus& aStatus)
+TInt CLbsLocMonitorDbEngine::GetPosition(TUint aMcc, TUint aMnc, TUint aLac, TUint aCid, TBool aIs3gMode, TPosition& aPosition, TPositionAreaExtendedInfo& aMatchingAreaInfo, TRequestStatus& aStatus)
 	{
 	LBSLOG(ELogP1,"->CLbsLocMonitorDbEngine::GetPosition");
 	if(aMcc > KMaxTInt || aMnc > KMaxTInt || aLac > KMaxTInt || aCid > KMaxTInt)
@@ -245,8 +256,15 @@
 	aMatchingAreaInfo.SetLocationAreaCodeMatch(EFalse);
 	aMatchingAreaInfo.SetCellIdMatch(EFalse);
 	aMatchingAreaInfo.SetArea(TPositionAreaExtendedInfo::EAreaUnknown);
-	TPositionAreaExtendedInfo cacheMatch = CacheMatchLevel(aMcc, aMnc, aLac, aCid);
-	if(cacheMatch.CellIdMatch() || Select(aPosition, TPtrC(KSelectTempRow4), aMcc, aMnc, aLac, aCid) || Select(aPosition, TPtrC(KSelectRow4), aMcc, aMnc, aLac, aCid))
+
+	TUint effectiveCid = aCid;
+	if (aIs3gMode)
+		{
+		effectiveCid |= KMaskInBit28;
+		}
+
+	TPositionAreaExtendedInfo cacheMatch = CacheMatchLevel(aMcc, aMnc, aLac, aCid, aIs3gMode);
+	if(cacheMatch.CellIdMatch() || Select(aPosition, TPtrC(KSelectTempRow4), aMcc, aMnc, aLac, effectiveCid) || Select(aPosition, TPtrC(KSelectRow4), aMcc, aMnc, aLac, effectiveCid))
 		{		
 		if(cacheMatch.CellIdMatch())
 			{
@@ -258,47 +276,86 @@
 		aMatchingAreaInfo.SetCellIdMatch(ETrue);
 		aMatchingAreaInfo.SetArea(TPositionAreaExtendedInfo::EAreaCity);
 		}
-	else if(cacheMatch.LocationAreaCodeMatch() || Select(aPosition, TPtrC(KSelectTempRow3), aMcc, aMnc, aLac) || Select(aPosition, TPtrC(KSelectRow3), aMcc, aMnc, aLac))
-		{
-		if(cacheMatch.LocationAreaCodeMatch())
-			{
-			aPosition = iLastPosition;
-			}
-		aMatchingAreaInfo.SetMobileCountryCodeMatch(ETrue);
-		aMatchingAreaInfo.SetMobileNetworkCodeMatch(ETrue);
-		aMatchingAreaInfo.SetLocationAreaCodeMatch(ETrue);
-		aMatchingAreaInfo.SetArea(TPositionAreaExtendedInfo::EAreaRegion);
-		}
-	else if(cacheMatch.MobileNetworkCodeMatch() || Select(aPosition, TPtrC(KSelectTempRow2), aMcc, aMnc) || Select(aPosition, TPtrC(KSelectRow2), aMcc, aMnc))
-		{
-		if(cacheMatch.MobileNetworkCodeMatch())
+	else 
+		{	
+		TBool matchLac = cacheMatch.LocationAreaCodeMatch();
+		if(matchLac)
 			{
 			aPosition = iLastPosition;
 			}
-		aMatchingAreaInfo.SetMobileCountryCodeMatch(ETrue);
-		aMatchingAreaInfo.SetMobileNetworkCodeMatch(ETrue);
-		aMatchingAreaInfo.SetArea(TPositionAreaExtendedInfo::EAreaCountry);
-		}
-	else if(cacheMatch.MobileCountryCodeMatch() || Select(aPosition, TPtrC(KSelectTempRow1), aMcc) || Select(aPosition, TPtrC(KSelectRow1), aMcc))
-		{
-		if(cacheMatch.MobileCountryCodeMatch())
+		else
 			{
-			aPosition = iLastPosition;
+			TBuf<30>gsmOrWcdmaCells;
+			if (aIs3gMode)
+				{
+				gsmOrWcdmaCells = KSelectWcdmaCells;
+				}
+			else
+				{
+				gsmOrWcdmaCells = KSelectGsmCells;
+				}
+				
+			TBuf<256> selectStatement;
+			selectStatement.Format(KSelectTempRow3, &gsmOrWcdmaCells);
+
+			if (Select(aPosition, TPtrC(selectStatement), aMcc, aMnc, aLac))
+				{
+				matchLac = ETrue;
+				}
+			else
+				{
+				selectStatement.Format(KSelectRow3,&gsmOrWcdmaCells);
+				if (Select(aPosition, TPtrC(selectStatement), aMcc, aMnc, aLac))
+					{
+					matchLac = ETrue;
+					}
+				}
+			}
+				
+		if (matchLac)
+			{
+			aMatchingAreaInfo.SetMobileCountryCodeMatch(ETrue);
+			aMatchingAreaInfo.SetMobileNetworkCodeMatch(ETrue);
+			aMatchingAreaInfo.SetLocationAreaCodeMatch(ETrue);
+			aMatchingAreaInfo.SetArea(TPositionAreaExtendedInfo::EAreaRegion);
 			}
-		aMatchingAreaInfo.SetMobileCountryCodeMatch(ETrue);
-		aMatchingAreaInfo.SetArea(TPositionAreaExtendedInfo::EAreaCountry);
-		}
-	else if(iIsLastValid || Select(aPosition, TPtrC(KSelectTempRowLatest)) || Select(aPosition, TPtrC(KSelectRowLatest)) || iIsLastValid)
-		{
-		if(iIsLastValid)
+		else
 			{
-			aPosition = iLastPosition;
-			}
-		}
-	else
-		{
-		result = KErrNotFound;
-		}
+			if(cacheMatch.MobileNetworkCodeMatch() || Select(aPosition, TPtrC(KSelectTempRow2), aMcc, aMnc) || Select(aPosition, TPtrC(KSelectRow2), aMcc, aMnc))
+				{
+				if(cacheMatch.MobileNetworkCodeMatch())
+					{
+					aPosition = iLastPosition;
+					}
+				aMatchingAreaInfo.SetMobileCountryCodeMatch(ETrue);
+				aMatchingAreaInfo.SetMobileNetworkCodeMatch(ETrue);
+				aMatchingAreaInfo.SetArea(TPositionAreaExtendedInfo::EAreaCountry);
+				}
+			else if(cacheMatch.MobileCountryCodeMatch() || Select(aPosition, TPtrC(KSelectTempRow1), aMcc) || Select(aPosition, TPtrC(KSelectRow1), aMcc))
+				{
+				if(cacheMatch.MobileCountryCodeMatch())
+					{
+					aPosition = iLastPosition;
+					}
+				aMatchingAreaInfo.SetMobileCountryCodeMatch(ETrue);
+				aMatchingAreaInfo.SetArea(TPositionAreaExtendedInfo::EAreaCountry);
+				}
+			else if(iIsLastValid || Select(aPosition, TPtrC(KSelectTempRowLatest)) || Select(aPosition, TPtrC(KSelectRowLatest)) || iIsLastValid)
+				{
+				if(iIsLastValid)
+					{
+					aPosition = iLastPosition;
+					}
+				}
+			else
+				{
+				result = KErrNotFound;
+				}
+
+			} // end else no match on LAC
+
+		} // end else no match on cell id
+
 	TRequestStatus* status = &aStatus;
 	*status = KRequestPending;
 	User::RequestComplete(status, result);
@@ -436,7 +493,7 @@
 	}
 
 
-TPositionAreaExtendedInfo CLbsLocMonitorDbEngine::CacheMatchLevel(TInt aMcc, TInt aMnc, TInt aLac, TInt aCid)
+TPositionAreaExtendedInfo CLbsLocMonitorDbEngine::CacheMatchLevel(TInt aMcc, TInt aMnc, TInt aLac, TInt aCid, TBool aIs3gMode)
 	{
 	LBSLOG(ELogP1,"->CLbsLocMonitorDbEngine::CacheMatchLevel");
 	TPositionAreaExtendedInfo areaInfo;
@@ -447,7 +504,7 @@
 			{
 			if(aMnc == iLastMnc)
 				{
-				if(aLac == iLastLac)
+				if(aLac == iLastLac && aIs3gMode == iLastModeIs3g) 
 					{
 					if(aCid == iLastCid)
 						{
@@ -460,7 +517,8 @@
 			areaInfo.SetMobileCountryCodeMatch(ETrue);
 			}
 		}
-
+	// areaInfo.iReserved2 is not used, and has been left here for future extension.
+	// coverity[uninit_use]
 	return areaInfo;
 	}
 
--- a/locationmgmt/locmonitor/lbslocmonitorserver/src/clbslocmonitornetworkinfofinder.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/lbslocmonitorserver/src/clbslocmonitornetworkinfofinder.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -29,7 +29,8 @@
 #include <commsdattypesv1_1.h>
 using namespace CommsDat;
 
-const TUint KMaxCellIdOrLac = 65535;
+const TUint KMaxGsmCellIdOrLac = 65535;
+const TUint KMaxWcdmaCellId = 0xFFFFFFF;   // maximum of 28 bits, least significant (16 bits short cell id + 12 RNC id)
 const TUint KMaxMccOrMnc = 999;
 
 
@@ -154,10 +155,8 @@
 		case EStateNetInfoChangeMon:
 			{
 			TLbsLocMonitorAreaInfoGci areaInfo;
-			if(ValidateNetInfo(areaInfo))
-				{
-				NotifyObservers(areaInfo);
-				}
+			ValidateNetInfo(areaInfo);
+			NotifyObservers(areaInfo);
 
 			MonitorNetworkChange(); // Keep monitoring
 			break;				
@@ -322,6 +321,9 @@
 TBool CLbsLocMonitorNetworkInfoFinder::ValidateNetInfo(TLbsLocMonitorAreaInfoGci& aAreaInfo)
 	{
 	LBSLOG(ELogP1, "CLbsLocMonitorNetworkInfoFinder::ValidateNetInfo()Begin\n");
+
+	aAreaInfo.iValidity = EFalse;
+
 	TLex lex(iNetworkInfo.iCountryCode);
 	TInt err = lex.Val(aAreaInfo.iMcc);
 	if(err!=KErrNone || aAreaInfo.iMcc > KMaxMccOrMnc)
@@ -335,17 +337,37 @@
 		{	
 		return EFalse;
 		}
-	if (!iLocArea.iAreaKnown ||
-		(iLocArea.iLocationAreaCode > KMaxCellIdOrLac || 
-		 iLocArea.iCellId > KMaxCellIdOrLac))
-		{	
-		return EFalse;			
-		}
-	else
-		{
-		 aAreaInfo.iLac = iLocArea.iLocationAreaCode;
-		 aAreaInfo.iCid = iLocArea.iCellId;
-		}
+
+	if (!iLocArea.iAreaKnown)
+	    {
+	    return (EFalse);
+	    }
+	else 
+	    {
+	    // We only know about registration with GSM and WCDMA cells (so far!).
+	    __ASSERT_DEBUG(iNetworkInfo.iMode == RMobilePhone::ENetworkModeGsm ||
+	                   iNetworkInfo.iMode == RMobilePhone::ENetworkModeWcdma, User::Invariant());
+	    
+	    // Do some checks on the LAC and cell id (16 bits on GSM, up to 28 bits on WCDMA
+	    if(iLocArea.iLocationAreaCode > KMaxGsmCellIdOrLac || 
+		  ((iLocArea.iCellId > KMaxGsmCellIdOrLac) && (iNetworkInfo.iMode == RMobilePhone::ENetworkModeGsm)) ||
+		  (iLocArea.iCellId > KMaxWcdmaCellId))
+	        {	
+	        return EFalse;			
+	        }
+	    else
+            {
+	        // everything looks fine
+            aAreaInfo.iLac = iLocArea.iLocationAreaCode;
+            aAreaInfo.iCid = iLocArea.iCellId;
+            aAreaInfo.iIs3gNetworkMode = iNetworkInfo.iMode == RMobilePhone::ENetworkModeWcdma ? ETrue : EFalse;
+            }
+        }   // end else area is known
+
+	// Reaching the end here implies we did't find any problems.
+	aAreaInfo.iValidity = ETrue;
+
 	LBSLOG(ELogP1, "CLbsLocMonitorNetworkInfoFinder::ValidateNetInfo()End\n");
+
 	return ETrue;
 	}
--- a/locationmgmt/locmonitor/lbslocmonitorserver/src/clbslocmonitorrequesthandler.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/lbslocmonitorserver/src/clbslocmonitorrequesthandler.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -131,13 +131,17 @@
 void CLbsLocMonitorRequestHandler::PositionAvailableL(const TPosition& aPosition)
 	{
 	LBSLOG(ELogP1,"->CLbsLocMonitorRequestHandler::PositionAvailableL");
-	if(iPositionsQueue.Count() < KLbsLocMonitorMaxWriteArraySize)
+	if(iPositionsQueue.Count() < KLbsLocMonitorMaxWriteArraySize && iAreaInfoAvailable)
 		{
-		iPositionsQueue.Append(aPosition);
+		TInt err = iPositionsQueue.Append(aPosition);
+		if( err!= KErrNone )
+			{
+			LBSLOG(ELogP1,"->iPositionsQueue.Append failed!!");
+			}
 		}
 	else
 		{
-		// Unable to handle more positions.
+		// Unable to handle more positions or we don't have valid area parameters
 		// The position will be lost.
 		}
 
@@ -445,9 +449,14 @@
 		if (iLastKnownPositionAvailable)
 			{
 			iLastKnownPositionAvailable = EFalse;
-			iOperationInProgress = ELocMonDbSaveLastPos;
-			iDb.SavePosition(iLastKnownPosition, iCurrentAreaInfo, ETrue, iStatus);
-			SetActive();
+			
+			// Check that we have valid data before trying to save to the database - ignore otherwise.
+			if (iAreaInfoAvailable)
+			    {
+			    iOperationInProgress = ELocMonDbSaveLastPos;
+			    iDb.SavePosition(iLastKnownPosition, iCurrentAreaInfo, ETrue, iStatus);
+			    SetActive();
+			    }
 			}
 		else if (iPositionsQueue.Count() > 0)
 			{
@@ -620,7 +629,7 @@
 void CLbsLocMonitorRequestHandler::AreaInfoUpdate(const TLbsLocMonitorAreaInfoBase& aAreaUpdate)
 	{
 	LBSLOG(ELogP1,"->CLbsLocMonitorRequestHandler::AreaInfoUpdate");
-	iAreaInfoAvailable = ETrue;
+	
 	switch(aAreaUpdate.AreaInfoClassType())
 		{
 		case TLbsLocMonitorAreaInfoBase::EAreaGciClass:
@@ -628,7 +637,17 @@
 			// GCI is pointed to from position zero of the array.
 			// Overwrite it with the new area info.
 			TLbsLocMonitorAreaInfoGci& ref = const_cast<TLbsLocMonitorAreaInfoGci&>(static_cast<const TLbsLocMonitorAreaInfoGci&>(aAreaUpdate));
-			*(static_cast<TLbsLocMonitorAreaInfoGci*>(iCurrentAreaInfo[EGlobalCellIdType])) = ref;
+
+			// check that the update is valid before updating the current position.
+			// If not, we need to mark area info as not being available.
+			if (ref.iValidity)
+				{
+				iAreaInfoAvailable = ETrue;
+				*(static_cast<TLbsLocMonitorAreaInfoGci*>(iCurrentAreaInfo[EGlobalCellIdType])) = ref;
+				}
+			else
+				iAreaInfoAvailable = EFalse;
+
 			break;	
 			}
 			
--- a/locationmgmt/locmonitor/lbslocmonitorserver/src/lbslocmonitorareainfodefs.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/lbslocmonitorserver/src/lbslocmonitorareainfodefs.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -31,7 +31,7 @@
 	}
 
 TLbsLocMonitorAreaInfoGci::TLbsLocMonitorAreaInfoGci():
-	iMcc(0), iMnc(0), iLac(0), iCid(0)
+	iMcc(0), iMnc(0), iLac(0), iCid(0), iValidity(EFalse), iIs3gNetworkMode(EFalse)
 	{
 	LBSLOG(ELogP1,"->TLbsLocMonitorAreaInfoBase::TLbsLocMonitorAreaInfoGci");
 	iAreaInfoClassType = EAreaGciClass;
--- a/locationmgmt/locmonitor/lbslocmonitorserver/src/rlbslocmonitordb.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/lbslocmonitorserver/src/rlbslocmonitordb.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -62,7 +62,12 @@
 	if(iDbEngine)
 		{
 		const TLbsLocMonitorAreaInfoGci* areaGci = static_cast<const TLbsLocMonitorAreaInfoGci*>(aAreaInfo[0]);
-		return iDbEngine->SavePosition(areaGci->iMcc, areaGci->iMnc, areaGci->iLac, areaGci->iCid, aPosition, aUserPosition, aStatus);
+
+		// Only try to save valid cells and ignore any that are invalid.
+		if (areaGci->iValidity)
+			return iDbEngine->SavePosition(areaGci->iMcc, areaGci->iMnc, areaGci->iLac, areaGci->iCid, areaGci->iIs3gNetworkMode, aPosition, aUserPosition, aStatus);
+		else
+			return KErrNone;
 		}
 	return KErrNotFound;
 	}
@@ -81,7 +86,8 @@
 	if(iDbEngine)
 		{
 		const TLbsLocMonitorAreaInfoGci* areaGci = static_cast<const TLbsLocMonitorAreaInfoGci*>(aAreaInfo[0]);
-		return iDbEngine->GetPosition(areaGci->iMcc, areaGci->iMnc, areaGci->iLac, areaGci->iCid, aPosition, aMatchingAreaInfo, aStatus);
+		return iDbEngine->GetPosition(areaGci->iMcc, areaGci->iMnc, areaGci->iLac, areaGci->iCid, areaGci->iIs3gNetworkMode,
+			                          aPosition, aMatchingAreaInfo, aStatus);
 		}
 	return KErrNotFound;
 	}
--- a/locationmgmt/locmonitor/test/ExampleLocationConverter/src/ExampleLocationConverter.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/ExampleLocationConverter/src/ExampleLocationConverter.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -32,6 +32,9 @@
 
 const TInt KTimingAdvanceSaveToCacheFalse= 252;
 
+const TInt KScramblingCodeWcdmaTests = 254;
+
+
 // ECOM implementation specifics
 static const TImplementationProxy implTable[] =
 	{
@@ -123,6 +126,8 @@
     	    {
     	    case ELbsConversionOutputPosition:
     	        {
+				TBool specialTreatmentOfPos = EFalse;
+
     	        // Extract the area info provided by the client.
     	        // If client has specified only coordinate info,
     	        // return KErrNotSupported.
@@ -133,14 +138,13 @@
                                 CLbsLocationInfo::ELbsWlanInfo;
     	        aLocationInfoArray[i]->GetAreaInfoL( areaInfoArray,areaInfoMask );
     	        TInt count = areaInfoArray.Count();
-    	        
-    	
-    	        
+    	     	        
     	        if( count == 0 )
     	            {
     	            iObserver.OnConversionComplete(KErrNotSupported);
     	            return;
     	            }
+
     	        TLocality locality;
 				if (areaInfoArray[0]->Type() == ELbsAreaGsmCellInfoClass)
 					{
@@ -155,7 +159,7 @@
 						}
 					else
 						{
-						// for all others values ensiure that we put
+						// for all others values ensure that we put
 						// localities in cache
 						iRetainLocalityInCache = ETrue;
 						}
@@ -166,7 +170,7 @@
 							|| (timingAdvance
 									== KTimingAdvanceSaveToCacheFalse))
 						{
-						// For all the special tests
+						// For all the special GSM tests
 						TReal64 lat = posInfo->MobileCountryCode();
 						TReal64 lng = posInfo->MobileNetworkCode();
 						TReal32 alt = posInfo->LocationAreaCode();
@@ -175,21 +179,40 @@
 
 						locality.SetCoordinate(lat, lng, alt);
 						locality.SetAccuracy(horAcc, 11.0);
-						}
-					else
-						{
-						// and for the original tests
-						locality.SetCoordinate(62.5285, 23.9385, 1.22f);
-						locality.SetAccuracy(10.0f, 0.0);
 
+						specialTreatmentOfPos = ETrue;
 						}
 					}
-				else
+				else if (areaInfoArray[0]->Type() == ELbsAreaWcmdaCellInfoClass)
 					{
-					// and for the original tests
+					iRetainLocalityInCache = ETrue;
+					
+					CLbsWcdmaCellInfo* posInfo =
+							static_cast<CLbsWcdmaCellInfo*> (areaInfoArray[0]);
+
+					if (posInfo->ScramblingCode() == KScramblingCodeWcdmaTests )
+						{
+						// For all the special wcdma tests
+						// note we don't set the horiz accuracy to same as cell id (as in GSM tests) as this
+						// makes the accuracy too low!
+						TReal64 lat = posInfo->MobileCountryCode();
+						TReal64 lng = posInfo->MobileNetworkCode();
+						TReal32 alt = 25.6;
+
+						locality.SetCoordinate(lat, lng, alt);
+						locality.SetAccuracy(24.3, 11.0);
+
+						specialTreatmentOfPos = ETrue;
+						}
+					}
+
+				// For the original tests we stick with a set position value
+				if (!specialTreatmentOfPos)
+					{
 					locality.SetCoordinate(62.5285, 23.9385, 1.22f);
 					locality.SetAccuracy(10.0f, 0.0);
 					}
+
     	        areaInfoArray.ResetAndDestroy();
      
     	        CLbsPositionInfo* positionInfo = CLbsPositionInfo::NewL( locality );
@@ -198,6 +221,7 @@
     	        CleanupStack::Pop( positionInfo );
     	        break;
     	        }
+
     	    case ELbsConversionOutputGsm:
     	        {
                 // Extract the area info provided by the client.
--- a/locationmgmt/locmonitor/test/te_geolocmonitorsuite/src/te_geolocmonitorstep5.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_geolocmonitorsuite/src/te_geolocmonitorstep5.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -606,7 +606,7 @@
     // KErrNotSupported and KErrNotFound are allowed error codes.
     else if( !( iConversionHandler->iStatus == KErrNotSupported || iConversionHandler->iStatus == KErrNotFound ) )
         {
-        INFO_PRINTF2(_L("Expected return value KErrNotSupported or KErrNotFound, got %d)"), iConversionHandler->iStatus);
+        INFO_PRINTF2(_L("Expected return value KErrNotSupported or KErrNotFound, got %d"), iConversionHandler->iStatus);
         User::Leave( KErrArgument );
         }
     
--- a/locationmgmt/locmonitor/test/te_lbslocationinforconvertertef/inc/step.h	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_lbslocationinforconvertertef/inc/step.h	Wed Sep 15 00:02:22 2010 +0300
@@ -59,7 +59,7 @@
             TInt locationcode=-2, TInt cellid=-2, TInt timingadvance=-2, TInt Rxlev=-2, TInt nNeignbourcells=0, 
             TInt arfcn=-2, TInt bsic=-2, TInt NRxlev=-2);
     virtual TInt SetWCDMACellInfoL(TInt fntype, TInt countrycode=-2,
-            TInt networkcode=-2, TInt cellid=-2, TInt nNeignbourcells=0, TInt scramblingcode=-2, 
+            TInt networkcode=-2, TInt localAreaCode =-2, TInt cellid=-2, TInt nNeignbourcells=0, TInt scramblingcode=-2, 
             TInt neighbourucid=-2, TInt neighbourscode=-2, TInt neighbourpathloss=-2, 
             TInt neighboursignalstrength=-2);
     virtual TInt SetWLanInfoL(TInt fntype=1, TInt macidint=-2,  TInt signalstrength=-2);
@@ -254,6 +254,8 @@
     void test_cacheL();
     void test_cache2L();
     void test_cache3L();
+	void test_cacheWcdmaL();
+
 	};
 
 _LIT(KStep,"Step");
--- a/locationmgmt/locmonitor/test/te_lbslocationinforconvertertef/scripts/LbsLocationInfoConverter.ini	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_lbslocationinforconvertertef/scripts/LbsLocationInfoConverter.ini	Wed Sep 15 00:02:22 2010 +0300
@@ -22,6 +22,10 @@
 tc_id=158
 plugin_uid = 537007117
 
+[Cache-Test-WCDMA]
+tc_id=159
+plugin_uid = 537007117
+
 [GetAllLocationInfo]
 tc_id=0
 
--- a/locationmgmt/locmonitor/test/te_lbslocationinforconvertertef/scripts/te_LbsLocationInfoConverterSuite.script	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_lbslocationinforconvertertef/scripts/te_LbsLocationInfoConverterSuite.script	Wed Sep 15 00:02:22 2010 +0300
@@ -15,6 +15,11 @@
 RUN_TEST_STEP 100 te_lbslocationinfoconvertersuite Step c:\testdata\configs\LbsLocationInfoConverter.ini Cache-Test-1 
 END_TESTCASE		      LBS-Cache-Test-1
 
+START_TESTCASE                LBS-Cache-Test-WCDMA
+RUN_TEST_STEP 100 te_lbslocationinfoconvertersuite Step c:\testdata\configs\LbsLocationInfoConverter.ini Cache-Test-WCDMA
+END_TESTCASE		      LBS-Cache-Test-WCDMA
+
+
 PRINT now wait for loc monitor to teminate (which it will do after  10 seconds 
 PRINT this ensures when we try and delete the caches files they are not still in an opened state 
 
--- a/locationmgmt/locmonitor/test/te_lbslocationinforconvertertef/src/step.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_lbslocationinforconvertertef/src/step.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -32,6 +32,8 @@
 
 const TInt KTimingAdvanceSaveToCacheFalse= 252;
 
+const TInt KScramblingCodeWcdmaTests = 254;
+
 CStep::~CStep()
 /**
  * Destructor
@@ -422,14 +424,23 @@
 // -----------------------------------------------------------------------------
 //
 TInt CStep::SetWCDMACellInfoL(TInt fntype, TInt countrycode,
-        TInt networkcode, TInt cellid, TInt nNeignbourcells, TInt scramblingcode,  
+        TInt networkcode, TInt localAreaCode, TInt cellid, TInt nNeignbourcells, TInt scramblingcode,  
         TInt neighbourucid, TInt neighbourscode, TInt neighbourpathloss, 
         TInt neighboursignalstrength)
     {
     CLbsWcdmaCellInfo* wcdmacellinfo;    
-    if(fntype==1)
+    if(fntype==1 || fntype == 3)
         {
-        wcdmacellinfo=CLbsWcdmaCellInfo::NewL( countrycode,networkcode,cellid); 
+        if (fntype == 1)
+            {
+            wcdmacellinfo=CLbsWcdmaCellInfo::NewL( countrycode,networkcode, localAreaCode, cellid);
+            }
+        else
+            {
+            // must be fn type of 3 which means use old constructor without a LAC
+            wcdmacellinfo=CLbsWcdmaCellInfo::NewL( countrycode, networkcode, cellid);            
+            }
+            
         if(scramblingcode!=-2)
             {
             wcdmacellinfo->SetScramblingCode(scramblingcode);
@@ -474,6 +485,10 @@
             {
             wcdmacellinfo->SetMobileNetworkCode(networkcode);
             }
+		if (localAreaCode != -2)
+			{
+			wcdmacellinfo->SetLocalAreaCode(localAreaCode);
+			}
         if(cellid!=-2)
             {
             wcdmacellinfo->SetUniqueCellId(cellid);
@@ -1666,7 +1681,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     
@@ -1685,7 +1700,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 0, 0, 0);
+    err = SetWCDMACellInfoL(1, 0, 0, 0, 0);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     
@@ -1704,7 +1719,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 999, 999, 65535);
+    err = SetWCDMACellInfoL(1, 999, 999, 10, 65535);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     
@@ -1723,7 +1738,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, -1, 200, 300);
+    err = SetWCDMACellInfoL(1, -1, 200, 10, 300);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     
@@ -1740,7 +1755,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, -1, 300);
+    err = SetWCDMACellInfoL(1, 100, -1, 10, 300);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     
@@ -1757,7 +1772,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, -1);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, -1);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     
@@ -1774,7 +1789,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 1000, 200, 300);
+    err = SetWCDMACellInfoL(1, 1000, 200, 10, 300);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     
@@ -1791,7 +1806,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 1000, 300);
+    err = SetWCDMACellInfoL(1, 100, 1000, 10, 300);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -1808,7 +1823,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 268435456);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 268435456);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     
@@ -1825,7 +1840,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 200, 30);
+    err = SetWCDMACellInfoL(2, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     
@@ -1935,7 +1950,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 200);
+    err = SetWCDMACellInfoL(2, 100, 200, 10);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     
@@ -1954,7 +1969,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 999);
+    err = SetWCDMACellInfoL(2, 100, 999, 10);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -1973,7 +1988,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 0);
+    err = SetWCDMACellInfoL(2, 100, 0, 10);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -1992,7 +2007,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 1000);
+    err = SetWCDMACellInfoL(2, 100, 1000, 10);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2026,7 +2041,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 200, 65535);
+    err = SetWCDMACellInfoL(2, 100, 200, 10, 65535);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2045,7 +2060,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 200, 0);
+    err = SetWCDMACellInfoL(2, 100, 200, 10, 0);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2064,7 +2079,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 200, 268435456);
+    err = SetWCDMACellInfoL(2, 100, 200, 10, 268435456);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2081,7 +2096,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 200, -1);
+    err = SetWCDMACellInfoL(2, 100, 200, 10, -1);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2098,7 +2113,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 200, 30, 0, 511);
+    err = SetWCDMACellInfoL(2, 100, 200, 10, 30, 0, 511);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2117,7 +2132,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 200, 30, 0);
+    err = SetWCDMACellInfoL(2, 100, 200, 10, 30, 0);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2136,7 +2151,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 200, 30, 512);
+    err = SetWCDMACellInfoL(2, 100, 200, 10, 30, 512);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2153,7 +2168,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 200, 30, -1);
+    err = SetWCDMACellInfoL(2, 100, 200, 10, 30, -1);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2221,7 +2236,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 200, 30);
+    err = SetWCDMACellInfoL(1, 200, 30, 10);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2238,7 +2253,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 200, 30);
+    err = SetWCDMACellInfoL(1, 200, 30, 10);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2255,7 +2270,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 200, 30);
+    err = SetWCDMACellInfoL(2, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2274,7 +2289,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 200, 30);
+    err = SetWCDMACellInfoL(2, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2293,7 +2308,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(2, 100, 200, 30);
+    err = SetWCDMACellInfoL(2, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2547,7 +2562,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 0, 15, 46, 0);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 0, 15, 46, 0);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2566,7 +2581,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 0, 268435455, 15, 47, 0);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 0, 268435455, 15, 47, 0);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2585,7 +2600,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 2, 15, 44, 15, 46, 0);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 2, 15, 44, 15, 46, 0);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2604,7 +2619,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -1, 15);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -1, 15);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2621,7 +2636,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 268435456, 15);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 268435456, 15);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2638,7 +2653,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 0, 0, 0, 47, 0);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 0, 0, 0, 47, 0);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2657,7 +2672,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 268435455, 511, 47, 0);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 268435455, 511, 47, 0);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2676,7 +2691,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 0, -1);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 0, -1);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -2693,7 +2708,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 268435455, 512);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 268435455, 512);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3035,23 +3050,23 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 511, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 511, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3105,23 +3120,23 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3159,7 +3174,7 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3336,23 +3351,23 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 511, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 1000, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 511, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 1000, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3369,23 +3384,23 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 268435456, 511);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 511, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 268435456, 511);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 511, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3402,23 +3417,23 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 512, 1, 268435455, 511);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 512, 1, 268435455, 511);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3435,19 +3450,19 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 511, 268435455, 511, 47, 0);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 511, 268435455, 511, 47, 0);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3468,15 +3483,15 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3608,23 +3623,23 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 511, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 511, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3643,23 +3658,23 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 511, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 511, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3678,23 +3693,23 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, 511, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, 511, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3713,15 +3728,15 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3748,15 +3763,15 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3783,15 +3798,15 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -3821,15 +3836,15 @@
  
     err = CreateLocationInfoConverterL();
     if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30, 1, -2, 268435455, 511, 47, 0);
-    if(err != KErrNone) User::Leave(err);
-    AddLocationInfoL();
-    if(err != KErrNone) User::Leave(err);
-    err = SetWCDMACellInfoL(1, 100, 200, 30);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30, 1, -2, 268435455, 511, 47, 0);
+    if(err != KErrNone) User::Leave(err);
+    AddLocationInfoL();
+    if(err != KErrNone) User::Leave(err);
+    err = SetWCDMACellInfoL(1, 100, 200, 10, 30);
     if(err != KErrNone) User::Leave(err);
     AddLocationInfoL();
     if(err != KErrNone) User::Leave(err);
@@ -4940,6 +4955,153 @@
 			Cleanup();
 		   } // end of for loop
 };
+
+
+typedef struct 
+	{
+	TInt 	countryCode;
+	TInt 	networkCode;
+	TInt 	locationCode;
+	TInt 	cellId;
+	TBool 	fromPlugin;
+	} 
+sWcdmaInfo;
+
+
+/*
+ * Here, we test the mode where localities coming from the converter are cache.
+ * Thus the third and forth localities  should come from the cache and NOT the
+ * plugin. Additionally the fifth position should come from the plug-in because
+ * we are going to have an invalid LAC which should exclude looking in the cache. 
+ */
+const TInt KTestWcdmaCacheArraySize= 5;
+sWcdmaInfo wcdmaTestArray[KTestWcdmaCacheArraySize] = {
+		{44, 49, 16, 73652, 	ETrue },     /* 81000 */
+		{44, 50, 17, 83564, 	ETrue },
+		{44, 50, 17, 83564, 	EFalse},
+		{44, 49, 16, 73652, 	EFalse},
+		{44, 50, 17, 83564,     ETrue } 
+};
+
+const TInt invalidLacTest = 4;
+
+void CStep::test_cacheWcdmaL()
+{
+    TInt err = KErrNone;
+    iApiId =1; // use resolver
+   
+	TUint Uidinteger = 537007117;
+	TUid uid = TUid::Uid( Uidinteger );
+	   
+	for (TUint i = 0; i < KTestWcdmaCacheArraySize; i++)
+		{
+		TRAPD(leaveErr, iLbsLocationInfo = CLbsLocationInfo::NewL());
+		if (KErrNone != leaveErr )
+			{
+			INFO_PRINTF2(_L("iLbsLocationInfo = CLbsLocationInfo::NewL() LEAVES, error =%d"), leaveErr);
+			User::Leave(leaveErr);
+			}
+		
+		TRAP(leaveErr,iResolverObserver = CTeLocationResolverObserver::NewL());
+		if (KErrNone != leaveErr )
+			{
+			INFO_PRINTF2(_L("CTeLocationResolverObserver::NewL() LEAVES, error =%d"), leaveErr);
+			User::Leave(leaveErr);
+			}
+		
+		TRAP(leaveErr,iLbsLocationResolver = CLbsLocationResolver::NewL(*iResolverObserver,uid));
+		if (KErrNone != leaveErr )
+			{
+			INFO_PRINTF2(_L("iLbsLocationResolver = CLbsLocationResolver::NewL(*iResolverObserver,uid) LEAVES, error =%d"), leaveErr);
+			User::Leave(leaveErr);
+			}
+		
+		// Generate WCDMA cell info, setting scrambling code to indicate special treatment of position information
+		TRAP(leaveErr, SetWCDMACellInfoL( i == invalidLacTest ? 3 : 1, 
+                                          wcdmaTestArray[i].countryCode, 
+                                          wcdmaTestArray[i].networkCode,
+                                          wcdmaTestArray[i].locationCode, 
+                                          wcdmaTestArray[i].cellId,
+                                          0 /* zero neighbouring cells*/,
+                                          KScramblingCodeWcdmaTests
+                                        )
+			 );
+		
+		if (KErrNone != leaveErr )
+			{
+			INFO_PRINTF2(_L("SetWCDMACellInfoL LEAVES, error =%d"), leaveErr);
+			User::Leave(leaveErr);
+			}
+
+		TRAP(leaveErr, AddLocationInfoL());
+		if( KErrNone !=leaveErr) 
+			{
+			INFO_PRINTF2(_L("AddLocationInfoL() LEAVES, error =%d"), leaveErr);
+			User::Leave(leaveErr);
+			}
+	  
+		TRAP(leaveErr, ConvertLocationInfoL(1, 1, 0));
+		if( KErrNone !=leaveErr) 
+			{
+			INFO_PRINTF2(_L("ConvertLocationInfoL(1, 1, 0)) LEAVES, error =%d"), leaveErr);
+			User::Leave(leaveErr);
+			}
+	   
+		TInt err = ValidateLocationInfo();
+		if( KErrNone !=err)
+			{
+			INFO_PRINTF2(_L("ValidateLocationInfo() returns error =%d"), err);
+			User::Leave(err);
+			}
+	    
+		TLocality locality;
+		TBool fromCache = iResolverObserver->ConversionLocality(locality);
+	
+		TReal64 lat = locality.Latitude();
+		TReal64 lng = locality.Longitude();
+		TReal32 alt = locality.Altitude();
+	
+		TInt cCode = wcdmaTestArray[i].countryCode; 
+		if (cCode != (TInt)lat)
+			{
+			INFO_PRINTF3(_L("VcCode (%d) != (TInt)lat error =%d"), cCode, KErrGeneral);
+		
+			User::Leave(KErrGeneral);
+			}
+
+		TInt nCode = wcdmaTestArray[i].networkCode; 
+		if (nCode != (TInt)lng)
+			{
+			INFO_PRINTF3(_L("nCode (%d)!= (TInt)lng error =%d"), nCode, KErrGeneral);
+		
+			User::Leave(KErrGeneral);
+			}
+					
+		if (fromCache)
+			{
+			INFO_PRINTF4(_L("From Cache(lat=%Lf, lng=%Lf, alt=%f"),lat,lng,alt);
+			if (wcdmaTestArray[i].fromPlugin)
+				{
+				INFO_PRINTF1(_L("Test failed - Position got from Cache bit should have come from plugin"));
+				User::Leave(KErrGeneral);
+				}
+			}
+		else
+			{ // from plugin!
+			INFO_PRINTF4(_L("From plugin(lat=%Lf, lng=%Lf, alt=%f"),lat,lng,alt);
+			if (!wcdmaTestArray[i].fromPlugin)
+				{
+				INFO_PRINTF1(_L("Test failed - Position got from plugin but should have come from Cache"));
+				User::Leave(KErrGeneral);
+				}
+			}
+
+		Cleanup();
+
+        } // end of for loop
+
+    }
+
 void CStep::CallL(TInt aId)
 {
     switch(aId)
@@ -5108,5 +5270,6 @@
         case 156: test_cacheL(); break;
         case 157: test_cache2L(); break;
         case 158: test_cache3L(); break;
+		case 159: test_cacheWcdmaL(); break;
     };
 };
--- a/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/inc/dbstep.h	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/inc/dbstep.h	Wed Sep 15 00:02:22 2010 +0300
@@ -32,6 +32,7 @@
 
 private:
 	TPosition iDummyPosition;
+	TPosition iDummyPosition2;
 	};
 
 _LIT(KDBStep,"DBStep");
--- a/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/scripts/te_LbsLocationMonitorDbSuite.script	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/scripts/te_LbsLocationMonitorDbSuite.script	Wed Sep 15 00:02:22 2010 +0300
@@ -28,21 +28,25 @@
 //! @SYMTestCaseDesc            Checks that correct matches are returned, 
 //!				that performance is acceptable and that two instances of the DB can be used
 //! @SYMTestPriority            Medium
-//! @SYMTestActions             1) Add 1000 records to database
-//!				2) Perform query that matches CELL
-//!				3) Perform query that matches LAC
-//!				4) Perform query that matches MCC
-//!				5) Perform query that matches nothing
-//!				6) Time taken to perform requests is measured
-//!				7) Using a second instance of the db, perform a query that matches MCC
+//! @SYMTestActions             1) Add 1000 records to database (900 GSM and 100 WCDMA)
+//!				                2) Perform query that matches GSM CELL
+//!				                3) Perform query that matches LAC on GSM cell, 
+//!                             4) Perform query that matches Mobile Network Code on GSM cell
+//!                             5) Perform a query that matches on Mobile Country Code
+//!				                6) Perform query that matches on nothing
+//!				                7) Time taken to perform requests is measured
+//!				                8) Perform query that matches LAC on WCDMA cell
+//!				                9) Using a second instance of the db, perform a query that matches MCC
 //!
 //! @SYMTestExpectedResults     1) All records added with no errors
-//!				2) CELL match returned
-//!				3) LAC match returned
-//!				4) MCC match returned
-//!				5) KErrNotFound returned
-//!				6) Time taken is less than X
-//!				7) MCC match returned
+//!				                2) CELL match returned, GSM cell
+//!				                3) LAC match returned, retrieves GSM rather than very similar WCDMA cell
+//!                             4) Mobile Network code match and GSM position retrieved
+//!                             5) Mobile country code match with GSM position
+//!				                6) No country code match, GSM position
+//!			                    7) Time taken is less than X
+//!				                8) LAC match returned with WCDMA position
+//!				                9) MCC match returned
 //!
 //! @SYMTestType                UT
 //! @SYMCreationDate            19/01/2009 
@@ -55,24 +59,20 @@
 //! @SYMTestCaseDesc            Verify that negative cases are handled
 //! @SYMTestPriority            Medium
 //! @SYMTestActions             1) Attempt to save a position to the DB before OpenL() has been called
-//!				2) Attempt to read a position from the db before OpenL() has been called
-//!				3) Attempt to ClearDatabase() before OpenL() has been called
-//!				4) Peform an exhaustive test of all CELL,LAC,MNC,MCC values around the negative boundary when saving 
-//!				4) Peform an exhaustive test of all CELL,LAC,MNC,MCC values around the negative boundary when reading
+//!				                2) Attempt to read a position from the db before OpenL() has been called
+//!				                3) Attempt to ClearDatabase() before OpenL() has been called
+//!				                4) Peform an exhaustive test of all CELL,LAC,MNC,MCC values around the negative boundary when saving (GSM and WCDMA)
+//!				                5) Peform an exhaustive test of all CELL,LAC,MNC,MCC values around the negative boundary when reading (GSM and WCDMA)
 //!
 //! @SYMTestExpectedResults     1) Returns KErrNotFound
-//!				2) Returns KErrNotFound
-//!				3) Returns KErrNotFound
-//!				4) Returns KErrArgument where any of CELL,LAC,MNC,MCC are negative 
-
-
-//!				5) Returns KErrArgument where any of CELL,LAC,MNC,MCC are negative
+//!				                2) Returns KErrNotFound
+//!				                3) Returns KErrNotFound
+//!				                4) Returns KErrArgument where any of CELL,LAC,MNC,MCC are negative irrespective of network type
+//!				                5) Returns KErrArgument where any of CELL,LAC,MNC,MCC are negative irrespective of network type
 //!			
-
-
 //! @SYMTestType                UT
 //! @SYMCreationDate            19/01/2009
-RUN_TEST_STEP 5 te_lbslocationmonitordbsuite NegativeStep
+RUN_TEST_STEP 10 te_lbslocationmonitordbsuite NegativeStep
 END_TESTCASE		      LBS-LocMonDBNegative-0001
 
 
@@ -81,10 +81,10 @@
 //! @SYMTestCaseDesc            Verify that database dletion works
 //! @SYMTestPriority            Medium
 //! @SYMTestActions             1) Check DB Size
-//!				2) Save 100 records
-//!				3) Check DB Size
-//!				4) Clear database
-//!				5) Check DB size
+//!				                2) Save 100 records
+//!				                3) Check DB Size
+//!				                4) Clear database
+//!				                5) Check DB size
 //!
 //! @SYMTestExpectedResults     1) Size returned
 //!				2) records saved
@@ -102,15 +102,27 @@
 //! @SYMTestCaseID              LBS-LocMonDBReplace-0001
 //! @SYMTestCaseDesc            Verify that positions with identical cell data overwrite each other
 //! @SYMTestPriority            Medium
-//! @SYMTestActions             1) Save cell position
-//!				2) Read cell position
-//!				3) Save cell position with identical cell data but different position
-//!				4) Read cell position
+//! @SYMTestActions             1) Save GSM cell position
+//!				                2) Read GSM cell position
+//!			                    3) Save GSM cell position with identical cell data but different position
+//!				                4) Read cell position
+//!                             5) Save WCDMA cell similar to GSM cell
+//!                             6) Retrieve GSM position (checking that not replaced by similar WCDMA)
+//!                             7) Retrieve WCDMA position
+//!                             8) Add a second WCDMA position with same network area as first
+//!                             9) Retrieve 2nd WCDMA position which has replaced the first 
+//!                             
 //!
 //! @SYMTestExpectedResults     1) Save returns with no errors
-//!				2) Cell from 1) returned
-//!				3) Save returns with no errors
-//!				4) Cell from 3) returned
+//!				                2) Cell from 1) returned
+//!				                3) Save returns with no errors
+//!				                4) Cell from 3) returned
+//!                             5) WCDMA cell saved ok
+//!                             6) cell from 3) returned
+//!                             7) WCDMA position, cell from 5)
+//!                             8) Save returned without errors
+//!                             9) WCDMA cell and position from 8) returned
+//!                                
 //!
 //! @SYMTestType                UT
 //! @SYMCreationDate            19/01/2009
@@ -121,21 +133,25 @@
 // as it creates the conditions for the next test
 // (te_lbslocationmonitordb2)
 //
-START_TESTCASE                LBS-LocMonDBTimeStamp-0001
+START_TESTCASE                  LBS-LocMonDBTimeStamp-0001
 //! @SYMTestCaseID              LBS-LocMonDBTimeStamp-0001
 //! @SYMTestCaseDesc            Verify that where a query matches multiple results, the most recent is returned
 //! @SYMTestPriority            Medium
-//! @SYMTestActions             1) Wait 1 second then save a position
-//!				2) Wait 1 second then save a position
-//!				3) Wait 1 second then save a position
-//! 				4) Perform a query that matches both 1) and 2)
-//!				5) Perform a query that matches only 3)
+//! @SYMTestActions             1) Wait 1 micro second then save a GSM position
+//!				                2) Wait 1 micro second then save a GSM position
+//!				                3) Wait 1 micro second then save a GSM position
+//!                             4) Get last stored position
+//!                             5) wait one micro second and add a WCDMA position
+//! 				            6) Perform a query that matches both 1) and 2)
+//!				                7) Get last stored position
 //!
 //! @SYMTestExpectedResults     1) Save returns with no errors
-//!				2) Save returns with no errors
-//!				3) Save returns with no errors
-//!				4) Position from 2) is returned
-//!				5) Position from 3) is returned
+//!				                2) Save returns with no errors
+//!				                3) Save returns with no errors
+//!				                4) Position from 3) is returned
+//!				                5) save returns with no errors
+//!                             6) (GSM) position from 2) is returned
+//!                             7) WCDMA position from 5) is returned
 //!
 //! @SYMTestType                UT
 //! @SYMCreationDate            19/01/2009
--- a/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/scripts/te_LbsLocationMonitorDbSuite2.script	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/scripts/te_LbsLocationMonitorDbSuite2.script	Wed Sep 15 00:02:22 2010 +0300
@@ -26,9 +26,11 @@
 //! @SYMTestCaseDesc            Verify that the DB created in the previous step can be accessed after a reboot
 //! @SYMTestPriority            Medium
 //! @SYMTestActions             1) Wait 1 second
-//! 							2) Perform a query that matches (recored stored by previous test suite)
+//! 			        2) Perform a query that matches GSM cell (record stored by previous test suite)
+//!                             3) Perform a query that matches WCDMA cell (record stored by previous test suite)
 //!
-//! @SYMTestExpectedResults     1) Position is returned
+//! @SYMTestExpectedResults     2) GSM Position is returned
+//!                             3) WCDMA Position is returned
 //!
 //! @SYMTestType                UT
 //! @SYMCreationDate            19/01/2009
--- a/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/clearstep.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/clearstep.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -86,6 +86,9 @@
 			in.iMnc = i+1000;
 			in.iLac = i+2000;
 			in.iCid = i+3000;
+	        in.iValidity = ETrue;
+	        in.iIs3gNetworkMode = EFalse;
+			
 			RPointerArray<TLbsLocMonitorAreaInfoBase> inArray;
 			inArray.Append(&in);
 			locMonitorDb.SavePosition(dummyPosition,inArray,ETrue,iWaiter->iStatus);
--- a/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/dbstep.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/dbstep.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -22,6 +22,8 @@
 
 #include "ctasyncwaiter.h"
 
+const TInt KLowestWcdmaCell = 0x10000;
+
 
 CDBStep::~CDBStep()
 /**
@@ -50,6 +52,12 @@
 	iDummyPosition.SetCoordinate(10.33, 54.22, 10.01);
 	iDummyPosition.SetHorizontalAccuracy(100);
 	iDummyPosition.SetVerticalAccuracy(1000);
+
+	iDummyPosition2.SetCoordinate(11.33, 55.22, 11.01);
+	iDummyPosition2.SetHorizontalAccuracy(101);
+	iDummyPosition2.SetVerticalAccuracy(1001);
+
+
 	return TestStepResult();
 	}
 
@@ -62,7 +70,7 @@
  */
 	{
 	__UHEAP_MARK;
-	  if (TestStepResult()==EPass)
+	if (TestStepResult()==EPass)
 		{
 		INFO_PRINTF1(_L("Init locMonitorDb"));
 		RLbsLocMonitorDb locMonitorDb = RLbsLocMonitorDb();
@@ -75,10 +83,11 @@
 		INFO_PRINTF1(_L("First Reset DB to initial state"));
 		locMonitorDb.ClearDatabase();
 		
-		INFO_PRINTF1(_L("Adding 10000 records"));
+		INFO_PRINTF1(_L("Adding 1000 records"));
 		TTime addStart;
 		addStart.UniversalTime();
-		for(TInt i = 1; i <= 1000; i++)
+		// Create 900 GSM cells amd 100 WCDMA cells with the next loop
+		for(TInt i = 1; i <= 900; i++)
 			{
 			//TRequestStatus status;
 			TLbsLocMonitorAreaInfoGci in;
@@ -86,11 +95,28 @@
 			in.iMnc = i+1000;
 			in.iLac = i+2000;
 			in.iCid = i+3000;
+			in.iValidity = ETrue;
+			in.iIs3gNetworkMode = EFalse;
+						
 			RPointerArray<TLbsLocMonitorAreaInfoBase> inArray;
 			inArray.Append(&in);
 			locMonitorDb.SavePosition(iDummyPosition,inArray,ETrue,iWaiter->iStatus);
 			iWaiter->StartAndWait();
 			inArray.Reset();
+
+
+			// Generate 100 WCDMA database records as well.
+			if (i <100)
+				{
+				// we deliberately only change the cell id, 3g flag value and the position
+				in.iCid = i + KLowestWcdmaCell;
+				in.iIs3gNetworkMode = ETrue;
+
+				inArray.Append(&in);
+				locMonitorDb.SavePosition(iDummyPosition2,inArray,ETrue,iWaiter->iStatus);
+				iWaiter->StartAndWait();
+				inArray.Reset();
+				}
 			}
 		
 		TTime addEnd;
@@ -99,22 +125,25 @@
 		
 		//INFO_PRINTF2(_L("Start Time %d"), addStart.Int64());
 		//INFO_PRINTF2(_L("End Time %d "), addEnd.Int64());
-		INFO_PRINTF3(_L("%d Adding 10000 records took %d Microseconds"), 0, interval.Int64());
-		
+		INFO_PRINTF3(_L("%d Adding 1000 records took %d Microseconds"), 0, interval.Int64());
 		
 		//
-		// Read
+		// Read 5 values from previously created db 
+		// As measuring time tsken, info_printfs commented out, but uncomment if test starts to fail! 
 		//
-		INFO_PRINTF1(_L("Reading 4 records"));
+		INFO_PRINTF1(_L("Reading 5 records"));
 		TTime readStart;
 		readStart.UniversalTime();
 		
-		// 4 fixed values against previously created db
+		// First value is a GSM cell that we have an exact match for in the database
+		//INFO_PRINTF1(_L("First value, GSM cell we have in the database"));
 		TLbsLocMonitorAreaInfoGci out;
 		out.iMcc = 51;
 		out.iMnc = 1051;
 		out.iLac = 2051;
 		out.iCid = 3051;
+		out.iValidity = ETrue;
+		out.iIs3gNetworkMode = EFalse;
 		TPosition outPosition;
 		RPointerArray<TLbsLocMonitorAreaInfoBase> outArray;
 		outArray.Append(&out);
@@ -128,11 +157,19 @@
 			SetTestStepResult(EFail);
 			}
 		ComparePositions(iDummyPosition,outPosition);
+		if (TestStepResult() == EFail)
+			{
+			ERR_PRINTF1(_L("Failed on comparison with first value"));
+			}
 		
+        // Here we retrieve a gsm position on LAC, not a similar wcdma one.
+		//INFO_PRINTF1(_L("Second record - GSM cell similar to WCDMA that is matched on LAC"));
 		out.iMcc = 82;
 		out.iMnc = 1082;
 		out.iLac = 2082;
 		out.iCid = 5454;
+		out.iValidity = ETrue;
+		out.iIs3gNetworkMode = EFalse;
 		outArray.Append(&out);
 		TPositionAreaExtendedInfo matchLevel2; 
 		locMonitorDb.GetPosition(outPosition,outArray,matchLevel2,iWaiter->iStatus);
@@ -144,39 +181,86 @@
 			SetTestStepResult(EFail);
 			}
 		ComparePositions(iDummyPosition,outPosition);
-		
+		if (TestStepResult() == EFail)
+			{
+			ERR_PRINTF1(_L("Failed on comparison with second value"));
+			}
+
+
+		// Use a WCDMA cell, but expect to retrieve a GSM position matching on Mobile operator code
+		//INFO_PRINTF1(_L("Get forth value matching on Mobile operator code (GSM cell position)"));	
 		out.iMcc = 423;
-		out.iMnc = 43535445;
+		out.iMnc = 1423;
 		out.iLac = 4442342;
 		out.iCid = 92922;
+		out.iValidity = ETrue;
+		out.iIs3gNetworkMode = ETrue;
+
 		outArray.Append(&out);
 		TPositionAreaExtendedInfo matchLevel3; 
 		locMonitorDb.GetPosition(outPosition,outArray,matchLevel3,iWaiter->iStatus);
 		iWaiter->StartAndWait();
 		outArray.Reset();
-		if(!matchLevel3.MobileCountryCodeMatch())
+		if(!matchLevel3.MobileNetworkCodeMatch())
+			{
+			ERR_PRINTF1(_L("MNC match not found"));
+			SetTestStepResult(EFail);
+			}
+		ComparePositions(iDummyPosition,outPosition);
+		if (TestStepResult() == EFail)
+			{
+			ERR_PRINTF1(_L("Failed on comparison with fourth value"));
+			}
+
+		// Use a WCDMA cell, but expect to retrieve a GSM position matching only on country code
+		//INFO_PRINTF1(_L("Get forth value matching only on country code (GSM cell position)"));	
+		out.iMcc = 423;
+		out.iMnc = 43535445;
+		out.iLac = 4442342;
+		out.iCid = 92922;
+		out.iValidity = ETrue;
+		out.iIs3gNetworkMode = ETrue;
+
+		outArray.Append(&out);
+		TPositionAreaExtendedInfo matchLevel4; 
+		locMonitorDb.GetPosition(outPosition,outArray, matchLevel4, iWaiter->iStatus);
+		iWaiter->StartAndWait();
+		outArray.Reset();
+		if(!matchLevel4.MobileCountryCodeMatch())
 			{
 			ERR_PRINTF1(_L("MCC match not found"));
 			SetTestStepResult(EFail);
 			}
 		ComparePositions(iDummyPosition,outPosition);
+		if (TestStepResult() == EFail)
+			{
+			ERR_PRINTF1(_L("Failed on comparison with fourth value"));
+			}
 
-		out.iMcc = 34000023;
+		// Use a GSM cell and expect to retrieve a GSM position which doesn't match on anything
+		//INFO_PRINTF1(_L("Fifth value: get value which doesn't match on anything (GSM cell position)"));	
+		out.iMcc = 990;
 		out.iMnc = 4353545;
 		out.iLac = 4534;
 		out.iCid = 5454;
+		out.iValidity = ETrue;
+		out.iIs3gNetworkMode = EFalse;
 		outArray.Append(&out);
-		TPositionAreaExtendedInfo matchLevel4;  
-		locMonitorDb.GetPosition(outPosition,outArray,matchLevel4,iWaiter->iStatus);
+		TPositionAreaExtendedInfo matchLevel5;  
+		locMonitorDb.GetPosition(outPosition,outArray,matchLevel5,iWaiter->iStatus);
 		iWaiter->StartAndWait();
 		outArray.Reset();
-		if(matchLevel4.MobileCountryCodeMatch())
+		if(matchLevel5.MobileCountryCodeMatch())
 			{
 			ERR_PRINTF1(_L("Spurious match found"));
 			SetTestStepResult(EFail);
 			}
 		ComparePositions(iDummyPosition,outPosition);
-		
+		if (TestStepResult() == EFail)
+			{
+			ERR_PRINTF1(_L("Failed on comparison with fifth value"));
+			}
+
 		TTime readEnd;
 		readEnd.UniversalTime();
 		TTimeIntervalMicroSeconds interval2 = readEnd.MicroSecondsFrom(readStart);
@@ -184,12 +268,37 @@
 
 		//INFO_PRINTF2(_L("Start Time %d"), readStart.Int64());
 		//INFO_PRINTF2(_L("End Time %d "), readEnd.Int64());
-		INFO_PRINTF3(_L("%d Reading 4 records took %d Microseconds"), 0, interval2.Int64());
-		if(interval2.Int64() > 2000000)
+		INFO_PRINTF3(_L("%d Reading 5 records took %d Microseconds"), 0, interval2.Int64());
+		if(interval2.Int64() > 2500000)
 			{
-			ERR_PRINTF2(_L("Retrieving 4 records took: %d microseonds, Expected less than 2000000"), interval2.Int64());
+			ERR_PRINTF2(_L("Retrieving 5 records took: %d microseconds, Expected less than 2500000"), interval2.Int64());
 			}
-		
+
+		// Here we retrieve a wcdma position on LAC value, not a similar gsm one. So we set
+		// up a wcdma cell that we don't have in the database
+		//INFO_PRINTF1(_L("Get third record matched on LAC, WCDMA cell this time"));
+		out.iMcc = 10;
+		out.iMnc = 1010;
+		out.iLac = 2010;
+		out.iCid = KLowestWcdmaCell + 500;
+		out.iValidity = ETrue;
+		out.iIs3gNetworkMode = ETrue;		
+		outArray.Append(&out);
+		TPositionAreaExtendedInfo matchLevel6;  
+		locMonitorDb.GetPosition(outPosition, outArray, matchLevel6, iWaiter->iStatus);
+		iWaiter->StartAndWait();
+		outArray.Reset();
+		if(!matchLevel6.LocationAreaCodeMatch())
+			{
+			ERR_PRINTF1(_L("LAC Match not found"));
+			SetTestStepResult(EFail);
+			}
+		ComparePositions(iDummyPosition2,outPosition);
+		if (TestStepResult() == EFail)
+			{
+			ERR_PRINTF1(_L("Failed on comparison with third value"));
+			}
+
 		INFO_PRINTF1(_L("Performing a read with a second client"));
 		RLbsLocMonitorDb locMonitorDb2 = RLbsLocMonitorDb();
 		locMonitorDb2.OpenL();
@@ -198,12 +307,14 @@
 		out.iMnc = 4353545;
 		out.iLac = 4534;
 		out.iCid = 5454;
+		out.iValidity = ETrue;
+		out.iIs3gNetworkMode = EFalse;
 		outArray.Append(&out);
-		TPositionAreaExtendedInfo matchLevel5;  
-		locMonitorDb2.GetPosition(outPosition,outArray,matchLevel5,iWaiter->iStatus);
+		TPositionAreaExtendedInfo matchLevel7;  
+		locMonitorDb2.GetPosition(outPosition, outArray, matchLevel7,iWaiter->iStatus);
 		iWaiter->StartAndWait();
 		outArray.Reset();
-		if(matchLevel5.MobileCountryCodeMatch())
+		if(matchLevel7.MobileCountryCodeMatch())
 			{
 			ERR_PRINTF1(_L("Spurious match found"));
 			SetTestStepResult(EFail);
--- a/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/negativestep.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/negativestep.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -100,24 +100,36 @@
 					{
 					for(TInt z = -1;z < 2;z++)
 						{
-						TRequestStatus status;
-						TLbsLocMonitorAreaInfoGci in;
-						in.iMcc = w;
-						in.iMnc = x;
-						in.iLac = y;
-						in.iCid = z;
-						inArray.Append(&in);
-						result = locMonitorDb.SavePosition(dummyIn,inArray,ETrue,iWaiter->iStatus);
-						if(w >= 0 && x >= 0 && y >= 0 && z >= 0)
+						for (TInt is3gIndex = 0; is3gIndex < 2; is3gIndex++)
 							{
-							iWaiter->StartAndWait();
-							TEST(result >= KErrNone);
+							TRequestStatus status;
+							TLbsLocMonitorAreaInfoGci in;
+							in.iMcc = w;
+							in.iMnc = x;
+							in.iLac = y;
+							in.iCid = z;
+							in.iValidity = ETrue;
+							if (is3gIndex == 0)
+								{
+								in.iIs3gNetworkMode = EFalse;
+								}
+							else
+								{
+								in.iIs3gNetworkMode = ETrue;
+								}							
+							inArray.Append(&in);
+							result = locMonitorDb.SavePosition(dummyIn,inArray,ETrue,iWaiter->iStatus);
+							if(w >= 0 && x >= 0 && y >= 0 && z >= 0)
+								{
+								iWaiter->StartAndWait();
+								TEST(result >= KErrNone);
+								}
+							else
+								{
+								TEST(result == KErrArgument);
+								}
+							inArray.Reset();
 							}
-						else
-							{
-							TEST(result == KErrArgument);
-							}
-						inArray.Reset();
 						}
 					}
 				}
@@ -134,27 +146,39 @@
 					{
 					for(TInt z = -1;z < 2;z++)
 						{
-						TLbsLocMonitorAreaInfoGci out;
-						out.iMnc = w;
-						out.iMcc = x;
-						out.iLac = y;
-						out.iCid = z;
-						RPointerArray<TLbsLocMonitorAreaInfoBase> outArray;
-						outArray.Append(&out);
-						TPosition outPosition;
-						TPositionAreaExtendedInfo matchLevel;
-						result = locMonitorDb.GetPosition(outPosition,outArray,matchLevel,iWaiter->iStatus);
-						if(w >= 0 && x >= 0 && y >= 0 && z >= 0)
+						for (TInt is3gIndex = 0; is3gIndex < 2; is3gIndex++)
 							{
-							iWaiter->StartAndWait();
-							TEST(result >= KErrNone);
-							ComparePositions(dummyIn,outPosition);
+							TLbsLocMonitorAreaInfoGci out;
+							out.iMnc = w;
+							out.iMcc = x;
+							out.iLac = y;
+							out.iCid = z;
+							out.iValidity = ETrue;
+							if (is3gIndex == 0)
+								{
+								out.iIs3gNetworkMode = EFalse;
+								}
+							else
+								{
+								out.iIs3gNetworkMode = ETrue;
+								}														
+							RPointerArray<TLbsLocMonitorAreaInfoBase> outArray;
+							outArray.Append(&out);
+							TPosition outPosition;
+							TPositionAreaExtendedInfo matchLevel;
+							result = locMonitorDb.GetPosition(outPosition,outArray,matchLevel,iWaiter->iStatus);
+							if(w >= 0 && x >= 0 && y >= 0 && z >= 0)
+								{
+								iWaiter->StartAndWait();
+								TEST(result >= KErrNone);
+								ComparePositions(dummyIn,outPosition);
+								}
+							else
+								{
+								TEST(result == KErrArgument);
+								}
+							outArray.Reset();
 							}
-						else
-							{
-							TEST(result == KErrArgument);
-							}
-						outArray.Reset();
 						}
 					}
 				}
--- a/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/persistencestep.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/persistencestep.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -53,8 +53,7 @@
 TVerdict CPersistenceStep::doTestStepL()
 /**
  * @return - TVerdict code
- * This test check that KErrArgument is returned when calling the Get function for the 
- * KLbsSpecialFeatureMaximumRequestDelay entry with an out of range delay value.
+ * This test checks that we can retrieve GSM and WCDMA cell info stored in a previous step
  */
 	{
 	__UHEAP_MARK;
@@ -65,19 +64,22 @@
 		CleanupClosePushL(locMonitorDb);
 		CTe_LbsLocationMonitorSuiteStepBase::InitWaitersL();
 
-		// Position that was stored by a previous test (timestampstep.cpp)
+		// GSM position that was stored by a previous test (timestampstep.cpp)
 		TPosition dummy1;
 		dummy1.SetCoordinate(10.33, 54.22, 10.01);
 		dummy1.SetHorizontalAccuracy(100);
 		dummy1.SetVerticalAccuracy(1000);
 				
-		// Check position stored by previous test suite can be retrieved
-		INFO_PRINTF1(_L("Doing a GetPosition. Checking that a record is returned"));
+		// Check GSM position stored by previous test suite can be retrieved
+		INFO_PRINTF1(_L("Doing a GetPosition. Checking that a GSM record is returned"));
 		TLbsLocMonitorAreaInfoGci out;
 		out.iMnc = 1;
 		out.iMcc = 1;
 		out.iLac = 2;
 		out.iCid = 2;
+        out.iValidity = ETrue;
+        out.iIs3gNetworkMode = EFalse;
+		
 		RPointerArray<TLbsLocMonitorAreaInfoBase> outArray;
 		outArray.Append(&out);
 		TPosition outPosition;
@@ -89,6 +91,27 @@
 		TEST(matchLevel.CellIdMatch());
 		ComparePositions(dummy1, outPosition);
 		
+		// Check WCDMA position stored by previous test suite can be retrieved
+		INFO_PRINTF1(_L("Doing a GetPosition. Checking that a WCDMA record is returned"));
+
+		TPosition dummy2;		
+		dummy2.SetCoordinate(30.22, 104.11, 30.03);
+		dummy2.SetHorizontalAccuracy(100);
+		dummy2.SetVerticalAccuracy(1000);
+
+		// Reset the search parameters...
+        out.iIs3gNetworkMode = ETrue;
+		out.iLac = 1;
+
+		outArray.Append(&out);
+		TPosition outPosition2;
+		locMonitorDb.GetPosition(outPosition2, outArray, matchLevel,iWaiter->iStatus);
+		iWaiter->StartAndWait();
+		outArray.Reset();
+		TEST(matchLevel.LocationAreaCodeMatch());
+		TEST(matchLevel.CellIdMatch());
+		ComparePositions(dummy2, outPosition2);
+
 		// Reset DB to initial state again
 		locMonitorDb.ClearDatabase();
 		
--- a/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/replacestep.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/replacestep.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -53,12 +53,13 @@
 TVerdict CReplaceStep::doTestStepL()
 /**
  * @return - TVerdict code
- * This test check that KErrArgument is returned when calling the Get function for the 
- * KLbsSpecialFeatureMaximumRequestDelay entry with an out of range delay value.
+ * This test:
+ *		i)  checks that we can add new positions for the same network parameters (cell id etc). 
+ *		ii) the newest position is retrieved.
  */
 	{
 	__UHEAP_MARK;
-	  if (TestStepResult()==EPass)
+	if (TestStepResult()==EPass)
 		{
 		RLbsLocMonitorDb locMonitorDb = RLbsLocMonitorDb();
 		locMonitorDb.OpenL();
@@ -68,7 +69,13 @@
 		// First Reset DB to initial state
 		locMonitorDb.ClearDatabase();
 		
-		// Add first cell position
+		// We'll keep re-using these...
+		TLbsLocMonitorAreaInfoGci in;
+		TLbsLocMonitorAreaInfoGci out;
+		RPointerArray<TLbsLocMonitorAreaInfoBase> inArray;
+		RPointerArray<TLbsLocMonitorAreaInfoBase> outArray;
+
+		// Add first GSM cell position
 
 		TPosition dummyPos1;
 		dummyPos1.SetCoordinate(10.10, 1.01, 11.11);
@@ -77,25 +84,27 @@
 
 		INFO_PRINTF1(_L("Saving first position"));
 		TRequestStatus status;
-		TLbsLocMonitorAreaInfoGci in1;
-		in1.iMcc = 120;
-		in1.iMnc = 101;
-		in1.iLac = 2000;
-		in1.iCid = 3000;
-		RPointerArray<TLbsLocMonitorAreaInfoBase> in1Array;
-		in1Array.Append(&in1);
-		locMonitorDb.SavePosition(dummyPos1,in1Array,ETrue,iWaiter->iStatus);
+		in.iMcc = 120;
+		in.iMnc = 101;
+		in.iLac = 2000;
+		in.iCid = 3000;
+		in.iValidity = ETrue;
+        in.iIs3gNetworkMode = EFalse;
+
+		inArray.Append(&in);
+		locMonitorDb.SavePosition(dummyPos1,inArray,ETrue,iWaiter->iStatus);
 		iWaiter->StartAndWait();
 		
-		// Check first cell position was correctly stored
+		// Check first GSM cell position was correctly stored
 		INFO_PRINTF1(_L("Retrieving first position"));
-		TLbsLocMonitorAreaInfoGci out1;
-		out1.iMcc = 120;
-		out1.iMnc = 101;
-		out1.iLac = 2000;
-		out1.iCid = 3000;
-		RPointerArray<TLbsLocMonitorAreaInfoBase> outArray;
-		outArray.Append(&out1);
+		out.iMcc = 120;
+		out.iMnc = 101;
+		out.iLac = 2000;
+		out.iCid = 3000;
+        out.iValidity = ETrue;
+        out.iIs3gNetworkMode = EFalse;
+        
+		outArray.Append(&out);
 		TPosition outPosition1;
 		TPositionAreaExtendedInfo matchLevel; 
 		locMonitorDb.GetPosition(outPosition1,outArray,matchLevel,iWaiter->iStatus);
@@ -108,25 +117,20 @@
 			}
 		ComparePositions(dummyPos1,outPosition1);
 	
-		// Add second cell position
+		// Add second GSM cell position
 		TPosition dummyPos2;
 		dummyPos2.SetCoordinate(20.20, 2.02, 22.22);
 		dummyPos2.SetHorizontalAccuracy(200);
 		dummyPos2.SetVerticalAccuracy(2000);		
 		INFO_PRINTF1(_L("Saving second position"));
-		locMonitorDb.SavePosition(dummyPos2,in1Array,ETrue,iWaiter->iStatus);
+		locMonitorDb.SavePosition(dummyPos2,inArray,ETrue,iWaiter->iStatus);
 		iWaiter->StartAndWait();
-		in1Array.Reset();
-		
-		// Check check second cell position has replaced first
-		TLbsLocMonitorAreaInfoGci out2;
-		out2.iMcc = 120;
-		out2.iMnc = 101;
-		out2.iLac = 2000;
-		out2.iCid = 3000;
+		inArray.Reset();
+				
+		// Check that second GSM cell position retrieved.
 		INFO_PRINTF1(_L("Retrieving second position"));
 		TPosition outPosition2;
-		outArray.Append(&out2);
+		outArray.Append(&out);
 		locMonitorDb.GetPosition(outPosition2,outArray,matchLevel,iWaiter->iStatus);
 		iWaiter->StartAndWait();
 		outArray.Reset();
@@ -136,6 +140,72 @@
 			SetTestStepResult(EFail);
 			}
 		ComparePositions(dummyPos2,outPosition2);
+
+		// Add a WCDMA position, check that it doesn't replace the GSM position.
+		TPosition dummyPos3;
+		dummyPos3.SetCoordinate(30.30, 3.03, 33.33);
+		dummyPos3.SetHorizontalAccuracy(300);
+		dummyPos3.SetVerticalAccuracy(3000);
+
+		INFO_PRINTF1(_L("Saving first WCDMA position"));
+        in.iIs3gNetworkMode = ETrue;   // we can re-use in but with different mode!
+		inArray.Append(&in);
+		locMonitorDb.SavePosition(dummyPos3,inArray,ETrue,iWaiter->iStatus);
+		iWaiter->StartAndWait();
+
+		INFO_PRINTF1(_L("Retrieving second GSM position, despite similar WCDMA network parameters"));
+		outArray.Append(&out);
+		TPosition outPosition3;
+		locMonitorDb.GetPosition(outPosition3,outArray,matchLevel,iWaiter->iStatus);
+		iWaiter->StartAndWait();
+		outArray.Reset();
+		if(!matchLevel.CellIdMatch())
+			{
+			ERR_PRINTF2(_L("Read Match Level: %d, Expected 4"), matchLevel.Area());
+			SetTestStepResult(EFail);
+			}
+		ComparePositions(dummyPos2,outPosition3);
+
+		// Retrieving the first WCDMA position
+		out.iIs3gNetworkMode = ETrue;
+
+		outArray.Append(&out);
+		TPosition outPosition4;
+		locMonitorDb.GetPosition(outPosition4,outArray,matchLevel,iWaiter->iStatus);
+		iWaiter->StartAndWait();
+		outArray.Reset();
+		if(!matchLevel.CellIdMatch())
+			{
+			ERR_PRINTF2(_L("Read Match Level: %d, Expected 4"), matchLevel.Area());
+			SetTestStepResult(EFail);
+			}
+		ComparePositions(dummyPos3,outPosition4);
+
+		// Add a second WCDMA position, check that it replaces the first
+		TPosition dummyPos4;
+		dummyPos4.SetCoordinate(40.40, 4.04, 44.44);
+		dummyPos4.SetHorizontalAccuracy(400);
+		dummyPos4.SetVerticalAccuracy(4000);
+
+		INFO_PRINTF1(_L("Saving second WCDMA position"));
+
+		locMonitorDb.SavePosition(dummyPos4,inArray,ETrue,iWaiter->iStatus);
+		iWaiter->StartAndWait();
+		inArray.Reset();
+
+		INFO_PRINTF1(_L("Retrieving second WCDMA position"));
+		outArray.Append(&out);
+		TPosition outPosition5;
+		locMonitorDb.GetPosition(outPosition5,outArray,matchLevel,iWaiter->iStatus);
+		iWaiter->StartAndWait();
+		outArray.Reset();
+		if(!matchLevel.CellIdMatch())
+			{
+			ERR_PRINTF2(_L("Read Match Level: %d, Expected 4"), matchLevel.Area());
+			SetTestStepResult(EFail);
+			}
+		ComparePositions(dummyPos4,outPosition5);
+
 		
 		// Reset DB to initial state again
 		locMonitorDb.ClearDatabase();
--- a/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/timestampstep.cpp	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/te_lbslocmonitordbsuite/src/timestampstep.cpp	Wed Sep 15 00:02:22 2010 +0300
@@ -58,7 +58,7 @@
  */
 	{
 	__UHEAP_MARK;
-	  if (TestStepResult()==EPass)
+	if (TestStepResult()==EPass)
 		{
 		RLbsLocMonitorDb locMonitorDb = RLbsLocMonitorDb();
 		locMonitorDb.OpenL();
@@ -67,7 +67,9 @@
 		
 		locMonitorDb.ClearDatabase();
 		
-		TPosition dummy1, dummy2;
+		TPosition dummy1;
+		TPosition dummy2;
+		TPosition dummy3;
 		
 		dummy1.SetCoordinate(10.33, 54.22, 10.01);
 		dummy1.SetHorizontalAccuracy(100);
@@ -76,13 +78,20 @@
 		dummy2.SetCoordinate(20.22, 74.11, 20.02);
 		dummy2.SetHorizontalAccuracy(100);
 		dummy2.SetVerticalAccuracy(1000);
-		
-		INFO_PRINTF1(_L("Saving 3 records, 1 microsecond apart"));
+
+		dummy3.SetCoordinate(30.22, 104.11, 30.03);
+		dummy3.SetHorizontalAccuracy(100);
+		dummy3.SetVerticalAccuracy(1000);
+
+		INFO_PRINTF1(_L("Saving 3 GSM records, 1 microsecond apart"));
 		TLbsLocMonitorAreaInfoGci in1;
 		in1.iMcc = 1;
 		in1.iMnc = 1;
 		in1.iLac = 1;
 		in1.iCid = 2;
+        in1.iValidity = ETrue;
+        in1.iIs3gNetworkMode = EFalse;
+
 		RPointerArray<TLbsLocMonitorAreaInfoBase> arrayIn1;
 		arrayIn1.Append(&in1);
 		locMonitorDb.SavePosition(dummy1,arrayIn1,ETrue,iWaiter->iStatus);
@@ -95,6 +104,9 @@
 		in2.iMnc = 1;
 		in2.iLac = 1;
 		in2.iCid = 3;
+        in2.iValidity = ETrue;
+        in2.iIs3gNetworkMode = EFalse;
+
 		RPointerArray<TLbsLocMonitorAreaInfoBase> arrayIn2;
 		arrayIn2.Append(&in2);
 		locMonitorDb.SavePosition(dummy2,arrayIn2,ETrue,iWaiter->iStatus);
@@ -107,35 +119,63 @@
 		in3.iMnc = 1;
 		in3.iLac = 2;
 		in3.iCid = 2;
+        in3.iValidity = ETrue;
+        in3.iIs3gNetworkMode = EFalse;
+
 		RPointerArray<TLbsLocMonitorAreaInfoBase> arrayIn3;
 		arrayIn3.Append(&in3);
 		locMonitorDb.SavePosition(dummy1,arrayIn3,ETrue,iWaiter->iStatus);
 		iWaiter->StartAndWait();
 		arrayIn3.Reset();
 		
+		INFO_PRINTF1(_L("Doing a GetLastStoredPosition, Checking that record 3 is returned"));
+		TPosition outPosition1;
+		locMonitorDb.GetLastStoredPosition(outPosition1,iWaiter->iStatus);
+		iWaiter->StartAndWait();
+		ComparePositions(dummy1, outPosition1);
+
+		// Now add a 4th position which is WCDMA....
+		INFO_PRINTF1(_L("Saving a single WCDMA record, 1 microsecond later"));
+		User::After(1);
+		TLbsLocMonitorAreaInfoGci in4;
+		in4.iMcc = 1;
+		in4.iMnc = 1;
+		in4.iLac = 1;
+		in4.iCid = 2;
+        in4.iValidity = ETrue;
+        in4.iIs3gNetworkMode = ETrue;
+
+		RPointerArray<TLbsLocMonitorAreaInfoBase> arrayIn4;
+		arrayIn4.Append(&in4);
+		locMonitorDb.SavePosition(dummy3,arrayIn4, ETrue,iWaiter->iStatus);
+		iWaiter->StartAndWait();
+		arrayIn4.Reset();
+
 		INFO_PRINTF1(_L("Doing a GetPosition that matches 1 & 2, Checking that record 2 is returned"));
 		TLbsLocMonitorAreaInfoGci out;
 		out.iMnc = 1;
 		out.iMcc = 1;
 		out.iLac = 1;
 		out.iCid = 1;
+        out.iValidity = ETrue;
+        out.iIs3gNetworkMode = EFalse;
+
 		RPointerArray<TLbsLocMonitorAreaInfoBase> outArray;
 		outArray.Append(&out);
-		TPosition outPosition;
+		TPosition outPosition2;
 		TPositionAreaExtendedInfo matchLevel;
-		locMonitorDb.GetPosition(outPosition,outArray,matchLevel,iWaiter->iStatus);
+		locMonitorDb.GetPosition(outPosition2,outArray,matchLevel,iWaiter->iStatus);
 		iWaiter->StartAndWait();
 		outArray.Reset();
 		TEST(matchLevel.LocationAreaCodeMatch());
-		ComparePositions(dummy2, outPosition);
+		ComparePositions(dummy2, outPosition2);
 		
-		INFO_PRINTF1(_L("Doing a GetLastStoredPosition, Checking that record 3 is returned"));
-		TPosition outPosition2;
-		locMonitorDb.GetLastStoredPosition(outPosition2,iWaiter->iStatus);
+		INFO_PRINTF1(_L("Doing a GetLastStoredPosition, Checking that WCDMA record 4  is returned"));
+		TPosition outPosition3;
+		locMonitorDb.GetLastStoredPosition(outPosition3,iWaiter->iStatus);
 		iWaiter->StartAndWait();
-		ComparePositions(dummy1, outPosition2);
-		
-		
+		ComparePositions(dummy3, outPosition3);
+				
 		//locMonitorDb.ClearDatabase();
 		CleanupStack::PopAndDestroy(&locMonitorDb);
 		DeleteWaiters();
--- a/locationmgmt/locmonitor/test/testlocationmonitor/inc/lbslocmonitorareainfodefs.h	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationmgmt/locmonitor/test/testlocationmonitor/inc/lbslocmonitorareainfodefs.h	Wed Sep 15 00:02:22 2010 +0300
@@ -76,6 +76,11 @@
 	TUint iMnc; 
 	TUint iLac; 
 	TUint iCid;
+
+	TBool iValidity;
+
+	TBool iIs3gNetworkMode;
+
 };
 
 #endif // LBSLOCMONITORAREAINFODEFS_H
--- a/locationrequestmgmt/locationserver/test/te_locsrv/testdata/te_locsrv_testconfig.txt	Wed Sep 01 12:35:25 2010 +0100
+++ b/locationrequestmgmt/locationserver/test/te_locsrv/testdata/te_locsrv_testconfig.txt	Wed Sep 15 00:02:22 2010 +0300
@@ -1,4 +1,4 @@
-// config.txt
+// te_locsrv_testconfig.txt
 //
 // Copyright (c) 2006 Symbian Software Ltd.  All rights reserved.
 //
@@ -15,16 +15,28 @@
 SubscriberId= 56789012345678
 
 # Current Network Name
-
-NetworkInfo= ABCD, Network0, Vodafone, Voda, Vodafone_UK, 2
+# Note that network type 2 is GSM, network type 6 is CDMA.
+# NetworkInfo= <CountryCode>, <NetworkId>, <DisplayTag>, <NetworkShortName>, <NetworkLongName> , <NetworkAccess> <Network Type>"
+NetworkInfo = 234,            15,         Vodafone,     Voda,               Vodafone_UK,          0,                   2
 
 # Network Registration Status
+# duration of 0 => does not change
 #RegStatus= <Duration>, <RegStatus>, <NetworkIndex>
- 
-RegStatus= 0,5,0 
+RegStatus=     0,           5,                0 
+
+# LocationArea = <AreaKnown>, <LocationAreaCode>, <CellId> . Where <AreaKnown> is -1 for true and 0 for false?! 
+LocationArea =    -1,          1911,              65530
 
 # ONStore= <max number of entries>, <max size of telephone number>, <max text length>
 ONStore= 5, 50, 60
-# ONStoreEntry= <index>, <telephone number>, <TMobileTON type of number>, <TMobileService service type>, <Number Plan>, <name>
-ONStoreEntry= 1, 07747012341, 2, 0, 8, OwnNumber1
+
+# ONStoreEntry= <index>, <telephone number>, <TMobileTON type of number>, <TMobileService service type>, <Number Plan>,   <name>
+ONStoreEntry=       1,        07747012341,        2,                              0,                           8,        OwnNumber1
 
+# <Timeout> is time in sec while this status is valid. The last record lasts until shutdown.
+# <NetworkMode> - the set here has no effect. Please use NetworkInfo records instead.
+# <CellId> set here applies only to GetCellInfo/NotifyCellInfoChanges calls, which are not used. 
+# for getting CellId by our code. We use LocationArea records and GetCurrentNetwork/NotifyCurrentNetworkChange instead.
+# <CellInfoStatus> - The status of cell info. Look at TCellInfoStatus for the list of values.
+# CellInfo = <Timeout>, <NetworkMode>, <CellId>, <TimingAdvance>, <CellInfoStatus> .
+CellInfo =    0,         2,             0,        0,               2