Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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
121
122
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
/**
* @author ETSI / STF405 / STF449 / STF484 / STF517 / STF525
* @version $URL$
* $Id$
* @desc Module containing functions for GeoNetworking
* @copyright ETSI Copyright Notification
* No part may be reproduced except as authorized by written permission.
* The copyright and the foregoing restriction extend to reproduction in all media.
* All rights reserved.
*
*/
module LibItsGeoNetworking_Functions {
// Libcommon
import from LibCommon_BasicTypesAndValues all;
import from LibCommon_DataStrings all;
import from LibCommon_VerdictControl all;
import from LibCommon_Sync all;
import from LibCommon_Time all;
// LibIts
import from IEEE1609dot2BaseTypes language "ASN.1:1997" all;
import from IEEE1609dot2 language "ASN.1:1997" all;
import from EtsiTs103097Module language "ASN.1:1997" all;
// LibItsCommon
import from LibItsCommon_TypesAndValues all;
import from LibItsExternal_TypesAndValues all;
import from LibItsCommon_Templates all;
import from LibItsCommon_Functions all;
import from LibItsCommon_Pixits all;
// import from LibItsCommon_TestSystem all;
// LibItsSecurity
import from LibItsSecurity_TypesAndValues all;
import from LibItsSecurity_Templates all;
import from LibItsSecurity_Functions all;
import from LibItsSecurity_Pixits all;
// LibItsGeoNetworking
import from LibItsGeoNetworking_TestSystem all;
import from LibItsGeoNetworking_TypesAndValues all;
import from LibItsGeoNetworking_Templates all;
import from LibItsGeoNetworking_Pixits all;
import from LibItsGeoNetworking_Pics all;
// import from LibItsGeoNetworking_EncdecDeclarations all;
group utFuntions {
/**
* @desc Requests to bring the IUT in an initial state
* @param p_init The initialisation to trigger.
*/
function f_utInitializeIut(template (value) UtGnInitialize p_init) runs on ItsBaseGeoNetworking {
//deactivate gnPort default alts
vc_gnDefaultActive := false;
utPort.send(p_init);
tc_wait.start;
alt {
[] utPort.receive(UtGnResults: { utGnInitializeResult := true }) {
tc_wait.stop;
log("*** f_utInitializeIut: INFO: IUT initialized ***");
}
[] utPort.receive {
tc_wait.stop;
log("*** f_utInitializeIut: INFO: IUT could not be initialized ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
[] tc_wait.timeout {
log("*** f_utInitializeIut: INFO: IUT could not be initialized in time ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
}
//activate gnPort default alts
vc_gnDefaultActive := true;
}
/**
* @desc Requests to change the position of the IUT
*/
function f_utChangePosition() runs on ItsBaseGeoNetworking {
//deactivate gnPort default alts
vc_gnDefaultActive := false;
utPort.send(m_changePosition);
tc_wait.start;
alt {
[] utPort.receive(UtGnResults: { utGnChangePositionResult := true} ) {
tc_wait.stop;
log("*** f_utChangePosition: INFO: IUT position changed ***");
}
[] utPort.receive(UtGnResults: { utGnChangePositionResult := false }) {
tc_wait.stop;
log("*** f_utChangePosition: INFO: IUT position change was not successful ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
[] a_utDefault() {
}
[] tc_wait.timeout {
log("*** f_utChangePosition: INFO: IUT position not changed in time ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
}
//activate gnPort default alts
vc_gnDefaultActive := true;
}
/**
* @desc Triggers event from the application layer
* @param p_event The event to trigger.
*/
function f_utTriggerEvent(template (value) UtGnTrigger p_event) runs on ItsBaseGeoNetworking return boolean {
// Variables
var boolean v_return := true;
//deactivate gnPort default alts
vc_gnDefaultActive := false;
utPort.send(p_event);
tc_wait.start;
alt {
[] utPort.receive(UtGnResults: { utGnTriggerResult := true }) {
tc_wait.stop;
}
[] utPort.receive(UtGnResults: { utGnTriggerResult := false }) {
tc_wait.stop;
log("*** UtGnTriggerResult: INFO: UT trigger was not successful ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
[] a_utDefault() {
}
[] tc_wait.timeout {
v_return := false;
}
}
//activate gnPort default alts
vc_gnDefaultActive := true;
return v_return;
}
} // End of group utFunctions
group geoConfigurationFunctions {
/**
* @desc This configuration features:
* - one ITS node (IUT)
* - two ITS nodes (nodeA, nodeB)
* - Area1 which only includes NodeB and IUT
* - Area2 which only includes NodeB
* NodeB being close to the area center
*/
//FIXME RGY Titan doesn't support mtc and system clauses yet
function f_cf01Up(Scenario p_scenario := e_staticPosition) runs on ItsGeoNetworking /* TITAN TODO: system ItsGeoNetworkingSystem */ {
// Variables
var PositionTable v_positionTable := {};
var GeoAreaTable v_areaTable := {};
// Map
map(self:acPort, system:acPort);
map(self:utPort, system:utPort);
map(self:geoNetworkingPort, system:geoNetworkingPort);
// Connect
f_connect4SelfOrClientSync();
activate(a_cf01Down());
// Initialise secured mode
f_initialiseSecuredMode();
//Initialze the IUT
f_initialState(p_scenario);
// Positions & Areas
f_preparePositionsAndAreas(v_positionTable, v_areaTable);
f_initialiseComponent(v_positionTable, v_areaTable, c_compNodeB);
} // end f_cf01Up
//FIXME RGY Titan doesn't support mtc and system clauses yet
function f_cf01Down() runs on ItsGeoNetworking /* TITAN TODO: system ItsGeoNetworkingSystem */ {
f_uninitialiseSecuredMode();
// Unmap
unmap(self:acPort, system:acPort);
unmap(self:utPort, system:utPort);
unmap(self:geoNetworkingPort, system:geoNetworkingPort);
Loading full blame...