16 /** |
16 /** |
17 @file |
17 @file |
18 */ |
18 */ |
19 |
19 |
20 #include "Te_StatusReportScheme.h" |
20 #include "Te_StatusReportScheme.h" |
|
21 |
21 #include <gsmuelem.h> |
22 #include <gsmuelem.h> |
22 |
23 |
23 CTestStatusReportScheme::CTestStatusReportScheme() |
24 CSmsStatusReportSchemeTestStep::CSmsStatusReportSchemeTestStep() |
24 { |
25 { |
25 |
26 |
26 } |
27 } |
27 |
28 |
28 CTestStatusReportScheme::~CTestStatusReportScheme() |
29 CSmsStatusReportSchemeTestStep::~CSmsStatusReportSchemeTestStep() |
29 { |
30 { |
30 |
31 |
31 } |
32 } |
32 |
33 |
33 TVerdict CTestStatusReportScheme::doTestStepPreambleL() |
34 TVerdict CSmsStatusReportSchemeTestStep::doTestStepPreambleL() |
34 { |
35 { |
35 //Call base class preamble |
36 //Call base class preamble |
36 CSmsPrtTestStep::doTestStepPreambleL(); |
37 CSmsBaseTestStep::doTestStepPreambleL(); |
37 |
38 |
38 // delete segmentation and reassembly store files before the test |
39 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer,iSocket,ESmsAddrRecvAny); |
39 _LIT(KReassemblyStoreName,"C:\\Private\\101F7989\\sms\\smsreast.dat"); |
40 |
40 _LIT(KSegmentationStoreName,"C:\\Private\\101F7989\\sms\\smssegst.dat"); |
41 SetCodingScheme(); |
41 _LIT(KWapReassemblyStoreName,"C:\\Private\\101F7989\\sms\\wapreast.dat"); |
42 GetNumberOfPDUs(); |
42 |
43 |
43 iFs.Delete(KWapReassemblyStoreName); |
44 return TestStepResult() ; |
44 iFs.Delete(KReassemblyStoreName); |
45 } |
45 iFs.Delete(KSegmentationStoreName); |
46 |
46 |
47 TVerdict CSmsStatusReportSchemeTestStep::doTestStepPostambleL() |
47 SetTestNumberL(); |
48 { |
48 OpenSocketServerL(); |
49 iSocket.Close(); |
49 SetCodingScheme(); |
50 |
50 GetNumberOfPDUs(); |
51 CSmsBaseTestStep::doTestStepPostambleL(); |
51 |
52 |
52 return TestStepResult() ; |
53 return TestStepResult() ; |
53 } |
54 } |
54 |
55 |
55 TVerdict CTestStatusReportScheme::doTestStepPostambleL() |
56 void CSmsStatusReportSchemeTestStep::OpenSocketServerL() |
56 { |
|
57 iSocket.Close(); |
|
58 iSocketServer.Close(); |
|
59 |
|
60 //Call base class postamble |
|
61 CSmsPrtTestStep::doTestStepPostambleL(); |
|
62 |
|
63 return TestStepResult() ; |
|
64 } |
|
65 |
|
66 void CTestStatusReportScheme::SetTestNumberL() |
|
67 { |
|
68 TInt testNumber; |
|
69 GetIntFromConfig(ConfigSection(), _L("testNumber"), testNumber); |
|
70 |
|
71 RProperty testNumberProperty; |
|
72 User::LeaveIfError(testNumberProperty.Attach(KUidPSSimTsyCategory, KPSSimTsyTestNumber)); |
|
73 CleanupClosePushL(testNumberProperty); |
|
74 |
|
75 TRequestStatus status; |
|
76 testNumberProperty.Subscribe(status); |
|
77 INFO_PRINTF1(_L("Setting Sim.Tsy test number P&S property")); |
|
78 User::LeaveIfError(testNumberProperty.Set(KUidPSSimTsyCategory,KPSSimTsyTestNumber,testNumber)); |
|
79 User::WaitForRequest(status); |
|
80 TEST(status.Int() == KErrNone); |
|
81 TInt testNumberCheck; |
|
82 User::LeaveIfError(testNumberProperty.Get(testNumberCheck)); |
|
83 if (testNumber != testNumberCheck) |
|
84 { |
|
85 INFO_PRINTF3(_L("Test number property set to [%d], but value returned is [%d]"),testNumber,testNumberCheck); |
|
86 User::Leave(KErrNotFound); |
|
87 } |
|
88 |
|
89 CleanupStack::PopAndDestroy(&testNumberProperty); |
|
90 } |
|
91 |
|
92 void CTestStatusReportScheme::OpenSocketServerL() |
|
93 { |
57 { |
94 INFO_PRINTF1(_L("Connecting to SocketServer ...")); |
58 INFO_PRINTF1(_L("Connecting to SocketServer ...")); |
95 TInt ret=iSocketServer.Connect(KSocketMessageSlots); |
59 TInt ret=iSocketServer.Connect(KSocketMessageSlots); |
96 TEST(ret == KErrNone); |
60 TEST(ret == KErrNone); |
97 |
61 |
98 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,iSocket,ESmsAddrRecvAny); |
62 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer,iSocket,ESmsAddrRecvAny); |
99 CleanupStack::Pop(); // Pop off iSocket which is a member variable! |
|
100 } |
63 } |
101 |
64 |
102 |
65 |
103 void CTestStatusReportScheme::CreateSmsL(TCodingScheme aCodingScheme ,TPtrC aConfigSectionEntry) |
66 void CSmsStatusReportSchemeTestStep::CreateSmsL(TCodingScheme aCodingScheme ,TPtrC aConfigSectionEntry) |
104 { |
67 { |
105 TSmsDataCodingScheme::TSmsAlphabet alphabet; |
68 TSmsDataCodingScheme::TSmsAlphabet alphabet; |
106 |
69 |
107 if (aCodingScheme == ESevenBit) |
70 if (aCodingScheme == ESevenBit) |
108 { |
71 { |
117 |
80 |
118 TPtrC messageText; |
81 TPtrC messageText; |
119 GetStringFromConfig(ConfigSection(), aConfigSectionEntry, messageText); |
82 GetStringFromConfig(ConfigSection(), aConfigSectionEntry, messageText); |
120 |
83 |
121 iSmsMessage=CreateSmsMessageL(messageText,alphabet); |
84 iSmsMessage=CreateSmsMessageL(messageText,alphabet); |
122 } // CTestStatusReportScheme::CreateSmsL |
85 } |
123 |
86 |
124 |
87 void CSmsStatusReportSchemeTestStep::TriggerReceiveL() |
125 void CTestStatusReportScheme::TriggerReceiveL() |
88 { |
126 { |
89 CreateSmsL(EEightBit,_L("trigger")); |
127 CreateSmsL(EEightBit,_L("trigger")); |
90 SendSmsMessageL(); |
128 SendSmsMessageL(); |
91 } |
129 } |
92 |
130 |
93 void CSmsStatusReportSchemeTestStep::SendSmsMessageL() |
131 void CTestStatusReportScheme::SendSmsMessageL() |
94 { |
132 { |
95 SendSmsL(iSmsMessage,iSocket); |
133 SendSmsL(iSmsMessage,iSocket); |
96 } |
134 } |
97 |
135 |
98 void CSmsStatusReportSchemeTestStep::SetCodingScheme() |
136 void CTestStatusReportScheme::SetCodingScheme() |
99 { |
137 { |
100 TInt codingScheme; |
138 TInt codingScheme; |
101 GetIntFromConfig(ConfigSection(), _L("messageCoding"), codingScheme); |
139 GetIntFromConfig(ConfigSection(), _L("messageCoding"), codingScheme); |
102 iDataCodingScheme = (TCodingScheme)codingScheme; |
140 iDataCodingScheme = (TCodingScheme)codingScheme; |
103 |
141 |
104 } |
142 } |
105 |
143 |
106 void CSmsStatusReportSchemeTestStep::GetNumberOfPDUs() |
144 void CTestStatusReportScheme::GetNumberOfPDUs() |
107 { |
145 { |
108 GetIntFromConfig(ConfigSection(), _L("numberOfPDUs"), iNumberOfPDUs); |
146 GetIntFromConfig(ConfigSection(), _L("numberOfPDUs"), iNumberOfPDUs); |
109 } |
147 } |
|
148 |
110 |
149 /** |
111 /** |
150 Sets the TP-SRR bit in every PDU |
112 Sets the TP-SRR bit in every PDU |
151 */ |
113 */ |
152 void CTestStatusReportScheme::SetAllTPSRRsL() |
114 void CSmsStatusReportSchemeTestStep::SetAllTPSRRsL() |
153 { |
115 { |
154 CSmsTPSRROperations& TPSRROperations = static_cast<CSmsTPSRROperations&>(iSmsMessage->GetOperationsForNonIEL(ESmsTPSRRParameter)); |
116 CSmsTPSRROperations& TPSRROperations = static_cast<CSmsTPSRROperations&>(iSmsMessage->GetOperationsForNonIEL(ESmsTPSRRParameter)); |
155 TPSRROperations.SetSchemeL(); |
117 TPSRROperations.SetSchemeL(); |
156 |
118 |
157 //Set TPSRR for all PDUs |
119 //Set TPSRR for all PDUs |
158 for(TInt i=0; i< iNumberOfPDUs; i++) |
120 for(TInt i=0; i< iNumberOfPDUs; ++i) |
159 { |
121 { |
160 TPSRROperations.SetSegmentStatusReportL(i,ETrue); |
122 TPSRROperations.SetSegmentStatusReportL(i,ETrue); |
161 } |
123 } |
162 |
124 } |
163 } |
|
164 |
125 |
165 /** |
126 /** |
166 Set TPSRR bit for the last segment of message |
127 Set TPSRR bit for the last segment of message |
167 */ |
128 */ |
168 void CTestStatusReportScheme::SetLastTPSRRL() |
129 void CSmsStatusReportSchemeTestStep::SetLastTPSRRL() |
169 { |
130 { |
170 CSmsTPSRROperations& TPSRROperations = static_cast<CSmsTPSRROperations&>(iSmsMessage->GetOperationsForNonIEL(ESmsTPSRRParameter)); |
131 CSmsTPSRROperations& TPSRROperations = static_cast<CSmsTPSRROperations&>(iSmsMessage->GetOperationsForNonIEL(ESmsTPSRRParameter)); |
171 TPSRROperations.SetSchemeL(); |
132 TPSRROperations.SetSchemeL(); |
172 TPSRROperations.SetLastSegmentStatusReportL(ETrue); |
133 TPSRROperations.SetLastSegmentStatusReportL(ETrue); |
173 } |
134 } |
174 |
135 |
175 /** |
136 /** |
176 Set TPSRR bit for some segments |
137 Set TPSRR bit for some segments |
177 */ |
138 */ |
178 void CTestStatusReportScheme::SetSomeTPSRRL(TInt aFirstIndex, TInt aSecondIndex, TInt aThirdIndex) |
139 void CSmsStatusReportSchemeTestStep::SetSomeTPSRRL(TInt aFirstIndex, TInt aSecondIndex, TInt aThirdIndex) |
179 { |
140 { |
180 CSmsTPSRROperations& TPSRROperations = static_cast<CSmsTPSRROperations&>(iSmsMessage->GetOperationsForNonIEL(ESmsTPSRRParameter)); |
141 CSmsTPSRROperations& TPSRROperations = static_cast<CSmsTPSRROperations&>(iSmsMessage->GetOperationsForNonIEL(ESmsTPSRRParameter)); |
181 TPSRROperations.SetSchemeL(); |
142 TPSRROperations.SetSchemeL(); |
182 |
143 |
183 if(aFirstIndex) |
144 if(aFirstIndex) |
184 { |
145 { |
185 TPSRROperations.SetSegmentStatusReportL(0,ETrue); |
146 TPSRROperations.SetSegmentStatusReportL(0,ETrue); |
186 } |
147 } |
187 else |
148 else |
188 { |
149 { |
189 TPSRROperations.SetSegmentStatusReportL(0,EFalse); |
150 TPSRROperations.SetSegmentStatusReportL(0,EFalse); |
190 } |
151 } |
191 |
152 |
192 if(aSecondIndex) |
153 if(aSecondIndex) |
193 { |
154 { |
194 TPSRROperations.SetSegmentStatusReportL(1,ETrue); |
155 TPSRROperations.SetSegmentStatusReportL(1,ETrue); |
195 } |
156 } |
196 else |
157 else |
197 { |
158 { |
198 TPSRROperations.SetSegmentStatusReportL(1,EFalse); |
159 TPSRROperations.SetSegmentStatusReportL(1,EFalse); |
199 } |
160 } |
200 if(aThirdIndex) |
161 if(aThirdIndex) |
201 { |
162 { |
202 TPSRROperations.SetSegmentStatusReportL(2,ETrue); |
163 TPSRROperations.SetSegmentStatusReportL(2,ETrue); |
203 } |
164 } |
204 else |
165 else |
205 { |
166 { |
206 TPSRROperations.SetSegmentStatusReportL(2,EFalse); |
167 TPSRROperations.SetSegmentStatusReportL(2,EFalse); |
207 } |
168 } |
208 |
169 |
209 } |
170 } |
210 |
171 |
211 /** |
172 /** |
212 Set the last segment SMSC value to 0x01 |
173 Set the last segment SMSC value to 0x01 |
213 */ |
174 */ |
214 void CTestStatusReportScheme::SetLastSMSCL() |
175 void CSmsStatusReportSchemeTestStep::SetLastSMSCL() |
215 { |
176 { |
216 CSmsSMSCCtrlParameterOperations& SMSCOperations = static_cast<CSmsSMSCCtrlParameterOperations&>(iSmsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsIEISMSCControlParameters)); |
177 CSmsSMSCCtrlParameterOperations& SMSCOperations = static_cast<CSmsSMSCCtrlParameterOperations&>(iSmsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsIEISMSCControlParameters)); |
217 SMSCOperations.SetSchemeL(); |
178 SMSCOperations.SetSchemeL(); |
218 SMSCOperations.SetStatusReportL(iNumberOfPDUs-1, 0x01); |
179 SMSCOperations.SetStatusReportL(iNumberOfPDUs-1, 0x01); |
219 } |
180 } |
220 |
181 |
221 /** |
182 /** |
222 Set all segments SMSC value to 0x01 |
183 Set all segments SMSC value to 0x01 |
223 */ |
184 */ |
224 void CTestStatusReportScheme::SetAllSMSCL() |
185 void CSmsStatusReportSchemeTestStep::SetAllSMSCL() |
225 { |
186 { |
226 CSmsSMSCCtrlParameterOperations& SMSCOperations = static_cast<CSmsSMSCCtrlParameterOperations&>(iSmsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsIEISMSCControlParameters)); |
187 CSmsSMSCCtrlParameterOperations& SMSCOperations = static_cast<CSmsSMSCCtrlParameterOperations&>(iSmsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsIEISMSCControlParameters)); |
227 SMSCOperations.SetSchemeL(); |
188 SMSCOperations.SetSchemeL(); |
228 |
189 |
229 for(TInt i = 0; i < iNumberOfPDUs; i++) |
190 for(TInt i = 0; i < iNumberOfPDUs; ++i) |
230 { |
191 { |
231 SMSCOperations.SetStatusReportL(i, 0x01); |
192 SMSCOperations.SetStatusReportL(i, 0x01); |
232 } |
193 } |
233 |
194 } |
234 } |
|
235 |
|
236 |
195 |
237 /** |
196 /** |
238 Set SMSC bit for some segments |
197 Set SMSC bit for some segments |
239 */ |
198 */ |
240 void CTestStatusReportScheme::SetSomeSMSCL(TInt aFirstIndex, TInt aSecondIndex, TInt aThirdIndex) |
199 void CSmsStatusReportSchemeTestStep::SetSomeSMSCL(TInt aFirstIndex, TInt aSecondIndex, TInt aThirdIndex) |
241 { |
200 { |
242 CSmsSMSCCtrlParameterOperations& SMSCOperations = static_cast<CSmsSMSCCtrlParameterOperations&>(iSmsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsIEISMSCControlParameters)); |
201 CSmsSMSCCtrlParameterOperations& SMSCOperations = static_cast<CSmsSMSCCtrlParameterOperations&>(iSmsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsIEISMSCControlParameters)); |
243 SMSCOperations.SetSchemeL(); |
202 SMSCOperations.SetSchemeL(); |
244 |
203 |
245 if(aFirstIndex) |
204 if(aFirstIndex) |
246 { |
205 { |
247 SMSCOperations.SetStatusReportL(0,0x01); |
206 SMSCOperations.SetStatusReportL(0,0x01); |
248 } |
207 } |
249 else |
208 else |
250 { |
209 { |
251 SMSCOperations.SetStatusReportL(0,0x00); |
210 SMSCOperations.SetStatusReportL(0,0x00); |
252 } |
211 } |
253 |
212 |
254 if(aSecondIndex) |
213 if(aSecondIndex) |
255 { |
214 { |
256 SMSCOperations.SetStatusReportL(1,0x01); |
215 SMSCOperations.SetStatusReportL(1,0x01); |
257 } |
216 } |
258 else |
217 else |
259 { |
218 { |
260 SMSCOperations.SetStatusReportL(1,0x00); |
219 SMSCOperations.SetStatusReportL(1,0x00); |
261 } |
220 } |
262 if(aThirdIndex) |
221 |
263 { |
222 if(aThirdIndex) |
264 SMSCOperations.SetStatusReportL(2,0x01); |
223 { |
265 } |
224 SMSCOperations.SetStatusReportL(2,0x01); |
266 else |
225 } |
267 { |
226 else |
268 SMSCOperations.SetStatusReportL(2,0x00); |
227 { |
269 } |
228 SMSCOperations.SetStatusReportL(2,0x00); |
270 |
229 } |
271 } |
230 } |
272 |
|