#pragma once #include #include #include "appevent_type.hpp" extern "C" { #include "uicontroler/tjc/tjc_base_type.h" } /** * * @注意 * 下面这个结构不易定义过大,否则容易造成栈溢出 */ // typedef struct { // } AppEvent; class AppEvent { public: AppEventType_t type; std::function onfnc; uint8_t buf[sizeof(UIEvent) + 10]; char* getBleName() { return (char*)buf; } char* getStateDisplayInfo() { return (char*)buf; } UIEvent* getUIEvent() { return (UIEvent*)buf; } int32_t getPageChangeTo() { return *(int32_t*)buf; } void setBleName(const char* name) { strcpy((char*)buf, name); } void setStateDisplayInfo(const char* info) { strcpy((char*)buf, info); } void setUIEvent(const UIEvent& event) { memcpy(buf, &event, sizeof(UIEvent)); } void setPageChangeTo(int32_t page) { *(int32_t*)buf = page; } void setOnFnc(std::function fnc) { onfnc = fnc; } int getBufSize() { return sizeof(buf); } };