int8_t attempts = 0; \
bool run = true; \
while (run) { \
try { \
CMD; \
run = false; \
break; \
} catch (...) { \
std::string err = boost::current_exception_diagnostic_information(); \
if (err.find("BadSessionIdInvalid") != std::string::npos) { \
LOG4CPLUS_INFO(
Logger(), fmt::format(
"{}: OPC UA Connection lost - trying to " \
"reconnect ... ({}/10)", NAME, (attempts + 1))); \
if (++attempts <= 10) { \
sleep(1); \
m_opcua_client.Disconnect(); \
m_opcua_client.Connect("CAMERA#1", GetDeviceAddress()); \
continue; \
} \
} \
throw; \
} \
}
log4cplus::Logger & Logger()
Definition: base.cpp:9