lhtranmitterswitch.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #include "lhtranmitterswitch.h"
  2. #include "TransmitterSwitchInfo.h"
  3. #include "transmitterswitch.h"
  4. #include "loginit.h"
  5. TransmitterSwitch* g_pTransmitterSwitch = nullptr;
  6. InitData g_initData;
  7. int LHTRANSMITTERSWITCH_EXPORT DoInit(const InitData* pData)
  8. {
  9. /* 初始化日志库 */
  10. init_log();
  11. g_initData = *pData;
  12. return 0;
  13. }
  14. int LHTRANSMITTERSWITCH_EXPORT DoCreateWindow(int skintype, QWidget* parent)
  15. {
  16. if (g_pTransmitterSwitch == nullptr)
  17. {
  18. g_pTransmitterSwitch = new TransmitterSwitch(parent);
  19. if(skintype < 0 || skintype > 1)
  20. {
  21. g_pTransmitterSwitch->setUIStyle(0);
  22. return -2;
  23. }
  24. g_pTransmitterSwitch->setUIStyle(skintype);
  25. }
  26. g_pTransmitterSwitch->setWebAPIInfo(g_initData);
  27. return 0;
  28. }
  29. int LHTRANSMITTERSWITCH_EXPORT DoShowWindow(int skintype, bool showWindow)
  30. {
  31. if(g_pTransmitterSwitch == nullptr)
  32. {
  33. return -1;
  34. }
  35. if(skintype < 0 || skintype > 1)
  36. {
  37. g_pTransmitterSwitch->setUIStyle(0);
  38. return -2;
  39. }
  40. g_pTransmitterSwitch->setUIStyle(skintype);
  41. if(showWindow)
  42. {
  43. g_pTransmitterSwitch->show();
  44. } else
  45. {
  46. g_pTransmitterSwitch->hide();
  47. }
  48. return 0;
  49. }
  50. int LHTRANSMITTERSWITCH_EXPORT DoGetExecPlanFromEQM()
  51. {
  52. if(g_pTransmitterSwitch == nullptr)
  53. {
  54. return -1;
  55. }
  56. g_pTransmitterSwitch->getExecPlanFromEQM();
  57. return 0;
  58. }
  59. int LHTRANSMITTERSWITCH_EXPORT DoSaveExecPlanToEQM()
  60. {
  61. if(g_pTransmitterSwitch == nullptr)
  62. {
  63. return -1;
  64. }
  65. g_pTransmitterSwitch->saveExecPlanToEQM();
  66. return 0;
  67. }
  68. int LHTRANSMITTERSWITCH_EXPORT DoRelease()
  69. {
  70. if(g_pTransmitterSwitch != nullptr)
  71. {
  72. delete g_pTransmitterSwitch;
  73. g_pTransmitterSwitch = nullptr;
  74. }
  75. return 0;
  76. }