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.

65 lines
1.5 KiB

9 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. #pragma once
  2. #include <stdint.h>
  3. #include <functional>
  4. #include "appevent_type.hpp"
  5. extern "C" {
  6. #include "uicontroler/tjc/tjc_base_type.h"
  7. }
  8. /**
  9. *
  10. * @ע
  11. * ׶󣬷ջ
  12. */
  13. // typedef struct {
  14. // } AppEvent;
  15. struct AcidStateChangeEvent {
  16. enum AcidStatChangeEventType subtype;
  17. // ����
  18. uint8_t addCh;
  19. float addChVal;
  20. // ʹ��
  21. float useVal[4];
  22. };
  23. typedef struct AcidStateChangeEvent AcidStateChangeEvent_t;
  24. typedef enum AcidStatChangeEventType AcidStatChangeEventType_t;
  25. class AppEvent {
  26. public:
  27. AppEventType_t type;
  28. std::function<void()> onfnc = nullptr;
  29. const char* onfncmask = nullptr;
  30. private:
  31. uint8_t buf[30];
  32. UIEvent* uieventpointer = nullptr;
  33. public:
  34. AppEvent() {
  35. static_assert(sizeof(buf) >= sizeof(AcidStateChangeEvent_t), "buf size must be larger than AcidStateChangeEvent_t");
  36. memset(buf, 0, sizeof(buf));
  37. }
  38. public:
  39. int getBufSize() { return sizeof(buf); }
  40. void setPageChangeTo(int32_t page) { *(int32_t*)buf = page; }
  41. int32_t getPageChangeTo() { return *(int32_t*)buf; }
  42. void setStateDisplayInfo(const char* info) { strncpy((char*)buf, info, sizeof(buf)); }
  43. char* getStateDisplayInfo() { return (char*)buf; }
  44. UIEvent* getUIEvent() { return uieventpointer; }
  45. void setUIEvent(UIEvent* event) { uieventpointer = event; }
  46. AcidStateChangeEvent_t* getAcidStateChangeEvent() { return (AcidStateChangeEvent_t*)buf; }
  47. void setOnFnc(std::function<void()> fnc) { onfnc = fnc; }
  48. };