"ttcn/git@forge.etsi.org:LIBS/LibIts.git" did not exist on "e20fc08e2096fc0db66a329e5cde2e800bf58bfd"
Newer
Older
// LibIts
import from LibIts_TestSystem all;
import from LibIts_Interface all;
import from LibItsCam_Pixits all;
import from LibItsCam_TypesAndValues all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all;
group defaults {
/**
* @desc basic default behaviour handling
* @remark none
* @param none
*/
altstep a_basicDefault() runs on ItsFa {
[] camPort.receive(mw_camInd ( mw_camMsg_any )){
setverdict(fail, "*** a_basicDefault: FAIL: CAM message received in default ***");
[] camPort.receive {
setverdict(fail, "*** a_basicDefault: FAIL: event received on CAM port in default ***");
setverdict(fail, "*** a_basicDefault: FAIL: a timer expired in default ***");
stop;
}
}//end altstep a_basicDefault
} // end of defaults
group preambles {
/**
* @desc Initialize the IUT
* @remark No specific actions specified in the base standard
* @param none
*/
group postambles {
/**
* @desc Global postamble - stops the MTC
* @remark No specific actions required so far
* @param none
*/
function f_postamble() runs on ItsFa {
log("*** f_postamble: INFO: postamble ***");
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
group otherFunctions {
/** @desc function to generate integer random values
*
* @see ttcn-3 - rnd()
* @param p_lowerbound lowest number in range<br>
* @param p_upperbound highest number in range<br>
* @return integer<br>
*
*/
function f_random( in integer p_lowerbound,
in integer p_upperbound )
return integer {
//Variables
var integer v_random := 0;
v_random := float2int(int2float(p_upperbound - p_lowerbound +1)*rnd()) + p_lowerbound;
// Here, upperbound and lowerbound denote highest and lowest number in range.
log("**** f_random: INFO: OK - random value = " & int2str(v_random) & " ****");
return v_random;
} // end function f_random
/** @desc function to generate a random bitstring value
* corrzesponding to 1 bit position set to 1 (eg '00010000', '01000000', ...)
*
* @see f_random
* @param p_length bitstring length - max 15<br>
* @return bitstring<br>
*
*/
function f_bitPositionRandom( in integer p_length )
return bitstring {
//Variables
var bitstring v_random := '00000000'B;
v_random := '000000000000001'B << f_random (0, p_length);
log("**** f_random: INFO: OK - random value = " & bit2str(v_random) & " ****");
return v_random;
} // end function f_random
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
group upperTester {
/** @desc upper tester function to change current heading (absolute)
*
* @param p_heading<br>
* @return FncRetCode<br>
*/
function f_changeHeading( Direction p_heading ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_changeHeading: INFO: OK ****");
return v_ret;
} // end function f_changeHeading
/** @desc upper tester function to change current position (meter)
*
* @param p_position<br>
* @return FncRetCode<br>
*/
function f_changePosition( integer p_position ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_changePosition: INFO: OK ****");
return v_ret;
} // end function f_changePosition
/** @desc upper tester function to change speed (m/S)
*
* @param p_speed<br>
* @return FncRetCode<br>
*/
function f_changeSpeed( Speed p_speed ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_changeSpeed: INFO: OK ****");
return v_ret;
} // end function f_changeSpeed
/** @desc upper tester function to set the crash signal (activated/deactivated)
*
* @param p_crashStatus<br>
* @return FncRetCode<br>
*/
function f_setCrashSignal( CrashStatus p_crashStatus ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setCrashSignal: INFO: OK ****");
return v_ret;
} // end function f_setCrashSignal
/** @desc upper tester function to set the dangerous goods status (Good type)
* p_goodType = 0 if no dangerous goods are transported
* @param p_goodType<br>
* @return FncRetCode<br>
*/
function f_setDangerousGoodsStatus( DangerousGoods p_goodType ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setDangerousGoodsStatus: INFO: OK ****");
return v_ret;
} // end function f_setDangerousGoodsStatus
/**
* @desc upper tester function to set if the Length/Width is precisely determined
* p_precision = true if the Length/Width is precisely determined
* @param p_precision<br>
* @return FncRetCode<br>
*/
function f_setLengthWidthPrecision( boolean p_precision ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setLengthWidthPrecision: INFO: OK ****");
return v_ret;
} // end function f_setLengthWidthPrecision
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
/**
* @desc upper tester function to set the doors status
* @param p_doorStatus<br>
* @return FncRetCode<br>
*/
function f_setDoorStatus( DoorOpen p_doorStatus ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setDoorStatus: INFO: OK ****");
return v_ret;
} // end function f_setDoorStatus
/** @desc upper tester function to set the distance to stop line
*
* @param p_distance<br>
* @return FncRetCode<br>
*/
function f_setDistanceToStopLine( Distance p_distance ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setDistanceToStopLine: INFO: OK ****");
return v_ret;
} // end function f_setDistanceToStopLine
/** @desc upper tester function to set the turn advice
*
* @param p_turnAdvice<br>
* @return FncRetCode<br>
*/
function f_setTurnAdvice( TurnAdvice p_turnAdvice ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setTurnAdvice: INFO: OK ****");
return v_ret;
} // end function f_setTurnAdvice
/** @desc upper tester function to set the curvature change
*
* @param p_curvature<br>
* @return FncRetCode<br>
*/
function f_setCurvatureChange( Curvature p_curvature ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setCurvatureChange: INFO: OK ****");
return v_ret;
} // end function f_setCurvatureChange
/** @desc upper tester function to set the Occupancy
*
* @param p_occupancy<br>
* @return FncRetCode<br>
*/
function f_setOccupancy( Occupancy p_occupancy ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setOccupancy: INFO: OK ****");
return v_ret;
} // end function f_setOccupancy
/** @desc upper tester function to set the light bar status
*
* @param p_status<br>
* @return FncRetCode<br>
*/
function f_setLightBarStatus( SimpleSystemState p_status ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setLightBarStatus: INFO: OK ****");
return v_ret;
} // end function f_setLightBarStatus
/** @desc upper tester function to set the sirene status
*
* @param p_status<br>
* @return FncRetCode<br>
*/
function f_setSireneStatus( SimpleSystemState p_status ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setSireneStatus: INFO: OK ****");
return v_ret;
} // end function f_setSireneStatus
/** @desc upper tester function to set the traffic light priority
*
* @param p_priority<br>
* @return FncRetCode<br>
*/
function f_setTrafficLightPriority( Priority p_priority ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setTrafficLightPriority: INFO: OK ****");
return v_ret;
} // end function f_setTrafficLightPriority
/**
* @desc upper tester function to set the Schedule Deviation
* @param p_scheduleDeviation<br>
* @return FncRetCode<br>
*/
function f_setScheduleDeviation( ScheduleDeviation p_scheduleDeviation ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setScheduleDeviation: INFO: OK ****");
return v_ret;
} // end function f_setScheduleDeviation
/**
* @desc upper tester function to set the PT Line Description
* @param p_pTLineDescription<br>
* @return FncRetCode<br>
*/
function f_setPTLineDescription( PTLineDescription p_pTLineDescription ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setPTLineDescription: INFO: OK ****");
return v_ret;
} // end function f_setPTLineDescription
/**
* @desc upper tester function to set the exterior lights status
* @param p_exteriorLightsStatus<br>
* @return FncRetCode<br>
*/
function f_setExteriorLightsStatus( ExteriorLights p_exteriorLightsStatus ) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_setExteriorLightsStatus: INFO: OK ****");
return v_ret;
} // end function f_setExteriorLightsStatus
/**
* @desc upper tester function to change the reference position (moving)
* @param none<br>
* @return FncRetCode<br>
*/
function f_changeReferencePosition() runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_changeReferencePosition: INFO: OK ****");
return v_ret;
} // end function f_changeReferencePosition
/**
* @desc upper tester function to check that the CAM was received on LDM
* @param p_camMsg<br>
* p_received<br>
* @return FncRetCode<br>
*/
function f_checkLdmReceipt( in CamReq p_camMsg, out boolean p_received) runs on ItsFa return FncRetCode {
//Variables
var FncRetCode v_ret := e_success;
//TODO define external function
log("**** f_checkLdmReceipt: INFO: OK ****");
return v_ret;
} // end function f_checkLdmReceipt
group externalFunctions {
/**
* @desc Generate a timestamp of the cureent time to be used in a generationTime field
* @return TimeStamp<br>
*/
external function fx_generateTime()
return TimeStamp;
*
* @see xf_generateTime
*
*/
function f_generateTime()
return TimeStamp {
//Variables
var TimeStamp v_generationTime:=0;
v_generationTime := fx_generateTime();
if (v_generationTime!=0)
{
return v_generationTime ;
log("**** f_generateTime: INFO: OK - generationTime = " & int2str(v_generationTime) & " ****");
}
else {
log("**** f_generateTime: ERROR: timestamp could not be generated ****");
setverdict( inconc ) ;
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
/** @desc function to get the PT Line Description
* currently return the PIXIT value
* @see PX_PTLINE_COURSE, PX_PTLINE_REF, PX_PTLINE_ROUTE
*
*/
function f_getPTLineDescription()
return PTLineDescription {
//Variables
var PTLineDescription v_pTLineDescription := { "a", "b", "c" };
v_pTLineDescription := { PX_PTLINE_COURSE, PX_PTLINE_REF, PX_PTLINE_ROUTE }; // PIXIT used!
log("**** f_getPTLineDescription: INFO: OK ****");
return v_pTLineDescription ;
} // end function f_getPTLineDescription
/** @desc function to get the stationID
* currently return the PIXIT value
* @see PX_TESTER_STATION_ID
*
*/
function f_getStationID()
return StationID {
//Variables
var StationID v_stationID := 0;
v_stationID := PX_TESTER_STATION_ID; // PIXIT used!
log("**** f_getStationID: INFO: OK - stationID = " & int2str(v_stationID) & " ****");
return v_stationID ;
} // end function fx_getStationID
/**
* @desc get the stationCharacteristics of the tester
* @return CoopAwareness.stationCharacteristics<br>
*/
external function fx_getStationCharacteristics()
return CoopAwareness.stationCharacteristics;
/** @desc Wrapper function for fx_getStationCharacteristics
*
* @see fx_getStationCharacteristics
*
*/
function f_getStationCharacteristics()
return CoopAwareness.stationCharacteristics {
//Variables
var CoopAwareness.stationCharacteristics v_stationCharacteristics := { true, true, true };
v_stationCharacteristics := fx_getStationCharacteristics();
log("**** f_getStationCharacteristics: INFO: OK - stationCharacteristics received ****");
return v_stationCharacteristics ;
} // end function f_getStationCharacteristics
/**
* @desc get the ReferencePosition of the tester
* @return ReferencePosition<br>
*/
external function fx_getReferencePosition()
return ReferencePosition;
/** @desc Wrapper function for fx_getReferencePosition
*
* @see fx_getReferencePosition
*
*/
function f_getReferencePosition()
return ReferencePosition {
//Variables
var ReferencePosition v_referencePosition;
v_referencePosition := fx_getReferencePosition();
log("**** f_getReferencePosition: INFO: OK - referencePosition received ****");
return v_referencePosition ;
} // end function f_getReferencePosition