Skip to content

Commit

Permalink
Moved one config variable for device connections into a struct
Browse files Browse the repository at this point in the history
  • Loading branch information
hkbinaurics committed Apr 24, 2024
1 parent 6076258 commit abaee2b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ namespace CayfAutomationModules
// This flag activates to attach uid to component description via IjvxManipulate - to distinguish between components of the same type
jvxBool attachUi = false;

// A way to parameterize the component name
std::string manSuffix;

ayfConnectConfigCpManipulate(jvxComponentType tpRemapArg = JVX_COMPONENT_UNKNOWN,
jvxBool attachUiArg = false) : tpRemap(tpRemapArg), attachUi(attachUiArg) {};
jvxBool attachUiArg = false, const std::string& manSuffixArg = "") : tpRemap(tpRemapArg), attachUi(attachUiArg), manSuffix(manSuffixArg) {};
};

class ayfConnectConfigConMiscArgs
Expand Down Expand Up @@ -104,10 +107,7 @@ namespace CayfAutomationModules
jvxComponentType cpTp = JVX_COMPONENT_UNKNOWN;

// This is how the support node is found: the module name
std::string modName;

// A way to parameterize the component name
std::string manSuffix;
std::string modName;

ayfConnectConfigCpManipulate cpManipulate;

Expand All @@ -119,7 +119,7 @@ namespace CayfAutomationModules
ayfConnectConfigCpEntrySyncIo(

// Identify the required support node
jvxComponentType cpTpArg = JVX_COMPONENT_UNKNOWN, const std::string& modNameArg = "notFound", const std::string& manSuffixArg = "",
jvxComponentType cpTpArg = JVX_COMPONENT_UNKNOWN, const std::string& modNameArg = "notFound",

const std::string& chainNamePrefixArg = "default", const std::string& masterNmArg = "default",
const std::string& oconMasterNmArg = "default", const std::string& iconMasterNmArg = "default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,19 @@ namespace CayfAutomationModules
ayfConnectConfigCpEntrySyncIoRuntime cpElm(config);

cpElm.cpId = cpElm.driveSupportNodeChain.cpTp;
res = jvx_activateObjectInModule(refHostRefPtr, cpElm.cpId, cpElm.driveSupportNodeChain.modName, obj_dev, true, cpElm.driveSupportNodeChain.manSuffix,
res = jvx_activateObjectInModule(refHostRefPtr, cpElm.cpId, cpElm.driveSupportNodeChain.modName, obj_dev, true, cpElm.driveSupportNodeChain.cpManipulate.manSuffix,
cpElm.driveSupportNodeChain.cpManipulate.attachUi, cpElm.driveSupportNodeChain.cpManipulate.tpRemap);

if (res == JVX_NO_ERROR)
{
JVX_START_LOCK_LOG_REF(objLogRefPtr, jvxLogLevel::JVX_LOGLEVEL_3_DEBUG_OPERATION_WITH_LOW_DEGREE_OUTPUT);
log << "Activated module <" << cpElm.driveSupportNodeChain.modName << "> with suffix <" << cpElm.driveSupportNodeChain.manSuffix << "> in location <" << jvxComponentIdentification_txt(cpElm.cpId) << ">." << std::endl;
log << "Activated module <" << cpElm.driveSupportNodeChain.modName << "> with suffix <" << cpElm.driveSupportNodeChain.cpManipulate.manSuffix << "> in location <" << jvxComponentIdentification_txt(cpElm.cpId) << ">." << std::endl;
JVX_STOP_LOCK_LOG_REF(objLogRefPtr);
}
else
{
JVX_START_LOCK_LOG_REF(objLogRefPtr, jvxLogLevel::JVX_LOGLEVEL_3_DEBUG_OPERATION_WITH_LOW_DEGREE_OUTPUT);
log << "Failed to activate module <" << cpElm.driveSupportNodeChain.modName << "> with suffix <" << cpElm.driveSupportNodeChain.manSuffix << "> in location <" << jvxComponentIdentification_txt(cpElm.cpId) << ">." << std::endl;
log << "Failed to activate module <" << cpElm.driveSupportNodeChain.modName << "> with suffix <" << cpElm.driveSupportNodeChain.cpManipulate.manSuffix << "> in location <" << jvxComponentIdentification_txt(cpElm.cpId) << ">." << std::endl;
JVX_STOP_LOCK_LOG_REF(objLogRefPtr);
}

Expand Down Expand Up @@ -157,7 +157,7 @@ namespace CayfAutomationModules
{
// Here we end up in error case!
JVX_START_LOCK_LOG_REF(objLogRefPtr, jvxLogLevel::JVX_LOGLEVEL_3_DEBUG_OPERATION_WITH_LOW_DEGREE_OUTPUT);
log << "On error, deactivating module <" << cpElm.driveSupportNodeChain.modName << "> with suffix <" << cpElm.driveSupportNodeChain.manSuffix << "> in location <" << jvxComponentIdentification_txt(cpElm.cpId) << ">." << std::endl;
log << "On error, deactivating module <" << cpElm.driveSupportNodeChain.modName << "> with suffix <" << cpElm.driveSupportNodeChain.cpManipulate.manSuffix << "> in location <" << jvxComponentIdentification_txt(cpElm.cpId) << ">." << std::endl;
JVX_STOP_LOCK_LOG_REF(objLogRefPtr);
jvxErrorType resL = jvx_deactivateObjectInModule(refHostRefPtr, cpElm.cpId);
}
Expand All @@ -178,7 +178,7 @@ namespace CayfAutomationModules

JVX_START_LOCK_LOG_REF(objLogRefPtr, jvxLogLevel::JVX_LOGLEVEL_3_DEBUG_OPERATION_WITH_LOW_DEGREE_OUTPUT);
log << "Deactivating module <" << elm->second.supportNodeRuntime.driveSupportNodeChain.modName << "> with suffix <" <<
elm->second.supportNodeRuntime.driveSupportNodeChain.manSuffix << "> in location <" << jvxComponentIdentification_txt(elm->second.supportNodeRuntime.cpId) << ">." << std::endl;
elm->second.supportNodeRuntime.driveSupportNodeChain.cpManipulate.manSuffix << "> in location <" << jvxComponentIdentification_txt(elm->second.supportNodeRuntime.cpId) << ">." << std::endl;
JVX_STOP_LOCK_LOG_REF(objLogRefPtr);

jvxErrorType res = jvx_deactivateObjectInModule(refHostRefPtr, elm->second.supportNodeRuntime.cpId);
Expand Down

0 comments on commit abaee2b

Please sign in to comment.