|
|
@ -188,6 +188,15 @@ void FrontEndControler::processUsrButtonEvent(uint8_t* data, size_t len) { |
|
|
|
event_cache.pid = data[1]; |
|
|
|
event_cache.bid = data[2]; |
|
|
|
|
|
|
|
if (event_cache.pid == pg_confirm && event_cache.bid == ob_confirm_confirm) { |
|
|
|
if (m_onConfirmPageConfirmKey) m_onConfirmPageConfirmKey(true); |
|
|
|
m_onConfirmPageConfirmKey = nullptr; |
|
|
|
} else if (event_cache.pid == pg_confirm && event_cache.bid == ob_confirm_canclekey) { |
|
|
|
if (m_onAlertPageConfirmKey) m_onAlertPageConfirmKey(false); |
|
|
|
m_onAlertPageConfirmKey = nullptr; |
|
|
|
} else if (event_cache.pid == pg_alert && event_cache.bid == ob_alert_confirmkey) { |
|
|
|
} |
|
|
|
|
|
|
|
callUsrEventCb(&event_cache); |
|
|
|
} |
|
|
|
void FrontEndControler::processUsrDoubleStateButtonEvent(uint8_t* data, size_t len) { |
|
|
@ -336,18 +345,43 @@ bool FrontEndControler::vis(uint16_t buuid, int32_t val) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
void FrontEndControler::alert(const char* info, ...) { |
|
|
|
void FrontEndControler::alert(const char* info, function<void(bool)> onConfirm) { |
|
|
|
zlock_guard lg(m_cmdlock); |
|
|
|
|
|
|
|
va_list args; |
|
|
|
va_start(args, info); |
|
|
|
m_onAlertPageConfirmKey = onConfirm; |
|
|
|
static char buf[128]; |
|
|
|
vsprintf(buf, info, args); |
|
|
|
sprintf(buf, "%s", info); |
|
|
|
|
|
|
|
sendcmd("p[%d].b[%d].val=dp", pg_alert, ob_alert_frompage); |
|
|
|
sendcmd("p[%d].b[%d].txt=\"%s\"", pg_alert, ob_alert_info, buf); |
|
|
|
sendcmd("page alert"); |
|
|
|
} |
|
|
|
|
|
|
|
void FrontEndControler::confirmNoCancle(const char* info, function<void(bool)> onConfirm) { |
|
|
|
zlock_guard lg(m_cmdlock); |
|
|
|
m_onConfirmPageConfirmKey = onConfirm; |
|
|
|
|
|
|
|
static char buf[128]; |
|
|
|
sprintf(buf, "%s", info); |
|
|
|
|
|
|
|
sendcmd("p[%d].b[%d].val=dp", pg_confirm, ob_confirm_frompage); |
|
|
|
sendcmd("p[%d].b[%d].txt=\"%s\"", pg_confirm, ob_confirm_info, buf); |
|
|
|
sendcmd("page confirm"); |
|
|
|
vis(ob_confirm_canclekey, 0); |
|
|
|
} |
|
|
|
|
|
|
|
void FrontEndControler::confirm(const char* info, function<void(bool)> onConfirm) { |
|
|
|
zlock_guard lg(m_cmdlock); |
|
|
|
m_onConfirmPageConfirmKey = onConfirm; |
|
|
|
|
|
|
|
static char buf[128]; |
|
|
|
sprintf(buf, "%s", info); |
|
|
|
|
|
|
|
sendcmd("p[%d].b[%d].val=dp", pg_confirm, ob_confirm_frompage); |
|
|
|
sendcmd("p[%d].b[%d].txt=\"%s\"", pg_confirm, ob_confirm_info, buf); |
|
|
|
sendcmd("page confirm"); |
|
|
|
vis(ob_confirm_canclekey, 1); |
|
|
|
} |
|
|
|
|
|
|
|
void FrontEndControler::chpage(uint8_t page) { sendcmd("page %d", page); } |
|
|
|
|
|
|
|
void FrontEndControler::sendcmd(const char* format, ...) { |
|
|
|