123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- #include "lhtranmitterswitch.h"
- #include "TransmitterSwitchInfo.h"
- #include "transmitterswitch.h"
- #include "loginit.h"
- #include <thread>
- TransmitterSwitch* g_pTransmitterSwitch = nullptr;
- InitData g_initData;
- int LHTRANSMITTERSWITCH_EXPORT DoInit(const InitData* pData)
- {
- /* 初始化日志库 */
- init_log();
- g_initData = *pData;
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoCreateWindow(int skintype, QWidget* parent)
- {
- if (g_pTransmitterSwitch == nullptr)
- {
- g_pTransmitterSwitch = new TransmitterSwitch(parent);
- if(skintype < 0 || skintype > 1)
- {
- g_pTransmitterSwitch->setUIStyle(1);
- return -2;
- }
- g_pTransmitterSwitch->setUIStyle(skintype);
- }
- g_pTransmitterSwitch->setWebAPIInfo(g_initData);
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoShowWindow(int skintype, bool showWindow)
- {
- if(g_pTransmitterSwitch == nullptr)
- {
- return -1;
- }
- if(skintype < 0 || skintype > 1)
- {
- // g_pTransmitterSwitch->setUIStyle(0);
- return -2;
- }
- g_pTransmitterSwitch->setUIStyle(skintype);
- if(showWindow)
- {
- g_pTransmitterSwitch->show();
- } else
- {
- g_pTransmitterSwitch->hide();
- }
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoGetExecPlanFromEQM()
- {
- if(g_pTransmitterSwitch == nullptr)
- {
- return -1;
- }
- g_pTransmitterSwitch->getExecPlanFromEQM();
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoSaveExecPlanToEQM()
- {
- if(g_pTransmitterSwitch == nullptr)
- {
- return -1;
- }
- g_pTransmitterSwitch->saveExecPlanToEQM();
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoRelease()
- {
- if(g_pTransmitterSwitch != nullptr)
- {
- delete g_pTransmitterSwitch;
- g_pTransmitterSwitch = nullptr;
- }
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoSetCallBack(trackCallBack cb)
- {
- if(g_pTransmitterSwitch == nullptr)
- {
- return -1;
- }
- g_pTransmitterSwitch->setTrackCallBack(cb);
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoInitLibrary()
- {
- /* 初始化日志库 */
- init_log();
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoCreateOneWindow(int skintype, QWidget* parent)
- {
- if (g_pTransmitterSwitch == nullptr)
- {
- g_pTransmitterSwitch = new TransmitterSwitch(parent);
- if(skintype < 0 || skintype > 1)
- {
- g_pTransmitterSwitch->setUIStyle(1);
- return -2;
- }
- g_pTransmitterSwitch->setUIStyle(skintype);
- }
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoSetWebAPIInfo(InitData* pData)
- {
- if(g_pTransmitterSwitch == nullptr)
- {
- return -1;
- }
- g_pTransmitterSwitch->setWebAPIInfoOnly(*pData);
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoSetChannelInfo(ExecPlanInfo* info, bool useOnlineDB)
- {
- if(g_pTransmitterSwitch == nullptr)
- {
- return -1;
- }
- g_pTransmitterSwitch->setFrequencyInfo(*info, useOnlineDB);
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoSetOnePageCardNum(int horNum, int verNum)
- {
- if(g_pTransmitterSwitch == nullptr)
- {
- return -1;
- }
- g_pTransmitterSwitch->setOnePageCardNum(horNum, verNum);
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoGetPlanData(QList<OnePlanItemInfo>* listPlan, ExecPlanConfig* config, int channelID)
- {
- if(g_pTransmitterSwitch == nullptr)
- {
- return -1;
- }
- g_pTransmitterSwitch->getOnePlanData(listPlan, config, channelID);
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoSetPlanData(QList<OnePlanItemInfo>& listPlan, ExecPlanConfig& config, int channelID)
- {
- if(g_pTransmitterSwitch == nullptr)
- {
- return -1;
- }
- g_pTransmitterSwitch->setOnePlanData(listPlan, config, channelID);
- return 0;
- }
- int LHTRANSMITTERSWITCH_EXPORT DoClearAll()
- {
- if(g_pTransmitterSwitch == nullptr)
- {
- return -1;
- }
- g_pTransmitterSwitch->clearAll();
- return 0;
- }
|