|
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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-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 "ctlbssimulationpsypostp221.h" |
|
20 |
|
21 // CONSTANTS |
|
22 #ifdef __WINS__ |
|
23 // Nmea raw data files |
|
24 _LIT(KMagellanGPS315, "z:\\system\\test\\testdata\\MagellanGPS315.nme"); |
|
25 //Ini files to corresponding nmea raw data file |
|
26 #else |
|
27 // Nmea raw data files |
|
28 _LIT(KMagellanGPS315, "c:\\system\\test\\testdata\\MagellanGPS315.nme"); |
|
29 //Ini files to corresponding nmea raw data file |
|
30 #endif |
|
31 |
|
32 |
|
33 // ================= MEMBER FUNCTIONS ======================= |
|
34 |
|
35 // --------------------------------------------------------- |
|
36 // Constructor. |
|
37 // --------------------------------------------------------- |
|
38 CT_LbsSimulationPSYPosTp221::CT_LbsSimulationPSYPosTp221(CT_LbsServer& aParent): CT_LbsPortedStepBase(aParent) |
|
39 { |
|
40 _LIT(KTestName, "TP221 - Reset of incoming request"); |
|
41 SetTestStepName(KTestName); |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------- |
|
45 // Destructor. |
|
46 // --------------------------------------------------------- |
|
47 CT_LbsSimulationPSYPosTp221::~CT_LbsSimulationPSYPosTp221() |
|
48 { |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------- |
|
52 // CT_LbsSimulationPSYPosTp221::CloseTest() |
|
53 // |
|
54 // (other items were commented in a header). |
|
55 // --------------------------------------------------------- |
|
56 // |
|
57 void CT_LbsSimulationPSYPosTp221::CloseTest() |
|
58 { |
|
59 ClosePositioner(); |
|
60 Disconnect(); |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------- |
|
64 // CT_LbsSimulationPSYPosTp221::StartL |
|
65 // |
|
66 // (other items were commented in a header). |
|
67 // --------------------------------------------------------- |
|
68 // |
|
69 void CT_LbsSimulationPSYPosTp221::StartL() |
|
70 { |
|
71 TBool errorDuringExecution = FALSE; // True if an error occurs |
|
72 |
|
73 //Connect to Epos |
|
74 ConnectL(); |
|
75 //Set up PSY |
|
76 SetupPsyL(iUidSimulationPsy); |
|
77 _LIT(KServiceName, "SAAA"); |
|
78 // Use correct nmea file |
|
79 SetSimDataFileL(KMagellanGPS315); |
|
80 |
|
81 //Open positioner |
|
82 User::LeaveIfError(OpenPositionerByName(iUidSimulationPsy)); |
|
83 |
|
84 //The position object. Don't request any fields! |
|
85 HPositionGenericInfo* positioninfo = HPositionGenericInfo::NewLC(); |
|
86 |
|
87 //Setting up the position object: |
|
88 //Set update type |
|
89 positioninfo->SetUpdateType(EPositionUpdateUnknown); |
|
90 //Set "old data" that should be erased by Psy when making a new position request |
|
91 TInt8 numsats = 7; //just magic numbers... |
|
92 TReal32 speed = 32; |
|
93 User::LeaveIfError(positioninfo->SetValue(EPositionFieldSatelliteNumUsed, numsats)); |
|
94 User::LeaveIfError(positioninfo->SetValue(EPositionFieldHorizontalSpeed, speed)); |
|
95 |
|
96 //Make a position request! |
|
97 User::LeaveIfError(PerformSyncRequest(KServiceName, positioninfo)); |
|
98 |
|
99 //Checking returned position object |
|
100 if (positioninfo->UpdateType() != EPositionUpdateGeneral) |
|
101 { |
|
102 _LIT( KWrongUpdateType, "Wrong Update Type! EPositionUpdateGeneral expected." ); |
|
103 ERR_PRINTF1(KWrongUpdateType); |
|
104 errorDuringExecution = TRUE; |
|
105 } |
|
106 |
|
107 TInt err1 = positioninfo->GetValue(EPositionFieldSatelliteNumUsed, numsats); |
|
108 TInt err2 = positioninfo->GetValue(EPositionFieldHorizontalSpeed, speed); |
|
109 |
|
110 if (err1 != KErrNotFound || err2 != KErrNotFound) |
|
111 { |
|
112 _LIT( KValueReturned, "HPositionGenericInfo::GetValue() returned value!" ); |
|
113 ERR_PRINTF1(KValueReturned); |
|
114 errorDuringExecution = TRUE; |
|
115 } |
|
116 |
|
117 //Close Positioner |
|
118 ClosePositioner(); |
|
119 |
|
120 //Disconnect from Epos |
|
121 Disconnect(); |
|
122 |
|
123 //Cleaning |
|
124 CleanupStack::PopAndDestroy(positioninfo); |
|
125 //Checking if any errors occured during execution |
|
126 if (errorDuringExecution) |
|
127 { |
|
128 _LIT(KErrorAndLeave, "Error(s) occured during execution, closing test!"); |
|
129 LogErrorAndLeaveL(KErrorAndLeave); |
|
130 } |
|
131 } |
|
132 |
|
133 |