diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.cpp b/src/ATBAPP/ATBDeviceControllerPlugin.cpp index ec80640..a4a8de2 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.cpp +++ b/src/ATBAPP/ATBDeviceControllerPlugin.cpp @@ -7,6 +7,7 @@ #include #include +#include ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent) : QObject(parent), @@ -477,7 +478,26 @@ void ATBDeviceControllerPlugin::onCashPayStoped() bool ATBDeviceControllerPlugin::private_loadCashAgentLib(QString pluginName) { if (pluginName == "") { - pluginName = "/usr/lib/libCashAgentLib.so"; + + // search list for plugin (.so) file: + QStringList pluginNameList; + pluginNameList << "/usr/lib/libCAmaster.so" + << "/usr/lib/libCashAgentLib.so"; + // using C++11 range based loop: + for (const auto& filename : pluginNameList) { + if (QFileInfo(filename).isReadable()) { + pluginName = filename; + break; + } + } + + if (pluginName == "") { + qCritical() << "ATBDeviceControllerPlugin: CashAgentLib not installed!"; + this->errorCode = "CashAgentLib::NOT_FOUND"; + this->errorDescription = "ERROR: no CashAgentLib: "; + return false; + } + } if (!QLibrary::isLibrary(pluginName)) {