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.
|
|
#pragma once
#include <stdint.h>
#include <functional>
#include "appevent_type.hpp"
extern "C" { #include "uicontroler/tjc/tjc_base_type.h"
#include "app_protocols/ble_through/ble_proto.h"
}
/**
* * @ע�� * ���������ṹ��������������������ջ���� */
// typedef struct {
// } AppEvent;
struct AcidStateChangeEvent { enum AcidStatChangeEventType subtype;
// ����
uint8_t addCh; float addChVal;
// ʹ��
float useVal[4]; }; typedef struct AcidStateChangeEvent AcidStateChangeEvent_t; typedef enum AcidStatChangeEventType AcidStatChangeEventType_t;
class AppEvent { public: AppEventType_t type; std::function<void()> onfnc = nullptr; const char* onfncmask = nullptr;
private: uint8_t buf[30]; UIEvent* uieventpointer = nullptr;
public: AppEvent() { static_assert(sizeof(buf) >= sizeof(AcidStateChangeEvent_t), "buf size must be larger than AcidStateChangeEvent_t"); memset(buf, 0, sizeof(buf)); }
public: int getBufSize() { return sizeof(buf); }
void setPageChangeTo(int32_t page) { *(int32_t*)buf = page; } int32_t getPageChangeTo() { return *(int32_t*)buf; }
void setHeartInfo(uint8_t *heart_info) { memcpy(buf, heart_info, sizeof(zble_heart_t)); } uint8_t* getHeartInfo() { return (uint8_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; } };
|