You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
2.5 KiB

3 months ago
  1. #pragma once
  2. #include "uappbase/appcfg/appcfg.hpp"
  3. #include "uappbase/appdep.hpp"
  4. #include "uappbase/bean/bean.hpp"
  5. //
  6. #include "app_protocols/ble_through/ble_proto.h"
  7. namespace iflytop {
  8. using namespace std;
  9. #define GSM GStateMgr::ins()
  10. #define CH_NUM 4
  11. class GStateMgr {
  12. private:
  13. bool m_powerOn = true;
  14. /**
  15. * @brief û״̬
  16. */
  17. char m_loginUsr[MAX_USR_NAME_SIZE + 1];
  18. int m_loginUsrId = -1;
  19. user_role_t m_loginUsrType = kuser;
  20. bool m_isLogin = false;
  21. /**
  22. * @brief ң״̬
  23. */
  24. int32_t m_RemoterS; // ң����״̬ 1:����,0:����
  25. char m_RemoterName[20];
  26. /**
  27. * @brief ״̬
  28. */
  29. hand_acid_mode_t m_RunMode = khand_acid_m_jog_mode; // ����ģʽ
  30. bool m_pumpSelectState[CH_NUM] = {false}; // ѡ���ı�
  31. /**
  32. * @brief ͳ
  33. */
  34. float acidUsed[CH_NUM] = {0.0};
  35. float acidRemain[CH_NUM] = {0.0};
  36. zmutex m_mutex = {"GStateMgr"};
  37. public:
  38. bool supperAdmin = false;
  39. public:
  40. static GStateMgr* ins() {
  41. static GStateMgr instance;
  42. return &instance;
  43. }
  44. void initialize();
  45. /**
  46. * @brief powerOn
  47. *
  48. */
  49. void setPowerOn(bool state) { m_powerOn = state; }
  50. bool getPowerOn() { return m_powerOn; }
  51. /**
  52. * @brief û״̬
  53. */
  54. void setLogin(int loginUsrId, const char* usrName, user_role_t role);
  55. void setUnLogin();
  56. bool isLogin();
  57. user_role_t getLoginUsrType();
  58. const char* getLoginUsr();
  59. int getUserId();
  60. /**
  61. * @brief ң״̬
  62. */
  63. void setRemoterS(int32_t state, const char* name);
  64. void setRemoterHeart(int32_t state, uint8_t * name);
  65. const char* getRemoterName();
  66. /**
  67. * @brief ״̬
  68. */
  69. void setRunMode(hand_acid_mode_t mode);
  70. void changeToNextRunMode();
  71. void setPumpSelectState(int32_t index, bool state);
  72. int32_t getRemoterS();
  73. hand_acid_mode_t getRunMode();
  74. bool isHasPumpSelect();
  75. bool getPumpSelectState(int32_t index);
  76. /**
  77. * @brief ͳ
  78. */
  79. /**
  80. * @brief
  81. *
  82. *
  83. * 1.ʣ:
  84. * .ʱ޸
  85. * .ʱ޸
  86. *
  87. * 2.ʹ:
  88. * .¼ʱʼΪ
  89. * .ʹʱ޸ģʵʱ
  90. * .dzʱ
  91. *
  92. * ݿ
  93. * .
  94. * .ʹü¼
  95. *
  96. * 1.
  97. *
  98. */
  99. void setAcidRemain(int32_t index, float val);
  100. void setAcidUsed(int32_t index, float val);
  101. float getAcidRemain(int32_t index);
  102. float getAcidUsed(int32_t index);
  103. //
  104. void placeHolder() {}
  105. };
  106. } // namespace iflytop