Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TTCN-3 Libraries
LibIts
Commits
db1ea8e3
Commit
db1ea8e3
authored
Mar 18, 2016
by
garciay
Browse files
STF507 Week#11: Merge GNSS support from C2C branch
parent
e0250cb2
Changes
11
Hide whitespace changes
Inline
Side-by-side
ttcn/CAM/LibItsCam_Functions.ttcn
View file @
db1ea8e3
...
...
@@ -16,6 +16,8 @@ module LibItsCam_Functions {
import
from
LibItsCam_TestSystem
all
;
import
from
LibItsCam_Templates
all
;
import
from
LibItsCam_TypesAndValues
all
;
import
from
LibItsCommon_Pixits
all
;
import
from
LibItsCommon_Templates
all
;
import
from
LibItsCommon_Functions
all
;
import
from
LibItsCommon_TypesAndValues
all
;
import
from
ITS_Container
language
"ASN.1:1997"
all
;
...
...
@@ -105,14 +107,121 @@ module LibItsCam_Functions {
}
// End of group utFunctions
group
adapterControl
{
/**
* @desc Triggers event in the test system adaptation.
* @param p_event The event to trigger
* @return FncRetCode
*/
function
f_acTriggerGnssEvent
(
template
(
value
)
AcGnssPrimitive
p_event
)
runs
on
ItsCam
return
FncRetCode
{
var
FncRetCode
v_ret
:=
e_success
;
acPort
.
send
(
p_event
);
tc_ac
.
start
;
alt
{
[]
acPort
.
receive
(
m_acGnssResponseSuccess
)
{
tc_ac
.
stop
;
}
[]
acPort
.
receive
{
tc_ac
.
stop
;
log
(
"*** "
&
__SCOPE__
&
": ERROR: Received unexpected message ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_error
);
}
[]
tc_ac
.
timeout
{
log
(
"*** "
&
__SCOPE__
&
": ERROR: Timeout while waiting for adapter control event result ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_timeout
);
}
}
return
v_ret
;
}
/**
* @desc Loads the given scenario
*
* @param p_scenario The scenario to load.
*/
function
f_acLoadScenario
(
Scenario
p_scenario
)
runs
on
ItsCam
{
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
)
{
f_acTriggerGnssEvent
(
m_loadScenario
(
p_scenario
));
}
}
// end f_acLoadScenario
/**
* @desc Starts a loaded scenario
*/
function
f_acStartScenario
()
runs
on
ItsCam
{
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
)
{
f_acTriggerGnssEvent
(
m_startScenario
);
vc_scenarioStarted
:=
true
;
}
}
// end f_acStartScenario
/**
* @desc Stops a loaded scenario
*/
function
f_acStopScenario
()
runs
on
ItsCam
{
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
and
vc_scenarioStarted
==
true
)
{
f_acTriggerGnssEvent
(
m_stopScenario
);
vc_scenarioStarted
:=
false
;
}
}
// end f_acStopScenario
function
f_acAwaitDistanceCovered
(
float
p_distanceToCover
)
runs
on
ItsCam
return
FncRetCode
{
var
FncRetCode
v_ret
:=
e_success
;
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
and
vc_scenarioStarted
==
true
)
{
f_acTriggerGnssEvent
(
m_distanceToCover
(
p_distanceToCover
));
tc_ac
.
start
;
alt
{
[]
acPort
.
receive
(
m_acGnssDistanceCovered
)
{
tc_ac
.
stop
;
}
[]
acPort
.
receive
{
tc_ac
.
stop
;
log
(
"*** "
&
__SCOPE__
&
": ERROR: Received unexpected message ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_error
);
}
[]
tc_ac
.
timeout
{
log
(
"*** "
&
__SCOPE__
&
": ERROR: Timeout while waiting for covered distance indication ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_timeout
);
}
}
}
return
v_ret
;
}
// end f_acAwaitDistanceCovered
function
f_acChangeSpeed
(
SpeedValue
p_deltaSpeedValue
)
runs
on
ItsCam
{
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
and
vc_scenarioStarted
==
true
)
{
f_acTriggerGnssEvent
(
m_changeScenarioSpeed
(
p_deltaSpeedValue
));
}
}
// end f_acChangeSpeed
function
f_acChangeHeading
(
HeadingValue
p_deltaHeadingValue
)
runs
on
ItsCam
{
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
and
vc_scenarioStarted
==
true
)
{
f_acTriggerGnssEvent
(
m_changeScenarioHeading
(
p_deltaHeadingValue
));
}
}
// end f_acChangeHeading
}
// End of group adapterControl
group
camConfigurationFunctions
{
/**
* @desc Setups default configuration
*/
function
f_cfUp
()
runs
on
ItsCam
{
function
f_cfUp
()
runs
on
ItsCam
system
ItsCamSystem
{
map
(
self
:
utPort
,
system
:
utPort
);
map
(
self
:
acPort
,
system
:
acPort
);
map
(
self
:
camPort
,
system
:
camPort
);
f_connect4SelfOrClientSync
();
...
...
@@ -121,9 +230,10 @@ module LibItsCam_Functions {
/**
* @desc Deletes default configuration
*/
function
f_cfDown
()
runs
on
ItsCam
{
function
f_cfDown
()
runs
on
ItsCam
system
ItsCamSystem
{
unmap
(
self
:
utPort
,
system
:
utPort
);
unmap
(
self
:
acPort
,
system
:
acPort
);
unmap
(
self
:
camPort
,
system
:
camPort
);
f_disconnect4SelfOrClientSync
();
...
...
@@ -191,16 +301,22 @@ module LibItsCam_Functions {
* @desc Initialize the IUT
* @remark No specific actions specified in the base standard
*/
function
f_prInitialState
()
runs
on
ItsCam
{
function
f_prInitialState
(
Scenario
p_scenario
:=
e_staticPosition
,
boolean
p_awaitInitialCAM
:=
true
)
runs
on
ItsCam
{
f_utInitializeIut
(
m_camInitialize
);
f_prDefault
();
f_acLoadScenario
(
p_scenario
);
//Allow burst mode at the beginning
f_sleep
(
1.0
);
camPort
.
clear
;
f_acStartScenario
();
if
(
p_awaitInitialCAM
)
{
tc_ac
.
start
;
alt
{
[]
camPort
.
receive
(
mw_camInd
(
mw_camMsg_any
)){
...
...
@@ -212,6 +328,7 @@ module LibItsCam_Functions {
f_selfOrClientSyncAndVerdictPreamble
(
"error"
,
e_timeout
);
}
}
}
}
// end f_prInitialState
...
...
@@ -223,7 +340,7 @@ module LibItsCam_Functions {
* @desc The default postamble.
*/
function
f_poDefault
()
runs
on
ItsCam
{
//empty
f_acStopScenario
();
}
}
// end group postambles
...
...
@@ -239,7 +356,7 @@ module LibItsCam_Functions {
*
* @return The new reference position.
*/
function
f_computePositionUsingDistance
(
in
ReferencePosition
p_referencePosition
,
in
integer
p_offSet
)
return
ReferencePosition
{
function
f_computePositionUsingDistance
(
in
ReferencePosition
p_referencePosition
,
in
float
p_offSet
)
return
ReferencePosition
{
var
ReferencePosition
v_referencePosition
:=
p_referencePosition
;
log
(
"*** f_computePositionUsingDistance: INFO: calling fx_computePositionUsingDistance() ***"
);
...
...
@@ -256,6 +373,28 @@ module LibItsCam_Functions {
}
// end group camPositionFunctions
group
camAuxilaryFunctions
{
function
f_changeSpeed
(
SpeedValue
p_deltaSpeedValue
)
runs
on
ItsCam
{
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
false
)
{
f_utTriggerEvent
(
m_changeSpeed
(
p_deltaSpeedValue
));
}
else
{
f_acChangeSpeed
(
p_deltaSpeedValue
);
}
}
function
f_changeHeading
(
HeadingValue
p_deltaHeadingValue
)
runs
on
ItsCam
{
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
false
)
{
f_utTriggerEvent
(
m_changeHeading
(
p_deltaHeadingValue
));
}
else
{
f_acChangeHeading
(
p_deltaHeadingValue
);
}
}
}
// end group camAuxilaryFunctions
group
camGenerators
{
function
f_generateDefaultCam
()
return
octetstring
{
...
...
ttcn/CAM/LibItsCam_TestSystem.ttcn
View file @
db1ea8e3
...
...
@@ -25,14 +25,24 @@ module LibItsCam_TestSystem {
group
portDefinitions
{
/**
* @desc Adapter control port
*/
type
port
AdapterControlPort
message
{
out
AcGnssPrimitive
;
in
AcGnssResponse
,
AcGnssDistanceCovered
;
}
// end AdapterControlPort
/**
* @desc Upper Tester port
*/
type
port
UpperTesterPort
message
{
out
UtInitialize
,
UtCamTrigger
,
UtChangePosition
;
UtInitialize
,
UtCamTrigger
,
UtChangePosition
,
UtActivatePositionTime
,
UtDeactivatePositionTime
;
in
UtInitializeResult
,
UtCamTriggerResult
,
UtChangePositionResult
,
UtCamEventInd
;
UtInitializeResult
,
UtCamTriggerResult
,
UtChangePositionResult
,
UtActivatePositionTimeResult
,
UtDeactivatePositionTimeResult
,
UtCamEventInd
;
}
// end UpperTesterPort
}
// end portDefinitions
...
...
@@ -65,6 +75,7 @@ module LibItsCam_TestSystem {
type
component
ItsCamSystem
{
port
UpperTesterPort
utPort
;
port
AdapterControlPort
acPort
;
// FA1 ports
port
CamPort
camPort
;
...
...
@@ -79,6 +90,7 @@ module LibItsCam_TestSystem {
type
component
ItsCam
extends
ItsBaseComponent
{
port
UpperTesterPort
utPort
;
port
AdapterControlPort
acPort
;
// FA1 ports
port
CamPort
camPort
;
...
...
ttcn/Common/LibItsCommon_Functions.ttcn
View file @
db1ea8e3
...
...
@@ -195,7 +195,7 @@ module LibItsCommon_Functions {
external
function
fx_computePositionUsingDistance
(
in
Int32
p_refLatitude
,
in
Int32
p_refLongitude
,
in
integer
p_distance
,
in
float
p_distance
,
in
integer
p_orientation
,
out
Int32
p_latitude
,
out
Int32
p_longitude
...
...
ttcn/Common/LibItsCommon_Pixits.ttcn
View file @
db1ea8e3
...
...
@@ -46,4 +46,9 @@ module LibItsCommon_Pixits {
*/
modulepar
integer
PX_TIME_DELTA
:=
1000
;
/**
* @desc Support for GNSS scenario
*/
modulepar
boolean
PICS_GNSS_SCENARIO_SUPPORT
:=
true
;
}
// end LibItsCommon_Pixits
\ No newline at end of file
ttcn/Common/LibItsCommon_Templates.ttcn
0 → 100644
View file @
db1ea8e3
/**
* @author ETSI / STF405 / STF449
* @version $URL$
* $Id$
* @desc Module containing base template definitions for DENM
*
*/
module
LibItsCommon_Templates
{
import
from
ITS_Container
language
"ASN.1:1997"
all
;
// LibItsCommon
import
from
LibItsCommon_TypesAndValues
all
;
group
taPrimitives
{
template
AcGnssResponse
m_acGnssResponseSuccess
:=
true
;
template
AcGnssDistanceCovered
m_acGnssDistanceCovered
:=
true
;
/**
* @desc Testsystem will load GNSS scenario
*/
template
AcGnssPrimitive
m_loadScenario
(
Scenario
p_scenario
)
:=
{
loadScenario
:=
{
scenario
:=
p_scenario
}
}
/**
* @desc Testsystem will start GNSS scenario
*/
template
AcGnssPrimitive
m_startScenario
:=
{
startScenario
:=
{
}
}
/**
* @desc Testsystem will stop GNSS scenario
*/
template
AcGnssPrimitive
m_stopScenario
:=
{
stopScenario
:=
{
}
}
/**
* @desc Testsystem will request indication if distance was covered
*/
template
AcGnssPrimitive
m_distanceToCover
(
float
p_distance
)
:=
{
distanceToCover
:=
{
distance
:=
p_distance
}
}
/**
* @desc Testsystem will change the speed (delta value)
*/
template
AcGnssPrimitive
m_changeScenarioSpeed
(
SpeedValue
p_deltaSpeedValue
)
:=
{
changeSpeed
:=
{
deltaSpeed
:=
p_deltaSpeedValue
}
}
/**
* @desc Testsystem will change the heading (delta value)
*/
template
AcGnssPrimitive
m_changeScenarioHeading
(
HeadingValue
p_deltaHeadingValue
)
:=
{
changeHeading
:=
{
deltaHeading
:=
p_deltaHeadingValue
}
}
}
// end taPrimitives
}
ttcn/Common/LibItsCommon_TestSystem.ttcn
View file @
db1ea8e3
...
...
@@ -37,6 +37,8 @@ module LibItsCommon_TestSystem {
timer
tc_ac
:=
PX_TAC
;
timer
tc_noac
:=
PX_TNOAC
;
var
boolean
vc_scenarioStarted
:=
false
;
}
// end ItsComponent
}
// End of group componentDefinitions
...
...
ttcn/Common/LibItsCommon_TypesAndValues.ttcn
View file @
db1ea8e3
...
...
@@ -53,11 +53,117 @@ module LibItsCommon_TypesAndValues {
* @desc Upper Tester result message of the change pseudonym request
*/
type
boolean
UtChangePseudonymResult
;
/**
* @desc Upper Tester message to activate position and/or time
*/
type
record
UtActivatePositionTime
{
// empty on purpose
}
/**
* @desc Upper Tester result message of the activate position and/or time request
*/
type
boolean
UtActivatePositionTimeResult
;
/**
* @desc Upper Tester message to deactivate position and/or time
*/
type
record
UtDeactivatePositionTime
{
// empty on purpose
}
/**
* @desc Upper Tester result message of the deactivate position and/or time request
*/
type
boolean
UtDeactivatePositionTimeResult
;
}
with
{
encode
"UpperTester"
}
group
acPrimitives
{
/**
* @desc TA primitives for DENM
* @member loadScenario -
* @member startScenario -
* @member stopScenario -
* @member distanceCovered -
*/
type
union
AcGnssPrimitive
{
AcLoadScenario
loadScenario
,
AcStartScenario
startScenario
,
AcStopScenario
stopScenario
,
AcDistanceToCover
distanceToCover
,
AcChangeSpeed
changeSpeed
,
AcChangeHeading
changeHeading
}
/**
* @desc Primitive for receiving response from TA
*/
type
boolean
AcGnssResponse
;
/**
* @desc Primitive for receiving an indication if requested distance was covered from TA
*/
type
boolean
AcGnssDistanceCovered
;
/**
* @desc Primitive for loading a scenario
* @member scenario Scenario to load
*/
type
record
AcLoadScenario
{
Scenario
scenario
}
type
enumerated
Scenario
{
e_staticPosition
(
0
),
e_dynamicPosition200m
(
200
),
e_dynamicPosition1000m
(
1000
),
e_dynamicPosition1500m
(
1500
)
}
/**
* @desc Primitive for starting the loaded scenario
*/
type
record
AcStartScenario
{
}
/**
* @desc Primitive for stopping the loaded scenario
*/
type
record
AcStopScenario
{
}
/**
* @desc Primitive to inform when given distance was covered
*/
type
record
AcDistanceToCover
{
float
distance
}
/**
* @desc Primitive to change speed in current scenario
*/
type
record
AcChangeSpeed
{
SpeedValue
deltaSpeed
}
/**
* @desc Primitive to change heading in current scenario
*/
type
record
AcChangeHeading
{
HeadingValue
deltaHeading
}
}
// end acPrimitives
with
{
encode
"AdapterControl"
}
}
with
{
encode
"LibItsCommon"
...
...
ttcn/DENM/LibItsDenm_Functions.ttcn
View file @
db1ea8e3
...
...
@@ -13,11 +13,12 @@ module LibItsDenm_Functions {
import
from
LibCommon_Time
{
modulepar
PX_TNOAC
;
function
f_sleep
};
// LibItsCommon
import
from
LibItsCommon_Templates
all
;
import
from
LibItsCommon_TypesAndValues
all
;
import
from
LibItsCommon_Functions
all
;
import
from
LibItsCommon_Pixits
all
;
// LibIts
import
from
LibItsCommon_Functions
all
;
import
from
LibItsDenm_TestSystem
all
;
import
from
LibItsDenm_TypesAndValues
all
;
import
from
LibItsDenm_Templates
all
;
...
...
@@ -207,13 +208,106 @@ module LibItsDenm_Functions {
}
// End of group utFunctions
group
adapterControl
{
/**
* @desc Triggers event in the test system adaptation.
* @param p_event The event to trigger
* @return FncRetCode
*/
function
f_acTriggerGnssEvent
(
template
(
value
)
AcGnssPrimitive
p_event
)
runs
on
ItsDenm
return
FncRetCode
{
var
FncRetCode
v_ret
:=
e_success
;
acPort
.
send
(
p_event
);
tc_ac
.
start
;
alt
{
[]
acPort
.
receive
(
m_acGnssResponseSuccess
)
{
tc_ac
.
stop
;
}
[]
acPort
.
receive
{
tc_ac
.
stop
;
log
(
"*** "
&
__SCOPE__
&
": ERROR: Received unexpected message ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_error
);
}
[]
tc_ac
.
timeout
{
log
(
"*** "
&
__SCOPE__
&
": ERROR: Timeout while waiting for adapter control event result ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_timeout
);
}
}
return
v_ret
;
}
/**
* @desc Loads the given scenario
*
* @param p_scenario The scenario to load.
*/
function
f_acLoadScenario
(
Scenario
p_scenario
)
runs
on
ItsDenm
{
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
)
{
f_acTriggerGnssEvent
(
m_loadScenario
(
p_scenario
));
}
}
// end f_acLoadScenario
/**
* @desc Starts a loaded scenario
*/
function
f_acStartScenario
()
runs
on
ItsDenm
{
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
)
{
f_acTriggerGnssEvent
(
m_startScenario
);
vc_scenarioStarted
:=
true
;
}
}
// end f_acStartScenario
/**
* @desc Stops a loaded scenario
*/
function
f_acStopScenario
()
runs
on
ItsDenm
{
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
and
vc_scenarioStarted
==
true
)
{
f_acTriggerGnssEvent
(
m_stopScenario
);
vc_scenarioStarted
:=
false
;
}
}
// end f_acStopScenario
function
f_acAwaitDistanceCovered
(
float
p_distanceToCover
)
runs
on
ItsDenm
return
FncRetCode
{
var
FncRetCode
v_ret
:=
e_success
;
if
(
PICS_GNSS_SCENARIO_SUPPORT
==
true
and
vc_scenarioStarted
==
true
)
{
f_acTriggerGnssEvent
(
m_distanceToCover
(
p_distanceToCover
));
tc_ac
.
start
;
alt
{
[]
acPort
.
receive
(
m_acGnssDistanceCovered
)
{
tc_ac
.
stop
;
}
[]
acPort
.
receive
{
tc_ac
.
stop
;
log
(
"*** "
&
__SCOPE__
&
": ERROR: Received unexpected message ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_error
);
}
[]
tc_ac
.
timeout
{
log
(
"*** "
&
__SCOPE__
&
": ERROR: Timeout while waiting for covered distance indication ***"
);
f_selfOrClientSyncAndVerdict
(
"error"
,
e_timeout
);
}
}
}
return
v_ret
;
}
// end f_acAwaitDistanceCovered
}
// End of group adapterControl
group
denmConfigurationFunctions
{
/**
* @desc Setups default configuration
*/
function
f_cfUp
()
runs
on
ItsDenm
{
function
f_cfUp
()
runs
on
ItsDenm
system
ItsDenmSystem
{
map
(
self
:
acPort
,
system
:
acPort
);
map
(
self
:
utPort
,
system
:
utPort
);
map
(
self
:
denmPort
,
system
:
denmPort
);
f_connect4SelfOrClientSync
();
...
...
@@ -223,8 +317,9 @@ module LibItsDenm_Functions {
/**
* @desc Deletes default configuration
*/
function
f_cfDown
()
runs
on
ItsDenm
{
function
f_cfDown
()
runs
on
ItsDenm
system
ItsDenmSystem
{
unmap
(
self
:
acPort
,
system
:
acPort
);