Newer
Older
* @author ETSI / STF405 / STF449
* @version $URL$
* $Id$
* @desc Module containing functions for GeoNetworking
// Libcommon
import from LibCommon_BasicTypesAndValues all;
import from LibCommon_DataStrings all;
import from LibCommon_VerdictControl {type FncRetCode;}
import from LibCommon_Sync all;
import from LibItsGeoNetworking_Functions all;
import from LibItsGeoNetworking_TestSystem all;
import from LibItsGeoNetworking_Pics all;
import from LibItsExternal_TypesAndValues {type MacAddress};
/**
* @desc Requests to bring the IUT in an initial state
* @param p_init The initialisation to trigger.
*/
function f_utInitializeIut(template (value) UtInitialize p_init) runs on ItsBaseGeoNetworking {
utPort.send(p_init);
tc_wait.start;
alt {
[] utPort.receive(UtResult: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);
}
[else] { // Shortcut defaults
*/
function f_utChangePosition() runs on ItsBaseGeoNetworking {
utPort.send(m_changePosition);
tc_wait.start;
alt {
[] utPort.receive(UtResult: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);
}
[else] { // Shortcut defaults
}
/**
* @desc Triggers event from the application layer
* @param p_event The event to trigger.
*/
function f_utTriggerEvent(template (value) UtGnTrigger p_event) runs on ItsGeoNetworking {
alt {
[] utPort.receive(UtResult:true) {
tc_wait.stop;
}
[] utPort.receive {
tc_wait.stop;
}
[] tc_wait.timeout {
}
[else] { // Shortcut defaults
}
}
}
/**
* @desc Checks that the event was indicated at the application layer
* @param p_event The event to check.
* @param p_discard The event should not appear. Default value: FALSE.
*/
function f_utCheckEvent(template (value) UtGnTrigger p_event, boolean p_discard) runs on ItsGeoNetworking {
tc_wait.start;
alt {
[] utPort.receive(UtResult:true) {
tc_wait.stop;
if (p_discard == false) {
log("*** f_utCheckEvent: INFO: Event correctly indicated at application layer ***");
}
else {
log("*** f_utCheckEvent: ERROR: Event indicated at application layer where it should be discarded ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
}
[] utPort.receive(UtResult:false) {
tc_wait.stop;
if (p_discard == false) {
log("*** f_utCheckEvent: ERROR: Event not correctly indicated at application layer ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
else {
log("*** f_utCheckEvent: INFO: Event not indicated at application layer***");
}
}
[] tc_wait.timeout {
log("*** f_utCheckEvent: ERROR: Timeout while waiting for event check result ***");
group geoConfigurationFunctions {
/**
* @desc This configuration features:
* - one ITS node (IUT)
* - two ITS nodes (nodeA, nodeB)
* - Area1 which only includes NodeB and IUT
// Variables
var PositionTable v_positionTable := {};
var LongPosVector v_longPosVectorIut, v_longPosVectorNodeA, v_longPosVectorNodeB, v_longPosVectorNodeD;
map(self:acPort, system:acPort);
map(self:utPort, system:utPort);
map(self:geoNetworkingPort, system:geoNetworkingPort);
// Connect
f_connect4SelfOrClientSync();
//Initialze the IUT
f_initialState();
//Get positions
v_longPosVectorIut := f_getIutLongPosVector();
v_longPosVectorNodeA := f_computePosition(v_longPosVectorIut, c_longitudeFactorNodeA, c_latitudeFactorNodeA);
v_longPosVectorNodeB := f_computePosition(v_longPosVectorIut, c_longitudeFactorNodeB, c_latitudeFactorNodeB);
v_longPosVectorNodeD := f_computePosition(v_longPosVectorIut, c_longitudeFactorNodeD, c_latitudeFactorNodeD);
v_longPosVectorNodeA.gnAddr := f_getTsGnLocalAddress(c_compNodeA);
v_longPosVectorNodeB.gnAddr := f_getTsGnLocalAddress(c_compNodeB);
f_addPosition(v_positionTable, c_compIut, v_longPosVectorIut);
f_addPosition(v_positionTable, c_compNodeA, v_longPosVectorNodeA);
f_addPosition(v_positionTable, c_compNodeB, v_longPosVectorNodeB);
f_addPosition(v_positionTable, c_compNodeD, v_longPosVectorNodeD);
f_computeCircularArea(v_longPosVectorNodeD, float2int(1.1 * f_distance(v_longPosVectorNodeB, v_longPosVectorNodeD))));
f_computeCircularArea(v_longPosVectorNodeB, float2int(1.1 * f_distance(v_longPosVectorNodeB, v_longPosVectorNodeD))));
Loading full blame...