Skip to content
Snippets Groups Projects
Commit e0393c76 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Adding CSE-ID_changed event for acPrimitive

parent 031e8f9b
No related branches found
No related tags found
2 merge requests!63Merge Release4-onwards into Release4,!62Merge Release2-onwards into Release2
......@@ -2810,6 +2810,9 @@ module OneM2M_Functions {
f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
vc_remoteCseIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16, -1);
vc_componentRegistered := true;
if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.remoteCSE.cSE_ID)){
f_sendAcPrimitive("CSE-ID_changed", vc_remoteCseIndex);
}
v_localRemoteCSEResource := f_generateLocalResource(valueof(m_primitiveContentRemoteCSE(m_contentLocalRemoteCSEResource(f_getLocalPoA(PX_TS_CSE1.mccPortIn, "")))), vc_cSEBaseIndex, int16); // FIXME To be review not sure we have to use CSE1
vc_localRemoteCseIndex := f_setLocalResource(v_localRemoteCSEResource, int16, vc_cSEBaseIndex);
}
......@@ -5626,7 +5629,7 @@ module OneM2M_Functions {
* @param data Corresponding information for the correct execution of the given action
* @verdict
*/
function f_sendAcPrimitive(in charstring p_event, in integer p_aeIndex) runs on Tester {
function f_sendAcPrimitive(in charstring p_event, in integer p_resourceIndex) runs on Tester {
var XSD.ID v_aeResourceAddress;
var charstring v_spRelativeAeIdForMqtt;
......@@ -5634,8 +5637,8 @@ module OneM2M_Functions {
case ("AE-ID_changed") {
//Calculate the SP-Relative-AE-ID following format defined in TS-0010 MQTT
v_aeResourceAddress := f_getResourceAddress(p_aeIndex, e_nonHierarchical, e_spRelative);
if(vc_resourcesList[p_aeIndex].resource.aE.aE_ID[0] == "S") {
v_aeResourceAddress := f_getResourceAddress(p_resourceIndex, e_nonHierarchical, e_spRelative);
if(vc_resourcesList[p_resourceIndex].resource.aE.aE_ID[0] == "S") {
v_spRelativeAeIdForMqtt := oct2char(unichar2oct(f_resourceIdCleaner(v_aeResourceAddress)));
} else {
v_spRelativeAeIdForMqtt := f_getSpRelativeAeIdForMqtt(v_aeResourceAddress);
......@@ -5658,11 +5661,24 @@ module OneM2M_Functions {
}
}
}
case ("CSE-ID_changed") {
//TODO Check for other resource address formats
v_spRelativeAeIdForMqtt := oct2char(unichar2oct(f_resourceIdCleaner(vc_resourcesList[p_resourceIndex].resource.remoteCSE.cSE_ID)));
if((((vc_config == e_cf02) or (vc_config == e_cf02CseSimuMaster)) and (vc_testSystemRole == e_cse)) or (vc_config == e_cf04)) {
if(vc_myInterfaces[enum2int(valueof(InterfaceIds:e_mcc_in_port))].myProtocolBinding == "MQTT") {
acPort.send(AcRequestPrimitive:{p_event & "_mccPort", {charstring := v_spRelativeAeIdForMqtt}});
}
if(vc_myInterfaces[enum2int(valueof(InterfaceIds:e_mcc_in_port))].myProtocolBinding == "MQTT") {
acPort.send(AcRequestPrimitive:{p_event & "_mccPortIn", {charstring := v_spRelativeAeIdForMqtt}});
}
}
}
case ("MqttSetDefaultTopicToNotRegistration") {
acPort.send(AcRequestPrimitive:{p_event, {charstring := int2str(p_aeIndex)}});
acPort.send(AcRequestPrimitive:{p_event, {charstring := int2str(p_resourceIndex)}});
}
case ("MqttSetDefaultTopicToRegistration") {
acPort.send(AcRequestPrimitive:{p_event, {charstring := int2str(p_aeIndex)}});
acPort.send(AcRequestPrimitive:{p_event, {charstring := int2str(p_resourceIndex)}});
}
}
}
......@@ -5992,7 +6008,7 @@ module OneM2M_Functions {
if(valueof(p_msgOut.protocolBinding) == "MQTT") {
if(ischosen(p_msgOut.primitive.requestPrimitive)) {
if(ispresent(p_msgOut.primitive.requestPrimitive.resourceType)) {
if(valueof(p_msgOut.primitive.requestPrimitive.resourceType) != int2){
if((valueof(p_msgOut.primitive.requestPrimitive.resourceType) != int2) and (valueof(p_msgOut.primitive.requestPrimitive.resourceType) != int16)){
//Modify default topic to publish a non-registration message
f_sendAcPrimitive("MqttSetDefaultTopicToNotRegistration", -1);
vc_myInterfaces[enum2int(p_interfaceIds)].myPort.send(p_msgOut);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment