8 changed files with 128 additions and 614 deletions
-
44.cproject
-
9README.md
-
33usrc/uicontroler/base/page_processer.hpp
-
158usrc/uicontroler/front_end_controler.cpp
-
7usrc/uicontroler/front_end_controler.hpp
-
32usrc/uicontroler/page/page.hpp
-
433usrc/uicontroler/tjc/tjc_constant.cpp
-
26usrc/uicontroler/tjc/tjc_constant.hpp
@ -1,66 +1,53 @@ |
|||||
#pragma once
|
#pragma once
|
||||
|
|
||||
#include "apphardware/apphardware.hpp"
|
#include "apphardware/apphardware.hpp"
|
||||
|
#include "config/config.hpp"
|
||||
#include "uappbase/base.hpp"
|
#include "uappbase/base.hpp"
|
||||
|
#include "ui/ui.h"
|
||||
#include "uicontroler/front_end_controler.hpp"
|
#include "uicontroler/front_end_controler.hpp"
|
||||
#include "uicontroler/pagerouter/page_bak_router.hpp"
|
#include "uicontroler/pagerouter/page_bak_router.hpp"
|
||||
#include "config/config.hpp"
|
|
||||
|
|
||||
#include "ui/ui.h"
|
|
||||
namespace iflytop { |
namespace iflytop { |
||||
using namespace std; |
using namespace std; |
||||
|
|
||||
class OnPageLoadContext { |
class OnPageLoadContext { |
||||
public: |
public: |
||||
bool isFromPopWin = false; |
|
||||
|
bool placeHolder = false; |
||||
}; |
}; |
||||
|
|
||||
class IPageProcesser { |
class IPageProcesser { |
||||
private: |
private: |
||||
/* data */ |
/* data */ |
||||
|
uint32_t pageId = 0; |
||||
|
|
||||
public: |
public: |
||||
|
IPageProcesser(uint32_t pageId) { this->pageId = pageId; } |
||||
|
|
||||
virtual void initialize() { |
virtual void initialize() { |
||||
UIS->regOnUsrEventCb([this](tjc::tjc_usr_event_t* event) { |
UIS->regOnUsrEventCb([this](tjc::tjc_usr_event_t* event) { |
||||
if (!isBelongThisPage(event->pid)) { |
|
||||
|
if (pageId == event->pid) { |
||||
return; |
return; |
||||
} |
} |
||||
if (event->eventId == tjc::kpt_sys_event_page_id) { |
if (event->eventId == tjc::kpt_sys_event_page_id) { |
||||
OnPageLoadContext cxt = {0}; |
OnPageLoadContext cxt = {0}; |
||||
cxt.isFromPopWin = event->d.sys_event_page_id.isFromPopWin; |
|
||||
OnPageLoad(&cxt); |
OnPageLoad(&cxt); |
||||
} else if (event->eventId == tjc::kpt_double_state_button_event) { |
} else if (event->eventId == tjc::kpt_double_state_button_event) { |
||||
OnButton(event->bid, event->d.double_state_button.val); |
|
||||
|
OnDoubleStateButton(event->bid, event->d.double_state_button.val); |
||||
} else if (event->eventId == tjc::kpt_button_event) { |
} else if (event->eventId == tjc::kpt_button_event) { |
||||
OnButton(event->bid, event->d.button_event.val); |
OnButton(event->bid, event->d.button_event.val); |
||||
} else if (event->eventId == tjc::kpt_inputfield_content_change_event1 || event->eventId == tjc::kpt_inputfield_content_change_event0) { |
} else if (event->eventId == tjc::kpt_inputfield_content_change_event1 || event->eventId == tjc::kpt_inputfield_content_change_event0) { |
||||
OnInputFieldContentChange(event->bid, event->d.inputfield_content.text); |
OnInputFieldContentChange(event->bid, event->d.inputfield_content.text); |
||||
} else if (event->eventId == tjc::kpt_login_request) { |
|
||||
OnLoginButtonClick(event->bid, event->d.login_request.usrName, event->d.login_request.passwd); |
|
||||
} else if (event->eventId == tjc::kpt_unlogin_request) { |
|
||||
OnUnLoginButtonClick(event->bid); |
|
||||
} else if(event->eventId == tjc::kpt_on_keyboard_page_load){ |
|
||||
OnKeyboardPageLoad(); |
|
||||
} |
} |
||||
}); |
}); |
||||
|
|
||||
AppEventBus::ins()->regOnEvent([this](AppEvent_t* event) { |
|
||||
if (!isBelongThisPage(UIS->getNowPage())) { |
|
||||
return; |
|
||||
} |
|
||||
OnAppEvent(event); |
|
||||
}); |
|
||||
|
AppEventBus::ins()->regOnEvent([this](AppEvent_t* event) { OnAppEvent(event); }); |
||||
} |
} |
||||
|
|
||||
private: |
private: |
||||
virtual bool isBelongThisPage(int page) = 0; |
|
||||
|
|
||||
virtual void OnPageLoad(OnPageLoadContext* cxt) { return; }; |
virtual void OnPageLoad(OnPageLoadContext* cxt) { return; }; |
||||
virtual void OnKeyboardPageLoad() { return; }; |
|
||||
virtual void OnInputFieldContentChange(uint8_t bid, const char* text) { return; }; |
virtual void OnInputFieldContentChange(uint8_t bid, const char* text) { return; }; |
||||
virtual void OnButton(uint8_t bid, uint8_t val) { return; }; |
virtual void OnButton(uint8_t bid, uint8_t val) { return; }; |
||||
virtual void OnLoginButtonClick(uint8_t bid, const char* userName, const char* passwd) { return; }; |
|
||||
virtual void OnUnLoginButtonClick(uint8_t bid) { return; }; |
|
||||
|
virtual void OnDoubleStateButton(uint8_t bid, uint8_t val) { return; }; |
||||
virtual void OnAppEvent(AppEvent_t* event) { return; }; |
virtual void OnAppEvent(AppEvent_t* event) { return; }; |
||||
}; |
}; |
||||
|
|
||||
|
@ -1,19 +1,19 @@ |
|||||
#pragma once
|
#pragma once
|
||||
|
|
||||
#include "Page_login.hpp"
|
|
||||
#include "Page_main.hpp"
|
|
||||
#include "Page_menu.hpp"
|
|
||||
#include "keyboard/Page_keybAcidCh.hpp"
|
|
||||
#include "submenu/Page_changePasswd.hpp"
|
|
||||
#include "submenu/Page_muAcidType.hpp"
|
|
||||
#include "submenu/Page_muAudit.hpp"
|
|
||||
#include "submenu/Page_muDeviceInfo.hpp"
|
|
||||
#include "submenu/Page_muInterval.hpp"
|
|
||||
#include "submenu/Page_muPumpTest.hpp"
|
|
||||
#include "submenu/Page_muSettings.hpp"
|
|
||||
#include "submenu/Page_muUsrMgr.hpp"
|
|
||||
|
// #include "Page_login.hpp"
|
||||
|
// #include "Page_main.hpp"
|
||||
|
// #include "Page_menu.hpp"
|
||||
|
// #include "keyboard/Page_keybAcidCh.hpp"
|
||||
|
// #include "submenu/Page_changePasswd.hpp"
|
||||
|
// #include "submenu/Page_muAcidType.hpp"
|
||||
|
// #include "submenu/Page_muAudit.hpp"
|
||||
|
// #include "submenu/Page_muDeviceInfo.hpp"
|
||||
|
// #include "submenu/Page_muInterval.hpp"
|
||||
|
// #include "submenu/Page_muPumpTest.hpp"
|
||||
|
// #include "submenu/Page_muSettings.hpp"
|
||||
|
// #include "submenu/Page_muUsrMgr.hpp"
|
||||
|
|
||||
//
|
|
||||
#include "submenu/Page_muBleHandSett.hpp"
|
|
||||
#include "submenu/Page_muMotorSett.hpp"
|
|
||||
#include "submenu/Page_muPumpSett.hpp"
|
|
||||
|
// //
|
||||
|
// #include "submenu/Page_muBleHandSett.hpp"
|
||||
|
// #include "submenu/Page_muMotorSett.hpp"
|
||||
|
// #include "submenu/Page_muPumpSett.hpp"
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue