lhtranmitterswitch.cpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. #include "lhtranmitterswitch.h"
  2. #include "TransmitterSwitchInfo.h"
  3. #include "transmitterswitch.h"
  4. #include "loginit.h"
  5. #include <thread>
  6. TransmitterSwitch* g_pTransmitterSwitch = nullptr;
  7. InitData g_initData;
  8. int LHTRANSMITTERSWITCH_EXPORT DoInit(const InitData* pData)
  9. {
  10. /* 初始化日志库 */
  11. init_log();
  12. g_initData = *pData;
  13. return 0;
  14. }
  15. int LHTRANSMITTERSWITCH_EXPORT DoCreateWindow(int skintype, QWidget* parent)
  16. {
  17. if (g_pTransmitterSwitch == nullptr)
  18. {
  19. g_pTransmitterSwitch = new TransmitterSwitch(parent);
  20. if(skintype < 0 || skintype > 1)
  21. {
  22. g_pTransmitterSwitch->setUIStyle(1);
  23. return -2;
  24. }
  25. g_pTransmitterSwitch->setUIStyle(skintype);
  26. }
  27. g_pTransmitterSwitch->setWebAPIInfo(g_initData);
  28. return 0;
  29. }
  30. int LHTRANSMITTERSWITCH_EXPORT DoShowWindow(int skintype, bool showWindow)
  31. {
  32. if(g_pTransmitterSwitch == nullptr)
  33. {
  34. return -1;
  35. }
  36. if(skintype < 0 || skintype > 1)
  37. {
  38. // g_pTransmitterSwitch->setUIStyle(0);
  39. return -2;
  40. }
  41. g_pTransmitterSwitch->setUIStyle(skintype);
  42. if(showWindow)
  43. {
  44. g_pTransmitterSwitch->show();
  45. } else
  46. {
  47. g_pTransmitterSwitch->hide();
  48. }
  49. return 0;
  50. }
  51. int LHTRANSMITTERSWITCH_EXPORT DoGetExecPlanFromEQM()
  52. {
  53. if(g_pTransmitterSwitch == nullptr)
  54. {
  55. return -1;
  56. }
  57. g_pTransmitterSwitch->getExecPlanFromEQM();
  58. return 0;
  59. }
  60. int LHTRANSMITTERSWITCH_EXPORT DoSaveExecPlanToEQM()
  61. {
  62. if(g_pTransmitterSwitch == nullptr)
  63. {
  64. return -1;
  65. }
  66. g_pTransmitterSwitch->saveExecPlanToEQM();
  67. return 0;
  68. }
  69. int LHTRANSMITTERSWITCH_EXPORT DoRelease()
  70. {
  71. if(g_pTransmitterSwitch != nullptr)
  72. {
  73. delete g_pTransmitterSwitch;
  74. g_pTransmitterSwitch = nullptr;
  75. }
  76. return 0;
  77. }
  78. int LHTRANSMITTERSWITCH_EXPORT DoSetCallBack(trackCallBack cb)
  79. {
  80. if(g_pTransmitterSwitch == nullptr)
  81. {
  82. return -1;
  83. }
  84. g_pTransmitterSwitch->setTrackCallBack(cb);
  85. return 0;
  86. }
  87. int LHTRANSMITTERSWITCH_EXPORT DoInitLibrary()
  88. {
  89. /* 初始化日志库 */
  90. init_log();
  91. return 0;
  92. }
  93. int LHTRANSMITTERSWITCH_EXPORT DoCreateOneWindow(int skintype, QWidget* parent)
  94. {
  95. if (g_pTransmitterSwitch == nullptr)
  96. {
  97. g_pTransmitterSwitch = new TransmitterSwitch(parent);
  98. if(skintype < 0 || skintype > 1)
  99. {
  100. g_pTransmitterSwitch->setUIStyle(1);
  101. return -2;
  102. }
  103. g_pTransmitterSwitch->setUIStyle(skintype);
  104. }
  105. return 0;
  106. }
  107. int LHTRANSMITTERSWITCH_EXPORT DoSetWebAPIInfo(InitData* pData)
  108. {
  109. if(g_pTransmitterSwitch == nullptr)
  110. {
  111. return -1;
  112. }
  113. g_pTransmitterSwitch->setWebAPIInfoOnly(*pData);
  114. return 0;
  115. }
  116. int LHTRANSMITTERSWITCH_EXPORT DoSetChannelInfo(ExecPlanInfo* info, bool useOnlineDB)
  117. {
  118. if(g_pTransmitterSwitch == nullptr)
  119. {
  120. return -1;
  121. }
  122. g_pTransmitterSwitch->setFrequencyInfo(*info, useOnlineDB);
  123. return 0;
  124. }
  125. int LHTRANSMITTERSWITCH_EXPORT DoSetOnePageCardNum(int horNum, int verNum)
  126. {
  127. if(g_pTransmitterSwitch == nullptr)
  128. {
  129. return -1;
  130. }
  131. g_pTransmitterSwitch->setOnePageCardNum(horNum, verNum);
  132. return 0;
  133. }
  134. int LHTRANSMITTERSWITCH_EXPORT DoGetPlanData(QList<OnePlanItemInfo>* listPlan, ExecPlanConfig* config, int channelID)
  135. {
  136. if(g_pTransmitterSwitch == nullptr)
  137. {
  138. return -1;
  139. }
  140. g_pTransmitterSwitch->getOnePlanData(listPlan, config, channelID);
  141. return 0;
  142. }
  143. int LHTRANSMITTERSWITCH_EXPORT DoSetPlanData(QList<OnePlanItemInfo>& listPlan, ExecPlanConfig& config, int channelID)
  144. {
  145. if(g_pTransmitterSwitch == nullptr)
  146. {
  147. return -1;
  148. }
  149. g_pTransmitterSwitch->setOnePlanData(listPlan, config, channelID);
  150. return 0;
  151. }
  152. int LHTRANSMITTERSWITCH_EXPORT DoClearAll()
  153. {
  154. if(g_pTransmitterSwitch == nullptr)
  155. {
  156. return -1;
  157. }
  158. g_pTransmitterSwitch->clearAll();
  159. return 0;
  160. }