common/tools/ats/smoketest/lbs/lbsclient/src/ctlbsclientpostp257.cpp
changeset 748 e13acd883fbe
child 872 17498133d9ad
equal deleted inserted replaced
747:76f9aaeefbab 748:e13acd883fbe
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 //  INCLUDES
       
    19 #include "ctlbsclientpostp257.h"
       
    20 
       
    21 // CONSTANTS
       
    22 _LIT(KLastPosition, "c:\\private\\101f97b2\\LastKnownPos.dat");
       
    23 
       
    24 // ================= MEMBER FUNCTIONS =======================
       
    25 
       
    26 
       
    27 // ---------------------------------------------------------
       
    28 // Constructor.
       
    29 // ---------------------------------------------------------
       
    30 CT_LbsClientPosTp257::CT_LbsClientPosTp257(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent)
       
    31 	{  
       
    32 	_LIT(KTestName, "Tp257-GetLastKnown Position, update options");
       
    33 	SetTestStepName(KTestName); 
       
    34 	}
       
    35 
       
    36 // ---------------------------------------------------------
       
    37 // Destructor.
       
    38 // ---------------------------------------------------------
       
    39 CT_LbsClientPosTp257::~CT_LbsClientPosTp257()
       
    40 	{
       
    41 	}
       
    42 
       
    43 // ---------------------------------------------------------
       
    44 // CT_LbsClientPosTp257::CloseTest
       
    45 //
       
    46 // (other items were commented in a header).
       
    47 // ---------------------------------------------------------
       
    48 //
       
    49 void CT_LbsClientPosTp257::CloseTest()
       
    50     {
       
    51     // Disconnect disconnects from "iPosServer"
       
    52     Disconnect();
       
    53     }
       
    54 
       
    55 // ---------------------------------------------------------
       
    56 // CT_LbsClientPosTp257::StartL
       
    57 //
       
    58 // (other items were commented in a header).
       
    59 // ---------------------------------------------------------
       
    60 //
       
    61 void CT_LbsClientPosTp257::StartL()
       
    62     {
       
    63 
       
    64     // make sure Server is closed
       
    65     User::After(2100000);
       
    66     
       
    67     // Remove getlastknown data file
       
    68     DeleteFileL(KLastPosition);
       
    69 
       
    70     SetupPsyL(iUidMultiPsy);
       
    71     ConnectL();
       
    72 
       
    73     TInt err = KErrNone;
       
    74 
       
    75     RPositioner positioner1;
       
    76     RPositioner positioner2;
       
    77     TRequestStatus status1;
       
    78     TRequestStatus status2;
       
    79     TPositionInfo moduleInfo1;
       
    80     TPositionInfo moduleInfo2;
       
    81     TPositionInfo moduleInfo3;
       
    82     TPositionInfo moduleInfoMaxAge1;
       
    83     TPositionInfo moduleInfoMaxAge2;
       
    84     
       
    85     // 1) Connect to server and open positioner
       
    86     err = positioner1.Open(iPosServer);
       
    87     CleanupClosePushL(positioner1);
       
    88     if (err != KErrNone)
       
    89     	{
       
    90     	_LIT(KErrorAndLeave, "Could not open positioner");
       
    91     	LogErrorAndLeaveL(KErrorAndLeave);
       
    92     	}
       
    93         
       
    94     _LIT(KKalleService, "KallesService");
       
    95     err = positioner1.SetRequestor(CRequestor::ERequestorService,
       
    96                            CRequestor::EFormatApplication, KKalleService);
       
    97     if (err != KErrNone)
       
    98     	{
       
    99     	_LIT(KErrorAndLeave, "Could not set requestor");
       
   100     	LogErrorAndLeaveL(KErrorAndLeave);
       
   101     	}
       
   102 
       
   103     // 2) Request a position
       
   104     positioner1.NotifyPositionUpdate(moduleInfo1, status1);
       
   105     User::WaitForRequest(status1);
       
   106     if (status1.Int() != KErrNone)
       
   107     	{
       
   108     	_LIT(KErrorAndLeave, "Wrong status1 returned: ");
       
   109     	LogErrorAndLeaveL(KErrorAndLeave, status1.Int());
       
   110     	}
       
   111 
       
   112     // Not included in TC, just test that it is possible to get a lastknownposition
       
   113     positioner1.GetLastKnownPosition(moduleInfo2, status1);
       
   114     User::WaitForRequest(status1);
       
   115     if (status1.Int() != KErrNone)
       
   116     	{
       
   117     	_LIT(KErrorAndLeave, "Wrong status3 returned: ");
       
   118     	LogErrorAndLeaveL(KErrorAndLeave, status1.Int());
       
   119     	}
       
   120 
       
   121     if (!ComparePositionL(moduleInfo1, moduleInfo2))
       
   122         {
       
   123         _LIT(KErrorAndLeave, "1. The old position1 was not returned!!!");
       
   124         LogErrorAndLeaveL(KErrorAndLeave);
       
   125         }
       
   126 
       
   127     // 3) Set update interval to 5 seconds, if there are no ongoing 
       
   128     // position requests a GetLastKnown request is OK
       
   129     TPositionUpdateOptions posOption;
       
   130 	posOption.SetUpdateInterval(TTimeIntervalMicroSeconds(5000000));
       
   131 
       
   132     err = positioner1.SetUpdateOptions(posOption);
       
   133 	_LIT(KChange, "Error when setting update interval, error %d");
       
   134 	AssertTrueL(err == KErrNone, KChange, err);
       
   135 
       
   136     positioner1.GetLastKnownPosition(moduleInfo2, status1);
       
   137     User::WaitForRequest(status1);
       
   138 
       
   139     if (status1.Int() != KErrNone)
       
   140     	{
       
   141     	_LIT(KErrorAndLeave, "KErrNone should be returned from a tracking session");
       
   142     	LogErrorAndLeaveL(KErrorAndLeave, status1.Int());
       
   143     	}
       
   144 
       
   145     // Reset interval
       
   146     posOption.SetUpdateInterval(TTimeIntervalMicroSeconds(0));
       
   147     err = positioner1.SetUpdateOptions(posOption);
       
   148 
       
   149     // Get last known position
       
   150     positioner1.GetLastKnownPosition(moduleInfo3, status1);
       
   151     User::WaitForRequest(status1);
       
   152     if (status1.Int() != KErrNone)
       
   153     	{
       
   154     	_LIT(KErrorAndLeave, "Wrong status1 returned 2: ");
       
   155     	LogErrorAndLeaveL(KErrorAndLeave, status1.Int());
       
   156     	}
       
   157 
       
   158     if (!ComparePositionL(moduleInfo1, moduleInfo3))
       
   159         {
       
   160         _LIT(KErrorAndLeave, "2. The old position2 was not returned!!!");
       
   161         LogErrorAndLeaveL(KErrorAndLeave);
       
   162         }
       
   163 
       
   164     // 5 ) Set maxage to five seconds
       
   165     TPositionUpdateOptions posOption2;
       
   166     posOption2.SetMaxUpdateAge(TTimeIntervalMicroSeconds(5000000));
       
   167 	err = positioner1.SetUpdateOptions(posOption2);
       
   168 	_LIT(KChange1, "Error when setting max age in SetMaxUpdateAge, error %d");
       
   169 	AssertTrueL(err == KErrNone, KChange1, err);
       
   170 
       
   171     //Wait for five seconds
       
   172     User::After(5000000);
       
   173 
       
   174     // 6) Get last known position
       
   175     positioner1.GetLastKnownPosition(moduleInfo3, status1);
       
   176     User::WaitForRequest(status1);
       
   177     if (status1.Int() != KErrNone)
       
   178     	{
       
   179     	_LIT(KErrorAndLeave, "Wrong status1 returned 3");
       
   180     	LogErrorAndLeaveL(KErrorAndLeave);
       
   181     	}
       
   182 
       
   183     if (!ComparePositionL(moduleInfo1, moduleInfo3))
       
   184         {
       
   185         _LIT(KErrorAndLeave, "3. The old position was not returned from positioner!!!");
       
   186         LogErrorAndLeaveL(KErrorAndLeave);
       
   187         }
       
   188 
       
   189     // 7) Open the maxage psy
       
   190     SetupPsyL(iUidTestPsyMaxAge);
       
   191     err = positioner2.Open(iPosServer, iUidTestPsyMaxAge);
       
   192     CleanupClosePushL(positioner2);
       
   193     _LIT(KKalleService2, "KallesService2");
       
   194     err = positioner2.SetRequestor(CRequestor::ERequestorService,
       
   195                            CRequestor::EFormatApplication, KKalleService2);
       
   196 
       
   197     _LIT(KErrOepnMaxAge, "Could not open the maxage psy");
       
   198 	AssertTrueL(err == KErrNone, KErrOepnMaxAge, err);
       
   199 
       
   200     positioner2.NotifyPositionUpdate(moduleInfoMaxAge1, status2);
       
   201     User::WaitForRequest(status2);
       
   202     err = status2.Int();
       
   203     if (err != KErrNone)
       
   204     	{
       
   205     	_LIT(KErrorAndLeave, "Wrong status2 returned");
       
   206     	LogErrorAndLeaveL(KErrorAndLeave);
       
   207     	}
       
   208 
       
   209     // 8)
       
   210     positioner1.NotifyPositionUpdate(moduleInfo1, status1);
       
   211     User::WaitForRequest(status1);
       
   212     err = status1.Int();
       
   213 
       
   214     // 9) Set maxage to four seconds for positioner2
       
   215     posOption2.SetMaxUpdateAge(TTimeIntervalMicroSeconds(4000000));
       
   216 	err = positioner2.SetUpdateOptions(posOption2);
       
   217 	_LIT(KErrSetMaxAge, "Error when setting max age in SetMaxUpdateAge, error %d");
       
   218 	AssertTrueL(err == KErrNone, KErrSetMaxAge, err);
       
   219 
       
   220     positioner2.NotifyPositionUpdate(moduleInfoMaxAge2, status2);
       
   221     User::WaitForRequest(status2);
       
   222     err = status2.Int();
       
   223     if (err != KErrNone) 
       
   224     	{
       
   225     	_LIT(KErrorAndLeave, "Wrong status2 returned");
       
   226     	LogErrorAndLeaveL(KErrorAndLeave);
       
   227     	}
       
   228     // Check moduleInfoMaxAge2 and moduleInfoMaxAge1 here, should be the same
       
   229     _LIT(KCheckMaxAge, "Check MaxAge position");
       
   230     INFO_PRINTF1(KCheckMaxAge);
       
   231     if (!ComparePositionL(moduleInfoMaxAge1, moduleInfoMaxAge2))
       
   232         {
       
   233         _LIT(KErrorAndLeave, "The maxage position was not returned from maxage positioner!!!");
       
   234         LogErrorAndLeaveL(KErrorAndLeave);
       
   235         }
       
   236     // Close maxage positioner
       
   237     positioner2.Close();
       
   238 
       
   239     // 10) Check moduleInfo2 and moduleInfo1 here, should be the same
       
   240     positioner1.GetLastKnownPosition(moduleInfo2, status1);
       
   241     User::WaitForRequest(status1);
       
   242     if (!ComparePositionL(moduleInfo2, moduleInfo1))
       
   243         {
       
   244         _LIT(KErrorAndLeave, "The same maxage position was not returned from positioner for client 1!!!");
       
   245         LogErrorAndLeaveL(KErrorAndLeave);
       
   246         }
       
   247 
       
   248     // 11)
       
   249     TPositionUpdateOptions posOption3;
       
   250     posOption3.SetUpdateTimeOut(TTimeIntervalMicroSeconds(4000000));
       
   251 	err = positioner1.SetUpdateOptions(posOption3);
       
   252 	_LIT(KErrSetTimeout, "Error when setting timeout in SetUpdateOptions, error %d");
       
   253 	AssertTrueL(err == KErrNone, KErrSetTimeout, err);
       
   254 
       
   255 	_LIT(KWaitForCancel, "Wait for cancel...");
       
   256     INFO_PRINTF1(KWaitForCancel);
       
   257     
       
   258     // 12)
       
   259     positioner1.GetLastKnownPosition(moduleInfo2, status1);
       
   260 
       
   261     // Wait for five seconds
       
   262     User::After(5000000);
       
   263     _LIT(KWaitForRequest, "Wait for WaitForRequest(status1)...");
       
   264     INFO_PRINTF1(KWaitForRequest);   
       
   265     User::WaitForRequest(status1);
       
   266     // Check moduleInfo2 and moduleInfo1 here, should be the same
       
   267     if (!ComparePositionL(moduleInfo2, moduleInfo1))
       
   268         {
       
   269         _LIT(KErrorAndLeave, "4. The same position was not returned from positioner for client 1!!!");
       
   270         LogErrorAndLeaveL(KErrorAndLeave);
       
   271         }
       
   272 
       
   273     // 13 ) Check with partial update
       
   274     SetupPsyL(iUidTestPsyPartialUpdate);
       
   275     err = positioner2.Open(iPosServer, iUidTestPsyPartialUpdate);
       
   276     if (err != KErrNone)
       
   277     	{
       
   278     	_LIT(KErrorAndLeave, "Could not open PartialUpdate positioner");
       
   279     	LogErrorAndLeaveL(KErrorAndLeave);
       
   280     	}
       
   281 
       
   282     _LIT(KPellesService, "PellesService");
       
   283     err = positioner2.SetRequestor(CRequestor::ERequestorService,
       
   284                            CRequestor::EFormatApplication, KPellesService);
       
   285 
       
   286     // Get a position from partial update psy
       
   287     positioner2.NotifyPositionUpdate(moduleInfo1, status2);
       
   288     User::WaitForRequest(status2);
       
   289     err = status2.Int();
       
   290     if (err != KErrNone)
       
   291     	{
       
   292     	_LIT(KErrorAndLeave, "Wrong status returned from partial update psy");
       
   293     	LogErrorAndLeaveL(KErrorAndLeave, err);
       
   294     	}
       
   295 
       
   296     TPositionUpdateOptions updateOptions;
       
   297     updateOptions.SetAcceptPartialUpdates(ETrue);
       
   298     err = positioner2.SetUpdateOptions(updateOptions);
       
   299     _LIT(KErrSetPartialupdate, "Error when setting partialupdate in SetUpdateOptions, error %d");
       
   300     AssertTrueL(err == KErrNone, KErrSetPartialupdate, err);
       
   301 
       
   302     // 14) GetLastKnownPosition from partial update psy
       
   303     positioner2.GetLastKnownPosition(moduleInfo2, status1);
       
   304     User::WaitForRequest(status1);
       
   305     // Check moduleInfo2 and moduleInfo1 here, should be the same
       
   306     if (!ComparePositionL(moduleInfo2, moduleInfo1))
       
   307         {
       
   308         _LIT(KErrorAndLeave, "5. The same partial update position was not returned from positioner!!!");
       
   309         LogErrorAndLeaveL(KErrorAndLeave);
       
   310         }
       
   311 
       
   312     // 15) Get another position from partial update psy, this should be a partial update position
       
   313     // and should not be saved as lastknownposition
       
   314     positioner2.NotifyPositionUpdate(moduleInfo1, status2);
       
   315     User::WaitForRequest(status2);
       
   316     err = status2.Int();
       
   317     if (err != KPositionPartialUpdate)
       
   318     	{
       
   319     	_LIT(KErrorAndLeave, "Partial Update PSY did not return KPositionPartialUpdate");
       
   320     	LogErrorAndLeaveL(KErrorAndLeave, err);
       
   321     	}
       
   322 
       
   323     // 16) GetLastKnownPosition from partial update psy
       
   324     positioner2.GetLastKnownPosition(moduleInfo3, status1);
       
   325     User::WaitForRequest(status1);
       
   326     // Check moduleInfo2 and moduleInfo1 here, should NOT be the same
       
   327     if (ComparePositionL(moduleInfo1, moduleInfo2))
       
   328         {
       
   329         _LIT(KErrorAndLeave, "6. The partial update position should NOT have been returned");
       
   330         LogErrorAndLeaveL(KErrorAndLeave);
       
   331         }
       
   332 
       
   333     // Check moduleInfo3 and moduleInfo2 here, should be the same
       
   334     if (ComparePositionL(moduleInfo3, moduleInfo1))
       
   335         {
       
   336         _LIT(KErrorAndLeave, "7. The old position was not returned");
       
   337         LogErrorAndLeaveL(KErrorAndLeave);
       
   338         }
       
   339 
       
   340     // Close all connections
       
   341     positioner1.Close();
       
   342     positioner2.Close();
       
   343     
       
   344     // 17 ) Start a periodic update session 
       
   345     _LIT(KPeriodicUpdate, "Checking periodic update session");
       
   346     INFO_PRINTF1(KPeriodicUpdate);
       
   347 	posOption.SetUpdateInterval(TTimeIntervalMicroSeconds(5000000));
       
   348 
       
   349     // Connect to server and open positioner
       
   350     err = positioner1.Open(iPosServer);
       
   351     if (err != KErrNone)
       
   352     	{
       
   353     	_LIT(KErrorAndLeave, "Could not open positioner");
       
   354     	LogErrorAndLeaveL(KErrorAndLeave);
       
   355     	}
       
   356         
       
   357     _LIT(KKallesPeriodicService, "KallesPeriodicService");
       
   358     err = positioner1.SetRequestor(CRequestor::ERequestorService,
       
   359                            CRequestor::EFormatApplication, KKallesPeriodicService);
       
   360     if (err != KErrNone)
       
   361     	{
       
   362     	_LIT(KErrorAndLeave, "Could not set requestor");
       
   363     	LogErrorAndLeaveL(KErrorAndLeave);
       
   364     	}
       
   365 
       
   366     err = positioner1.SetUpdateOptions(posOption);
       
   367     _LIT(KErrSetUpdateOption, "Could not set updateoptions");
       
   368 	AssertTrueL(err == KErrNone, KErrSetUpdateOption, err);
       
   369     
       
   370     TRequestStatus status;
       
   371     positioner1.NotifyPositionUpdate(moduleInfo1, status);
       
   372     User::WaitForRequest(status);
       
   373 
       
   374     posOption.SetUpdateInterval(TTimeIntervalMicroSeconds(0));
       
   375     // Settings update interval to 0 should stop the periodic update
       
   376     err = positioner1.SetUpdateOptions(posOption);
       
   377     _LIT(KErrSetUpdateOption2, "Could not set updateoptions2");
       
   378 	AssertTrueL(err == KErrNone, KErrSetUpdateOption2, err);
       
   379 
       
   380     // Get GetLastKnownPosition from the stopped periodic update session
       
   381     positioner1.GetLastKnownPosition(moduleInfo2, status);
       
   382     User::WaitForRequest(status);
       
   383     // Check moduleInfo2 and moduleInfo1 here, should be the same
       
   384     if (!ComparePositionL(moduleInfo1, moduleInfo2))
       
   385         {
       
   386         _LIT(KErrorAndLeave, "1. The periodic update session position was not equal to getlastknown position");
       
   387         LogErrorAndLeaveL(KErrorAndLeave);
       
   388         }
       
   389 
       
   390     positioner1.Close();
       
   391     moduleInfo1 = TPositionInfo();
       
   392     moduleInfo2 = TPositionInfo();
       
   393 
       
   394     // 18 ) Start a periodic update session
       
   395     INFO_PRINTF1(KPeriodicUpdate);
       
   396 	posOption.SetUpdateInterval(TTimeIntervalMicroSeconds(5000000));
       
   397 
       
   398     // Connect to server and open positioner
       
   399     err = positioner1.Open(iPosServer);
       
   400     if (err != KErrNone)
       
   401     	{
       
   402     	_LIT(KErrorAndLeave, "Could not open positioner");
       
   403     	LogErrorAndLeaveL(KErrorAndLeave);
       
   404     	}
       
   405         
       
   406     err = positioner1.SetRequestor(CRequestor::ERequestorService,
       
   407                            CRequestor::EFormatApplication, KKallesPeriodicService);
       
   408     if (err != KErrNone)
       
   409     	{
       
   410     	_LIT(KErrorAndLeave, "Could not set requestor");
       
   411     	LogErrorAndLeaveL(KErrorAndLeave);
       
   412     	}
       
   413 
       
   414     // Connect to server and open positioner
       
   415     err = positioner2.Open(iPosServer);
       
   416     if (err != KErrNone)
       
   417     	{
       
   418     	_LIT(KErrorAndLeave, "Could not open positioner2");
       
   419     	LogErrorAndLeaveL(KErrorAndLeave);
       
   420     	}
       
   421         
       
   422     err = positioner2.SetRequestor(CRequestor::ERequestorService,
       
   423                            CRequestor::EFormatApplication, KKallesPeriodicService);
       
   424     if (err != KErrNone)
       
   425     	{
       
   426     	_LIT(KErrorAndLeave, "Could not set requestor");
       
   427     	LogErrorAndLeaveL(KErrorAndLeave);
       
   428     	}
       
   429 
       
   430 
       
   431     err = positioner1.SetUpdateOptions(posOption);
       
   432 	AssertTrueL(err == KErrNone, KErrSetUpdateOption, err);
       
   433 
       
   434     positioner1.NotifyPositionUpdate(moduleInfo1, status);
       
   435     User::WaitForRequest(status);
       
   436     
       
   437     posOption.SetUpdateInterval(TTimeIntervalMicroSeconds(0));
       
   438     // Settings update interval to 0 should stop the periodic update
       
   439     err = positioner1.SetUpdateOptions(posOption);
       
   440 	AssertTrueL(err == KErrNone, KErrSetUpdateOption2, err);
       
   441 
       
   442     positioner2.GetLastKnownPosition(moduleInfo2, status1);
       
   443     User::WaitForRequest(status1);
       
   444 
       
   445     // Check moduleInfo2 and moduleInfo1 here, should be the same
       
   446     if (!ComparePositionL(moduleInfo1, moduleInfo2))
       
   447         {
       
   448         _LIT(KErrorAndLeave, "2. The periodic update session position was not equal to getlastknown position");
       
   449         LogErrorAndLeaveL(KErrorAndLeave);
       
   450         }
       
   451 
       
   452     positioner1.Close();
       
   453     positioner2.Close();
       
   454 
       
   455     CleanupStack::PopAndDestroy(1); //positioner2
       
   456     CleanupStack::PopAndDestroy(1); //positioner1
       
   457     }
       
   458 
       
   459 // ---------------------------------------------------------
       
   460 // CT_LbsClientPosTp257::ComparePositionL
       
   461 //
       
   462 // (other items were commented in a header).
       
   463 // ---------------------------------------------------------
       
   464 //
       
   465 TBool CT_LbsClientPosTp257::ComparePositionL(TPositionInfo aPosInfo1, TPositionInfo aPosInfo2)
       
   466     {
       
   467     _LIT(KFunctionName, "We are inside ComparePositionL");
       
   468     INFO_PRINTF1(KFunctionName);
       
   469     TBool result = ETrue;
       
   470     TBuf<150> buf;
       
   471 
       
   472     TPosition pos1 = TPosition();
       
   473     TPosition pos2 = TPosition();
       
   474     aPosInfo1.GetPosition(pos1);
       
   475     aPosInfo2.GetPosition(pos2);
       
   476 
       
   477     TTime time1 = pos1.Time();
       
   478     TTime time2 = pos2.Time();
       
   479 
       
   480     if (time1 == time2)
       
   481         {
       
   482         _LIT(KTime, "Equal Time");
       
   483         INFO_PRINTF1(KTime);
       
   484         }
       
   485     else 
       
   486     	{
       
   487     	_LIT(KTime, "NOT Equal Time");
       
   488     	INFO_PRINTF1(KTime);
       
   489     	}
       
   490 
       
   491     if ((time1 != time2) || (pos1.Latitude() != pos2.Latitude()) || 
       
   492         (pos1.Longitude() != pos2.Longitude()) || 
       
   493         (pos1.Altitude() != pos2.Altitude()) )
       
   494         {
       
   495         // Not equal
       
   496         result = EFalse;
       
   497         _LIT(KNotEqual, "Not equal");
       
   498         INFO_PRINTF1(KNotEqual);
       
   499         _LIT(KPosition1, "Position1: Lat %f Long %f Alt %f");
       
   500         buf.Format(KPosition1, pos1.Latitude(), pos1.Longitude() ,pos1.Altitude());
       
   501         INFO_PRINTF1(buf);
       
   502         _LIT(KPosition2, "Position2: Lat %f Long %f Alt %f");
       
   503         buf.Format(KPosition2, pos2.Latitude(), pos2.Longitude() ,pos2.Altitude());
       
   504         INFO_PRINTF1(buf);
       
   505         }
       
   506     else
       
   507         {
       
   508         _LIT(KEqual, "Equal");
       
   509         INFO_PRINTF1(KEqual);
       
   510         result = ETrue;
       
   511         _LIT(KPosition1, "Position1: Lat %f Long %f Alt %f");
       
   512         buf.Format(KPosition1, pos1.Latitude(), pos1.Longitude() ,pos1.Altitude());
       
   513         INFO_PRINTF1(buf);
       
   514         }
       
   515     return result;
       
   516     }
       
   517 
       
   518 // ---------------------------------------------------------
       
   519 // CT_LbsClientPosTp257::DeleteFileL
       
   520 //
       
   521 // (other items were commented in a header).
       
   522 // ---------------------------------------------------------
       
   523 //
       
   524 void CT_LbsClientPosTp257::DeleteFileL(const TDesC& aFile)
       
   525     {
       
   526     RFs fs;
       
   527     TInt err = fs.Connect();
       
   528 
       
   529     err = fs.Delete(aFile);
       
   530     fs.Close();
       
   531     if (err == KErrNone)
       
   532         {
       
   533         _LIT(KDebugText, "TP257: The specified file deleted");
       
   534         INFO_PRINTF1(KDebugText);
       
   535         }
       
   536     else
       
   537         {
       
   538         if (err == KErrInUse)
       
   539             {
       
   540             _LIT(KErrText, "TP257: The specified file could not be deleted it is already in use, errorcode %d");
       
   541             INFO_PRINTF1(aFile);
       
   542             TBuf<100> buf;
       
   543             buf.Format(KErrText, err);
       
   544             AssertTrueL(err==0, KErrText, err);
       
   545             }
       
   546         else if (err == KErrNotFound)
       
   547             {
       
   548             _LIT(KDebugText, "TP257: The specified file could not be found ,errorcode %d");
       
   549             TBuf<100> buf;
       
   550             buf.Format(KDebugText, err);
       
   551             INFO_PRINTF1(buf);
       
   552             }
       
   553         else
       
   554             {
       
   555             _LIT(KErrText, "TP257: The specified file could not be deleted, errorcode %d");
       
   556             TBuf<100> buf;
       
   557             buf.Format(KErrText, err);
       
   558             AssertTrueL(err==0, KErrText, err);
       
   559             }
       
   560         }
       
   561     }
       
   562 
       
   563 // ---------------------------------------------------------
       
   564 // CT_LbsClientPosTp254::FileExistsL
       
   565 //
       
   566 // (other items were commented in a header).
       
   567 // ---------------------------------------------------------
       
   568 //
       
   569 TBool CT_LbsClientPosTp257::FileExistsL(const TDesC& aFile)
       
   570     {
       
   571     TBool exist = EFalse;
       
   572     RFs fs;
       
   573     RFile file;
       
   574     TInt err = fs.Connect();
       
   575 
       
   576     err = file.Open(fs, aFile, EFileRead);
       
   577     if (err==KErrNotFound) // file does not exist
       
   578         {
       
   579         fs.Close();
       
   580         _LIT(KErrText, "TP257: The specified file does not exist");
       
   581         INFO_PRINTF1(KErrText);
       
   582         }
       
   583     else
       
   584         {
       
   585         exist = ETrue;
       
   586         _LIT(KErrText, "TP257: The specified file exists");
       
   587         INFO_PRINTF1(KErrText);
       
   588         file.Close();
       
   589         fs.Close();
       
   590         }
       
   591     return exist;
       
   592     }