#include "lhtransmitterswitchapi.h" #include #include #include LHTransmitterSwitchAPI::LHTransmitterSwitchAPI() { } LHTransmitterSwitchAPI::~LHTransmitterSwitchAPI() { } /* 加载动态库 */ bool LHTransmitterSwitchAPI::loadLibrary() { #ifdef Q_OS_WIN QString libPath = QApplication::applicationDirPath() + "/libLHTransmitterSwitch.dll"; #elif defined(Q_OS_LINUX) QString libPath = QApplication::applicationDirPath() + "/libLHTransmitterSwitch.so"; #endif QLibrary lib(libPath); if(!lib.load()) { qDebug() << "load 《LHTransmitterSwitch》 library failed, path: " << libPath; return false; } m_pInit = (pInit)lib.resolve("DoInit"); m_pCreateWindow = (pCreateWindow)lib.resolve("DoCreateWindow"); m_pShowWindow = (pShowWindow)lib.resolve("DoShowWindow"); m_pGetExecPlanFromEQM = (pGetExecPlanFromEQM)lib.resolve("DoGetExecPlanFromEQM"); m_pSaveExecPlanToEQM = (pSaveExecPlanToEQM)lib.resolve("DoSaveExecPlanToEQM"); m_pRelease = (pRelease)lib.resolve("DoRelease"); m_pSetCallBack = (pSetCallBack)lib.resolve("DoSetCallBack"); if(m_pInit == nullptr || m_pCreateWindow == nullptr || m_pShowWindow == nullptr || m_pGetExecPlanFromEQM == nullptr || m_pSaveExecPlanToEQM == nullptr || m_pRelease == nullptr || m_pSetCallBack == nullptr) { return false; } return true; } int LHTransmitterSwitchAPI::DoInit(const InitData* pData) { if(pData == nullptr) { return -1; } return m_pInit(pData); } int LHTransmitterSwitchAPI::DoCreateWindow(int skintype, QWidget* parent) { if(parent == nullptr) { return -1; } return m_pCreateWindow(skintype, parent); } int LHTransmitterSwitchAPI::DoShowWindow(int skintype, bool showWindow) { return m_pShowWindow(skintype, showWindow); } int LHTransmitterSwitchAPI::DoGetExecPlanFromEQM() { return m_pGetExecPlanFromEQM(); } int LHTransmitterSwitchAPI::DoSaveExecPlanToEQM() { return m_pSaveExecPlanToEQM(); } int LHTransmitterSwitchAPI::DoRelease() { return m_pRelease(); } int LHTransmitterSwitchAPI::DoSetCallBack(trackCallBack cb) { return m_pSetCallBack(cb); }