lhtranmitterswitch.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. }