完善Password功能
This commit is contained in:
parent
6053e38e26
commit
0193784396
|
@ -92,8 +92,12 @@ int Qr_MenuCallback(UINT32 uiMessage, UINT32 uiParam)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDM_PASSWORD:
|
case IDM_PASSWORD:
|
||||||
|
{
|
||||||
|
if(puiPara->PwdSwitch != uwOption)
|
||||||
{
|
{
|
||||||
puiPara->PwdSwitch = uwOption;
|
puiPara->PwdSwitch = uwOption;
|
||||||
|
memset(puiPara->PwdStr, '0' ,sizeof(puiPara->PwdStr));
|
||||||
|
}
|
||||||
printf("password switch %d\n", puiPara->PwdSwitch);
|
printf("password switch %d\n", puiPara->PwdSwitch);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -701,6 +705,7 @@ void hidde_qr_picture_page(void)
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
static int PasswordIndex = 0;
|
static int PasswordIndex = 0;
|
||||||
static lv_obj_t* PasswordMatrixObj = NULL;
|
static lv_obj_t* PasswordMatrixObj = NULL;
|
||||||
|
static lv_obj_t* PasswordImage = NULL;
|
||||||
static char PasswordBuf1[2] = {'0', 0};
|
static char PasswordBuf1[2] = {'0', 0};
|
||||||
static char PasswordBuf2[2] = {'0', 0};
|
static char PasswordBuf2[2] = {'0', 0};
|
||||||
static char PasswordBuf3[2] = {'0', 0};
|
static char PasswordBuf3[2] = {'0', 0};
|
||||||
|
@ -720,30 +725,40 @@ static const char* PasswordMap[7] =
|
||||||
|
|
||||||
static void update_Password_msg(lv_obj_t* obj)
|
static void update_Password_msg(lv_obj_t* obj)
|
||||||
{
|
{
|
||||||
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
if(PasswordMatrixObj == NULL || PasswordImage == NULL)
|
||||||
|
{
|
||||||
|
DBG_ERR("Password component is not initialized");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||||
snprintf(PasswordBuf1, 2, "%c", puiPara->PwdStr[0]);
|
snprintf(PasswordBuf1, 2, "%c", puiPara->PwdStr[0]);
|
||||||
snprintf(PasswordBuf2, 2, "%c", puiPara->PwdStr[1]);
|
snprintf(PasswordBuf2, 2, "%c", puiPara->PwdStr[1]);
|
||||||
snprintf(PasswordBuf3, 2, "%c", puiPara->PwdStr[2]);
|
snprintf(PasswordBuf3, 2, "%c", puiPara->PwdStr[2]);
|
||||||
snprintf(PasswordBuf4, 2, "%c", puiPara->PwdStr[3]);
|
snprintf(PasswordBuf4, 2, "%c", puiPara->PwdStr[3]);
|
||||||
snprintf(PasswordBuf5, 2, "%c", puiPara->PwdStr[4]);
|
snprintf(PasswordBuf5, 2, "%c", puiPara->PwdStr[4]);
|
||||||
snprintf(PasswordBuf6, 2, "%c", puiPara->PwdStr[5]);
|
snprintf(PasswordBuf6, 2, "%c", puiPara->PwdStr[5]);
|
||||||
|
lv_btnmatrix_set_map(PasswordMatrixObj, PasswordMap);
|
||||||
|
|
||||||
lv_btnmatrix_set_focused_btn(PasswordMatrixObj, PasswordIndex);
|
lv_btnmatrix_set_focused_btn(PasswordMatrixObj, PasswordIndex);
|
||||||
lv_btnmatrix_set_map(PasswordMatrixObj, PasswordMap);
|
|
||||||
|
lv_obj_set_x(PasswordImage, (64 + 32 * PasswordIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_Password_page(lv_obj_t* obj)
|
void show_Password_page(lv_obj_t* obj)
|
||||||
{
|
{
|
||||||
|
if(PasswordMatrixObj != NULL || PasswordImage != NULL)
|
||||||
|
{
|
||||||
|
DBG_ERR("Password component is initialized");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PasswordIndex = 0;
|
PasswordIndex = 0;
|
||||||
|
|
||||||
init_Matrix_style();
|
init_Matrix_style();
|
||||||
|
|
||||||
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||||
// if(!puiPara->PwdSwitch)
|
|
||||||
{
|
|
||||||
memset(puiPara->PwdStr, '0' ,sizeof(puiPara->PwdStr));
|
|
||||||
}
|
|
||||||
snprintf(PasswordBuf1, 2, "%c", puiPara->PwdStr[0]);
|
snprintf(PasswordBuf1, 2, "%c", puiPara->PwdStr[0]);
|
||||||
snprintf(PasswordBuf2, 2, "%c", puiPara->PwdStr[1]);
|
snprintf(PasswordBuf2, 2, "%c", puiPara->PwdStr[1]);
|
||||||
snprintf(PasswordBuf3, 2, "%c", puiPara->PwdStr[2]);
|
snprintf(PasswordBuf3, 2, "%c", puiPara->PwdStr[2]);
|
||||||
|
@ -755,8 +770,8 @@ void show_Password_page(lv_obj_t* obj)
|
||||||
lv_obj_set_hidden(PasswordMatrixObj, false);
|
lv_obj_set_hidden(PasswordMatrixObj, false);
|
||||||
lv_obj_set_click(PasswordMatrixObj, true);
|
lv_obj_set_click(PasswordMatrixObj, true);
|
||||||
lv_obj_set_drag(PasswordMatrixObj, false);
|
lv_obj_set_drag(PasswordMatrixObj, false);
|
||||||
lv_obj_set_pos(PasswordMatrixObj, 92, 58);
|
lv_obj_set_pos(PasswordMatrixObj, 64, 108);
|
||||||
lv_obj_set_size(PasswordMatrixObj, 136, 140);
|
lv_obj_set_size(PasswordMatrixObj, 192, 24);
|
||||||
lv_btnmatrix_set_map(PasswordMatrixObj, PasswordMap);
|
lv_btnmatrix_set_map(PasswordMatrixObj, PasswordMap);
|
||||||
lv_btnmatrix_set_one_check(PasswordMatrixObj, true);
|
lv_btnmatrix_set_one_check(PasswordMatrixObj, true);
|
||||||
lv_btnmatrix_set_align(PasswordMatrixObj, LV_LABEL_ALIGN_CENTER);
|
lv_btnmatrix_set_align(PasswordMatrixObj, LV_LABEL_ALIGN_CENTER);
|
||||||
|
@ -764,34 +779,68 @@ void show_Password_page(lv_obj_t* obj)
|
||||||
lv_btnmatrix_set_one_check(PasswordMatrixObj, false);
|
lv_btnmatrix_set_one_check(PasswordMatrixObj, false);
|
||||||
lv_obj_add_style(PasswordMatrixObj, 0, &gMatrixStylebg);
|
lv_obj_add_style(PasswordMatrixObj, 0, &gMatrixStylebg);
|
||||||
lv_obj_add_style(PasswordMatrixObj, 1, &gMatrixStylebtn);
|
lv_obj_add_style(PasswordMatrixObj, 1, &gMatrixStylebtn);
|
||||||
|
|
||||||
|
PasswordImage = lv_img_create(obj, NULL);
|
||||||
|
lv_obj_set_hidden(PasswordImage, false);
|
||||||
|
lv_obj_set_click(PasswordImage, false);
|
||||||
|
lv_obj_set_drag(PasswordImage, false);
|
||||||
|
lv_obj_set_pos(PasswordImage, 64, 78);
|
||||||
|
lv_obj_set_size(PasswordImage, 32, 88);
|
||||||
|
lv_img_set_src(PasswordImage, &sf_pwd_down_up);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hidde_Password_page(void)
|
void hidde_Password_page(void)
|
||||||
{
|
{
|
||||||
|
printf("[%s]\n", __FUNCTION__);
|
||||||
|
PasswordIndex = 0;
|
||||||
if(PasswordMatrixObj)
|
if(PasswordMatrixObj)
|
||||||
{
|
{
|
||||||
lv_obj_del(PasswordMatrixObj);
|
lv_obj_del(PasswordMatrixObj);
|
||||||
|
PasswordMatrixObj = NULL;
|
||||||
|
}
|
||||||
|
if(PasswordImage)
|
||||||
|
{
|
||||||
|
lv_obj_del(PasswordImage);
|
||||||
|
PasswordImage = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Option_Password_Key(lv_obj_t* obj, uint32_t key)
|
void Option_Password_Key_Long_Press(lv_obj_t* obj, uint32_t key)
|
||||||
{
|
{
|
||||||
if(PasswordMatrixObj == NULL)
|
printf("[%s]key:%d\n", __FUNCTION__, key);
|
||||||
{
|
|
||||||
printf("PasswordMatrixObj is NULL");
|
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||||
return;
|
|
||||||
}
|
switch(key)
|
||||||
|
{
|
||||||
|
case LV_USER_KEY_NEXT:
|
||||||
|
if(PasswordIndex >= 0 && PasswordIndex <= 5)
|
||||||
|
{
|
||||||
|
puiPara->PwdStr[PasswordIndex] = (puiPara->PwdStr[PasswordIndex] - '0' + 10 - 1) % 10 + '0';
|
||||||
|
}
|
||||||
|
update_Password_msg(obj);
|
||||||
|
break;
|
||||||
|
case LV_USER_KEY_PREV:
|
||||||
|
if(PasswordIndex >= 0 && PasswordIndex <= 5)
|
||||||
|
{
|
||||||
|
puiPara->PwdStr[PasswordIndex] = (puiPara->PwdStr[PasswordIndex] - '0' + 1) % 10 + '0';
|
||||||
|
}
|
||||||
|
update_Password_msg(obj);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Option_Password_Key(lv_obj_t* obj, uint32_t key)
|
||||||
|
{
|
||||||
|
printf("[%s]key:%d\n", __FUNCTION__, key);
|
||||||
|
|
||||||
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||||
// char result[2];
|
|
||||||
// char tmpchar;
|
|
||||||
// char* p;
|
|
||||||
printf("key:%d\n",key);
|
|
||||||
|
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case LV_USER_KEY_NEXT:
|
case LV_USER_KEY_NEXT:
|
||||||
printf("\033[33m[Option_Password_Key]s\033[0m\n");
|
|
||||||
if(PasswordIndex >= 0 && PasswordIndex <= 5)
|
if(PasswordIndex >= 0 && PasswordIndex <= 5)
|
||||||
{
|
{
|
||||||
puiPara->PwdStr[PasswordIndex] = (puiPara->PwdStr[PasswordIndex] - '0' + 10 - 1) % 10 + '0';
|
puiPara->PwdStr[PasswordIndex] = (puiPara->PwdStr[PasswordIndex] - '0' + 10 - 1) % 10 + '0';
|
||||||
|
@ -799,7 +848,6 @@ void Option_Password_Key(lv_obj_t* obj, uint32_t key)
|
||||||
update_Password_msg(obj);
|
update_Password_msg(obj);
|
||||||
break;
|
break;
|
||||||
case LV_USER_KEY_PREV:
|
case LV_USER_KEY_PREV:
|
||||||
printf("\033[33m[Option_Password_Key]w\033[0m\n");
|
|
||||||
if(PasswordIndex >= 0 && PasswordIndex <= 5)
|
if(PasswordIndex >= 0 && PasswordIndex <= 5)
|
||||||
{
|
{
|
||||||
puiPara->PwdStr[PasswordIndex] = (puiPara->PwdStr[PasswordIndex] - '0' + 1) % 10 + '0';
|
puiPara->PwdStr[PasswordIndex] = (puiPara->PwdStr[PasswordIndex] - '0' + 1) % 10 + '0';
|
||||||
|
@ -807,18 +855,14 @@ void Option_Password_Key(lv_obj_t* obj, uint32_t key)
|
||||||
update_Password_msg(obj);
|
update_Password_msg(obj);
|
||||||
break;
|
break;
|
||||||
case LV_USER_KEY_LEFT:
|
case LV_USER_KEY_LEFT:
|
||||||
printf("\033[33m[Option_Password_Key]a\033[0m\n");
|
|
||||||
PasswordIndex = (PasswordIndex + 6 - 1) % 6;
|
PasswordIndex = (PasswordIndex + 6 - 1) % 6;
|
||||||
update_Password_msg(obj);
|
update_Password_msg(obj);
|
||||||
break;
|
break;
|
||||||
case LV_USER_KEY_RIGHT:
|
case LV_USER_KEY_RIGHT:
|
||||||
printf("\033[33m[Option_Password_Key]d\033[0m\n");
|
|
||||||
PasswordIndex = (PasswordIndex + 1) % 6;
|
PasswordIndex = (PasswordIndex + 1) % 6;
|
||||||
update_Password_msg(obj);
|
update_Password_msg(obj);
|
||||||
break;
|
break;
|
||||||
case LV_KEY_ENTER:
|
case LV_KEY_ENTER:
|
||||||
printf("\033[33m[Option_Password_Key]SELECT\033[0m\n");
|
|
||||||
puiPara->PwdSwitch = 1;
|
|
||||||
lv_plugin_scr_close(obj, gen_nvtmsg_data(NVTRET_ENTER_MENU, 0));
|
lv_plugin_scr_close(obj, gen_nvtmsg_data(NVTRET_ENTER_MENU, 0));
|
||||||
hidde_Password_page();
|
hidde_Password_page();
|
||||||
break;
|
break;
|
||||||
|
@ -867,7 +911,7 @@ static void update_Camera_Info_msg(lv_obj_t* obj)
|
||||||
strcat(CamInfoStr, tmpStr);
|
strcat(CamInfoStr, tmpStr);
|
||||||
}
|
}
|
||||||
else if(!CameraInfoisHidden)
|
else if(!CameraInfoisHidden)
|
||||||
strcat(CamInfoStr, "7MR5RCwD801\n");
|
strcat(CamInfoStr, SF_BASE_VERSION);
|
||||||
else
|
else
|
||||||
strcat(CamInfoStr, "\n");
|
strcat(CamInfoStr, "\n");
|
||||||
break;
|
break;
|
||||||
|
@ -1120,7 +1164,7 @@ static const char* CameraNameMap[7] =
|
||||||
|
|
||||||
static void update_Camera_Name_msg(lv_obj_t* obj)
|
static void update_Camera_Name_msg(lv_obj_t* obj)
|
||||||
{
|
{
|
||||||
if(CameraNameMatrixObj == NULL)
|
if(CameraNameMatrixObj == NULL || CameraNameImage == NULL)
|
||||||
{
|
{
|
||||||
DBG_ERR("Camera Name component is not initialized");
|
DBG_ERR("Camera Name component is not initialized");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -17,6 +17,7 @@ extern void hidde_Camera_Name_page(void);
|
||||||
|
|
||||||
extern void Option_Network_Selection_Key(lv_obj_t* obj, uint32_t key);
|
extern void Option_Network_Selection_Key(lv_obj_t* obj, uint32_t key);
|
||||||
extern void Option_Password_Key(lv_obj_t* obj, uint32_t key);
|
extern void Option_Password_Key(lv_obj_t* obj, uint32_t key);
|
||||||
|
extern void Option_Password_Key_Long_Press(lv_obj_t* obj, uint32_t key);
|
||||||
extern void Option_CAMERA_INFO_Key(lv_obj_t* obj, uint32_t key);
|
extern void Option_CAMERA_INFO_Key(lv_obj_t* obj, uint32_t key);
|
||||||
extern void Option_CAMERA_INFO_Key_Long_Press(lv_obj_t* obj, uint32_t key);
|
extern void Option_CAMERA_INFO_Key_Long_Press(lv_obj_t* obj, uint32_t key);
|
||||||
extern void Option_Camera_Name_Key(lv_obj_t* obj, uint32_t key);
|
extern void Option_Camera_Name_Key(lv_obj_t* obj, uint32_t key);
|
||||||
|
|
|
@ -845,6 +845,10 @@ void UIFlowMenuCommonOptionEventCallback(lv_obj_t* obj, lv_event_t event)
|
||||||
|
|
||||||
switch(itemID)
|
switch(itemID)
|
||||||
{
|
{
|
||||||
|
case IDM_PASSWORD:
|
||||||
|
KeyPressingTimeMs += LONG_PRESS_INTERVAL;
|
||||||
|
Option_Password_Key_Long_Press(obj, *key);
|
||||||
|
break;
|
||||||
case IDM_CAMERA_INFO:
|
case IDM_CAMERA_INFO:
|
||||||
KeyPressingTimeMs += LONG_PRESS_INTERVAL;
|
KeyPressingTimeMs += LONG_PRESS_INTERVAL;
|
||||||
if(KeyPressingTimeMs == 10 * 1000)
|
if(KeyPressingTimeMs == 10 * 1000)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user