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.
50 lines
1.2 KiB
50 lines
1.2 KiB
#pragma once
|
|
#include <stdint.h>
|
|
|
|
#include <functional>
|
|
|
|
#include "appevent_type.hpp"
|
|
extern "C" {
|
|
#include "uicontroler/tjc/tjc_base_type.h"
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @注意
|
|
* 下面这个结构不易定义过大,否则容易造成栈溢出
|
|
*/
|
|
|
|
// typedef struct {
|
|
// } AppEvent;
|
|
|
|
class AppEvent {
|
|
public:
|
|
AppEventType_t type;
|
|
std::function<void()> onfnc = nullptr;
|
|
|
|
private:
|
|
uint8_t buf[50];
|
|
UIEvent* uieventpointer = nullptr;
|
|
|
|
public:
|
|
AppEvent() { memset(buf, 0, sizeof(buf)); }
|
|
|
|
public:
|
|
int getBufSize() { return sizeof(buf); }
|
|
|
|
void setBleName(const char* name) { strncpy((char*)buf, name, sizeof(buf)); }
|
|
char* getBleName() { return (char*)buf; }
|
|
|
|
void setPageChangeTo(int32_t page) { *(int32_t*)buf = page; }
|
|
int32_t getPageChangeTo() { return *(int32_t*)buf; }
|
|
|
|
void setStateDisplayInfo(const char* info) { strncpy((char*)buf, info, sizeof(buf)); }
|
|
char* getStateDisplayInfo() { return (char*)buf; }
|
|
|
|
UIEvent* getUIEvent() { return uieventpointer; }
|
|
void setUIEvent(UIEvent* event) { uieventpointer = event; }
|
|
|
|
AcidStateChangeEvent_t* getAcidStateChangeEvent() { return (AcidStateChangeEvent_t*)buf; }
|
|
|
|
void setOnFnc(std::function<void()> fnc) { onfnc = fnc; }
|
|
};
|