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.

45 lines
995 B

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
  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. class AppEvent {
  16. public:
  17. AppEventType_t type;
  18. std::function<void()> onfnc;
  19. uint8_t buf[sizeof(UIEvent) + 10];
  20. char* getBleName() { return (char*)buf; }
  21. char* getStateDisplayInfo() { return (char*)buf; }
  22. UIEvent* getUIEvent() { return (UIEvent*)buf; }
  23. int32_t getPageChangeTo() { return *(int32_t*)buf; }
  24. void setBleName(const char* name) { strcpy((char*)buf, name); }
  25. void setStateDisplayInfo(const char* info) { strcpy((char*)buf, info); }
  26. void setUIEvent(const UIEvent& event) { memcpy(buf, &event, sizeof(UIEvent)); }
  27. void setPageChangeTo(int32_t page) { *(int32_t*)buf = page; }
  28. void setOnFnc(std::function<void()> fnc) { onfnc = fnc; }
  29. int getBufSize() { return sizeof(buf); }
  30. };