Commit dc79687e authored by Bostjan Pintar's avatar Bostjan Pintar
Browse files

Spatem update to support 2PTC

parent 12e18a7c
......@@ -170,6 +170,17 @@ module LibItsMapemSpatem_Functions {
}
}
/**
* @desc Default handling cf02 de-initialisation.
*/
altstep a_cf02Down() runs on ItsMtc {
[] a_shutdown() {
f_cf02Down();
log("*** a_cf02Down: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
stop;
}
}
/**
* @desc The base default.
*/
......@@ -264,6 +275,66 @@ module LibItsMapemSpatem_Functions {
f_disconnect4SelfOrClientSync();
} // End of f_cfDown
/**
* @desc Setups default configuration
* @param p_certificateId The certificate identifier the TA shall use in case of secured IUT
*/
function f_cf02Up(in charstring p_certificateId := PX_CERT_FOR_TS
) runs on ItsMtc mtc ItsMtc system ItsMapemSpatemSystem {
// Variables
var integer i;
// Select components
vc_componentTable := {{c_compMap, omit}, {c_compSpat, omit}};
// Create components
for(i:=0; i < lengthof(vc_componentTable); i:=i+1) {
vc_componentTable[i].msComponent := ItsMapemSpatem.create(vc_componentTable[i].componentName) alive;
}
// Map & Connect
map(self:acPort, system:acPort);
map(self:utPort, system:utPort);
connect(self:syncPort, mtc:syncPort);
for(i:=0; i < lengthof(vc_componentTable); i:=i+1) {
map(vc_componentTable[i].msComponent:acPort, system:acPort);
map(vc_componentTable[i].msComponent:utPort, system:utPort);
map(vc_componentTable[i].msComponent:mapemSpatemPort, system:mapemSpatemPort);
connect(vc_componentTable[i].msComponent:syncPort, self:syncPort);
}
activate(a_cf02Down());
// Initialise secured mode
f_initialiseSecuredMode(p_certificateId);
} // End of f_cf02Up
/**
* @desc Deletes default configuration
*/
function f_cf02Down() runs on ItsMtc mtc ItsMtc system ItsMapemSpatemSystem {
// Local variables
var integer i;
f_uninitialiseSecuredMode();
// Unmap & Disconnect
for(i:=0; i < lengthof(vc_componentTable); i:=i+1) {
unmap(vc_componentTable[i].msComponent:utPort, system:utPort);
unmap(vc_componentTable[i].msComponent:acPort, system:acPort);
unmap(vc_componentTable[i].msComponent:mapemSpatemPort, system:mapemSpatemPort);
disconnect(vc_componentTable[i].msComponent:syncPort, self:syncPort);
}
unmap(self:acPort, system:acPort);
unmap(self:utPort, system:utPort);
disconnect(self:syncPort, mtc:syncPort);
} // End of f_cf02Down
} // End of of mapSpatConfigurationFunctions
group preambles {
......@@ -358,4 +429,33 @@ module LibItsMapemSpatem_Functions {
} // End of group receiveFunctions
group componentFunctions {
/**
* @desc Get the component corresponding to a key
* @param p_componentName Name searched component
* @return ItsGeoNetworking - The searched position vector
*/
function f_getComponent(
in charstring p_componentName
) runs on ItsMtc
return ItsMapemSpatem {
var ItsMapemSpatem v_return := null;
var integer i := 0;
for (i:=0; i<lengthof(vc_componentTable); i:=i+1) {
if (vc_componentTable[i].componentName == p_componentName) {
if (isvalue(vc_componentTable[i].msComponent)) {
v_return := valueof(vc_componentTable[i].msComponent);
}
else {
testcase.stop(__SCOPE__ & " can not handle omitted MS components");
}
}
}
return v_return;
}
}
} // End of module LibItsMapemSpatem_Functions
......@@ -62,6 +62,13 @@ module LibItsMapemSpatem_TestSystem {
type port MapemSpatemPort message { in MapemInd , SpatemInd ; out MapemReq , SpatemReq }
} // End of group interfacePorts
/**
* @desc ITS Main Test Component
*/
type component ItsMtc extends ItsBaseMtc, ItsMapemSpatem {
var ComponentTable vc_componentTable := {};
} // end ItsMtc
/**
* @desc ITS System Adapter
......@@ -155,4 +162,15 @@ module LibItsMapemSpatem_TestSystem {
encode "LibIts_Interface"
} // End of group ApplPrimitives
group misc {
type record ComponentEntry {
charstring componentName,
ItsMapemSpatem msComponent optional
}
type record of ComponentEntry ComponentTable;
} // end misc
} // End of module LibItsMapemSpatem_TestSystem
......@@ -28,6 +28,11 @@ module LibItsMapemSpatem_TypesAndValues {
group mapSpatConstants {
const charstring c_compIut := "IUT";
const charstring c_compMTC := "MTC";
const charstring c_compMap := "PtcMap";
const charstring c_compSpat := "PtcSpat";
} // end group mapSpatConstants
group utPrimitives {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment