|
|
@ -14,37 +14,51 @@ bool Page_muUsrMgr::isBelongThisPage(int page) { return page == PAGE; } |
|
|
|
|
|
|
|
void Page_muUsrMgr::OnPageLoad() { //
|
|
|
|
ZLOGI(TAG, "OnPageLoad"); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr1name, "usr1"); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr2name, "usr2"); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr3name, "usr3"); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr4name, "usr4"); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr5name, "usr5"); |
|
|
|
|
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr1en, 1); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr2en, 1); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr3en, 1); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr4en, 1); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr5en, 1); |
|
|
|
updatePage(); |
|
|
|
}; |
|
|
|
void Page_muUsrMgr::updatePage() { |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr0name, getCfgStr(kusr_name0)); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr1name, getCfgStr(kusr_name1)); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr2name, getCfgStr(kusr_name2)); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr3name, getCfgStr(kusr_name3)); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr4name, getCfgStr(kusr_name4)); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr5name, getCfgStr(kusr_name5)); |
|
|
|
|
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr1en, (int)getCfgBool(kusr_enable1)); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr2en, (int)getCfgBool(kusr_enable2)); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr3en, (int)getCfgBool(kusr_enable3)); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr4en, (int)getCfgBool(kusr_enable4)); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr5en, (int)getCfgBool(kusr_enable5)); |
|
|
|
} |
|
|
|
|
|
|
|
void Page_muUsrMgr::OnInputFieldContentChange(uint8_t bid, const char* text) { |
|
|
|
if (bid == ob_muUsrMgr_usr1ReName) { |
|
|
|
ZLOGI(TAG, "rename usr1:%s", text); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr1name, text); |
|
|
|
} else if (bid == ob_muUsrMgr_usr2ReName) { |
|
|
|
CS->setcfgAndFlush(kusr_name1, text); |
|
|
|
updatePage(); |
|
|
|
} //
|
|
|
|
else if (bid == ob_muUsrMgr_usr2ReName) { |
|
|
|
ZLOGI(TAG, "rename usr2:%s", text); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr2name, text); |
|
|
|
} else if (bid == ob_muUsrMgr_usr3ReName) { |
|
|
|
CS->setcfgAndFlush(kusr_name2, text); |
|
|
|
updatePage(); |
|
|
|
} //
|
|
|
|
else if (bid == ob_muUsrMgr_usr3ReName) { |
|
|
|
ZLOGI(TAG, "rename usr3:%s", text); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr3name, text); |
|
|
|
} else if (bid == ob_muUsrMgr_usr4ReName) { |
|
|
|
CS->setcfgAndFlush(kusr_name3, text); |
|
|
|
updatePage(); |
|
|
|
} //
|
|
|
|
else if (bid == ob_muUsrMgr_usr4ReName) { |
|
|
|
ZLOGI(TAG, "rename usr4:%s", text); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr4name, text); |
|
|
|
} else if (bid == ob_muUsrMgr_usr5ReName) { |
|
|
|
CS->setcfgAndFlush(kusr_name4, text); |
|
|
|
updatePage(); |
|
|
|
} //
|
|
|
|
else if (bid == ob_muUsrMgr_usr5ReName) { |
|
|
|
ZLOGI(TAG, "rename usr5:%s", text); |
|
|
|
UIS->setVal(PAGE, ob_muUsrMgr_usr5name, text); |
|
|
|
CS->setcfgAndFlush(kusr_name5, text); |
|
|
|
updatePage(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void Page_muUsrMgr::OnButton(uint8_t bid, uint8_t val) { |
|
|
|
static CfgItermCache usrpasswdcache; |
|
|
|
ZLOGI(TAG, "bid:%d", bid); |
|
|
@ -53,24 +67,49 @@ void Page_muUsrMgr::OnButton(uint8_t bid, uint8_t val) { |
|
|
|
UIS->chpage(GSM->getMenuPage()); |
|
|
|
} else if (bid == ob_muUsrMgr_usr1Rest) { |
|
|
|
ZLOGI(TAG, "reset usr1 "); |
|
|
|
CS->setcfgAndFlush(kusr_name1, USER1_DEFAULT_NAME); |
|
|
|
CS->setcfgAndFlush(kusr_passwd1, USER_DEFAULT_PWD); |
|
|
|
updatePage(); |
|
|
|
} else if (bid == ob_muUsrMgr_usr2Rest) { |
|
|
|
ZLOGI(TAG, "reset usr2 "); |
|
|
|
CS->setcfgAndFlush(kusr_name2, USER2_DEFAULT_NAME); |
|
|
|
CS->setcfgAndFlush(kusr_passwd2, USER_DEFAULT_PWD); |
|
|
|
updatePage(); |
|
|
|
} else if (bid == ob_muUsrMgr_usr3Rest) { |
|
|
|
ZLOGI(TAG, "reset usr3 "); |
|
|
|
CS->setcfgAndFlush(kusr_name3, USER3_DEFAULT_NAME); |
|
|
|
CS->setcfgAndFlush(kusr_passwd3, USER_DEFAULT_PWD); |
|
|
|
updatePage(); |
|
|
|
} else if (bid == ob_muUsrMgr_usr4Rest) { |
|
|
|
ZLOGI(TAG, "reset usr4 "); |
|
|
|
CS->setcfgAndFlush(kusr_name4, USER4_DEFAULT_NAME); |
|
|
|
CS->setcfgAndFlush(kusr_passwd4, USER_DEFAULT_PWD); |
|
|
|
updatePage(); |
|
|
|
} else if (bid == ob_muUsrMgr_usr5Rest) { |
|
|
|
ZLOGI(TAG, "reset usr5 "); |
|
|
|
CS->setcfgAndFlush(kusr_name5, USER5_DEFAULT_NAME); |
|
|
|
CS->setcfgAndFlush(kusr_passwd5, USER_DEFAULT_PWD); |
|
|
|
updatePage(); |
|
|
|
} else if (bid == ob_muUsrMgr_usr1en) { |
|
|
|
ZLOGI(TAG, "enable usr1 %d", val); |
|
|
|
CS->setcfgAndFlush(kusr_enable1, (bool)val); |
|
|
|
updatePage(); |
|
|
|
} else if (bid == ob_muUsrMgr_usr2en) { |
|
|
|
ZLOGI(TAG, "enable usr2 %d", val); |
|
|
|
CS->setcfgAndFlush(kusr_enable2, (bool)val); |
|
|
|
updatePage(); |
|
|
|
} else if (bid == ob_muUsrMgr_usr3en) { |
|
|
|
ZLOGI(TAG, "enable usr3 %d", val); |
|
|
|
CS->setcfgAndFlush(kusr_enable3, (bool)val); |
|
|
|
updatePage(); |
|
|
|
} else if (bid == ob_muUsrMgr_usr4en) { |
|
|
|
ZLOGI(TAG, "enable usr4 %d", val); |
|
|
|
CS->setcfgAndFlush(kusr_enable4, (bool)val); |
|
|
|
updatePage(); |
|
|
|
} else if (bid == ob_muUsrMgr_usr5en) { |
|
|
|
ZLOGI(TAG, "enable usr5 %d", val); |
|
|
|
CS->setcfgAndFlush(kusr_enable5, (bool)val); |
|
|
|
updatePage(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|