12 changed files with 356 additions and 168 deletions
-
1uappbase/bean/appevent.h
-
BINui/hand_acid_mainboard_ui.HMI
-
2ui/ui.h
-
2usrc/project_configs.h
-
54usrc/service/app_core.cpp
-
2usrc/service/remote_controler.cpp
-
90usrc/service/remote_controler_event_processer.cpp
-
5usrc/service/remote_controler_event_processer.hpp
-
38usrc/uicontroler/page/mupage/muDeviceInfo_page.cpp
-
89usrc/uicontroler/page/mupage/muReCtrlerBind_page.cpp
-
239usrc/uicontroler/page/navi_page.cpp
-
2usrc/uicontroler/ui_controler.cpp
@ -0,0 +1,38 @@ |
|||
|
|||
#include "db/dao/user_dao.hpp"
|
|||
#include "uappbase/apphal/apphal.hpp"
|
|||
#include "ui/ui.h"
|
|||
#include "uicontroler/base/page_processer.hpp"
|
|||
//
|
|||
#include "db/dao/acid_ch_cfg_dao.hpp"
|
|||
#include "db/dao/device_setting_dao.hpp"
|
|||
//
|
|||
#include "service/pump_ctrl_service.hpp"
|
|||
|
|||
namespace iflytop { |
|||
using namespace std; |
|||
#define TAG "muDeviceInfoPage"
|
|||
|
|||
class muDeviceInfoPage : public IPageProcesser { |
|||
private: |
|||
public: |
|||
muDeviceInfoPage() : IPageProcesser(TAG, pg_muDeviceInfo) {} |
|||
|
|||
virtual void initialize() override { |
|||
IPageProcesser::initialize(); |
|||
setText(ob_muDeviceInfo_softVers, "V%s", APP_VERSION); |
|||
setText(ob_muDeviceInfo_deviceId, "%s", sn_get_str()); |
|||
setText(ob_muDeviceInfo_manufa, "中国黄金"); |
|||
} |
|||
|
|||
private: |
|||
virtual void onPageLoad(OnPageLoadContext* cxt) override { return; }; |
|||
virtual void onBackKey() override { UIControler::ins()->chpage(pg_navi, true); }; |
|||
|
|||
virtual void onInputFieldContentChange(uint8_t bid, uint8_t slecId, const char* text) override {}; |
|||
virtual void onClickRelease(uint8_t bid, uint8_t val, const char* text) override {} |
|||
}; |
|||
|
|||
// 实例化Page, 使其自动注册
|
|||
static muDeviceInfoPage instance; |
|||
} // namespace iflytop
|
@ -0,0 +1,89 @@ |
|||
|
|||
#include "db/dao/user_dao.hpp"
|
|||
#include "service/remote_controler.hpp"
|
|||
#include "uappbase/apphal/apphal.hpp"
|
|||
#include "ui/ui.h"
|
|||
#include "uicontroler/base/page_processer.hpp"
|
|||
//
|
|||
#include "db/dao/acid_ch_cfg_dao.hpp"
|
|||
#include "db/dao/device_setting_dao.hpp"
|
|||
//
|
|||
#include "service/pump_ctrl_service.hpp"
|
|||
|
|||
namespace iflytop { |
|||
using namespace std; |
|||
#define TAG "muReCtrlerBindPage"
|
|||
static bool m_scaning; |
|||
class muReCtrlerBindPage : public IPageProcesser { |
|||
private: |
|||
public: |
|||
muReCtrlerBindPage() : IPageProcesser(TAG, pg_muReCtlerBind) {} |
|||
|
|||
virtual void initialize() override { |
|||
IPageProcesser::initialize(); |
|||
setText(ob_muReCtlerBind_bleCliName, "%s", ""); |
|||
setText(ob_muReCtlerBind_bleEvent, "%s", ""); |
|||
setText(ob_muReCtlerBind_infoWin, "%s", ""); |
|||
|
|||
RCTRL->regOnReport([this](uint8_t* rx, int32_t len) { |
|||
zble_proto_packet_t* packet = (zble_proto_packet_t*)rx; |
|||
if (UIS->getNowPage() != thisPage) { |
|||
return; |
|||
} |
|||
|
|||
if (packet->cmd == kzble_app_report_key_event) { |
|||
int32_t keyEvent = *(int32_t*)packet->data; |
|||
if (keyEvent == hand_acid_remoter_kevent_add_liquid) { |
|||
setText(ob_muReCtlerBind_bleEvent, "加液"); |
|||
} |
|||
if (keyEvent == hand_acid_remoter_kevent_change_next_mode) { |
|||
setText(ob_muReCtlerBind_bleEvent, "模式切换"); |
|||
} |
|||
if (keyEvent == hand_acid_remoter_kevent_reflux) { |
|||
setText(ob_muReCtlerBind_bleEvent, "液路回流"); |
|||
} |
|||
if (keyEvent == hand_acid_remoter_kevent_preFilling) { |
|||
setText(ob_muReCtlerBind_bleEvent, "液路预充"); |
|||
} |
|||
return; |
|||
} |
|||
}); |
|||
} |
|||
|
|||
private: |
|||
virtual void onPageLoad(OnPageLoadContext* cxt) override { return; }; |
|||
virtual void onBackKey() override { |
|||
if (m_scaning) { |
|||
RCTRL->startScan("XXXXXXXXX", false); // 相当于停止扫描
|
|||
} |
|||
UIControler::ins()->chpage(pg_navi, true); |
|||
}; |
|||
|
|||
virtual void onInputFieldContentChange(uint8_t bid, uint8_t slecId, const char* text) override {}; |
|||
virtual void onClickRelease(uint8_t bid, uint8_t val, const char* text) override { |
|||
if (bid == ob_muReCtlerBind_scan) { |
|||
ZLOGI(TAG, "bleScan"); |
|||
bool suc = RCTRL->startScan(BLENAME, true); |
|||
if (suc) { |
|||
setText(ob_muReCtlerBind_infoWin, "%s", "扫描中..."); |
|||
m_scaning = true; |
|||
} |
|||
m_scaning = true; |
|||
} |
|||
} |
|||
|
|||
virtual void onAppEvent(AppEvent_t* event) override { |
|||
if (event->type == kAE_RemoterConnectedEvent) { |
|||
ZLOGI(TAG, "ble connect success"); |
|||
setText(ob_muReCtlerBind_infoWin, "%s", "扫描到设备"); |
|||
DeviceSettingDao::updateBleClientName(event->d.bleName); |
|||
setText(ob_muReCtlerBind_infoWin, "%s", "绑定成功"); |
|||
setText(ob_muReCtlerBind_bleCliName, "%s", event->d.bleName); |
|||
m_scaning = false; |
|||
} |
|||
} |
|||
}; |
|||
|
|||
// 实例化Page, 使其自动注册
|
|||
static muReCtrlerBindPage instance; |
|||
} // namespace iflytop
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue