BUG:10646 切换运营商后显示并等待三秒重启

This commit is contained in:
xiehongyan 2023-12-26 18:19:04 +08:00
parent 00f035982c
commit b3c93d9abd
6 changed files with 131 additions and 16 deletions

View File

@ -425,6 +425,7 @@ static void network_scan_task_cb(lv_task_t* task)
} }
else else
{ {
lv_label_set_text(plabel, "\n\nSearching...");
if(!sf_file_IsExsit(NETMSGPATH)) if(!sf_file_IsExsit(NETMSGPATH))
{ {
SF_MESSAGE_BUF_S stMessageBuf = {0}; SF_MESSAGE_BUF_S stMessageBuf = {0};
@ -527,11 +528,26 @@ static void network_select_task_cb(lv_task_t* task)
{ {
case 0x00:/*CMD_SUCCESS*/ case 0x00:/*CMD_SUCCESS*/
lv_label_set_text(plabel, "\n\nCompleted"); lv_label_set_text(plabel, "\n\nCompleted");
sf_cardv_set_operationSelectResp(0xff);
SF_MESSAGE_BUF_S stMessageBuf = {0};
stMessageBuf.arg1 = SF_DEV_CMD_ESIM_OPERATION_SELECT;
stMessageBuf.arg2 = SF_CONTROL_TYPE_LOCAL;
stMessageBuf.arg3 = ProfileFocused;
stMessageBuf.cmdId = CMD_DEV;
sf_com_message_send_to_app(&stMessageBuf);
Countdown = 3; Countdown = 3;
break; break;
case 0x34:/*NETWORK_NOT_NEED_SET*/ case 0x34:/*NETWORK_NOT_NEED_SET*/
lv_label_set_text(plabel, "\n\nProfile is enabled"); lv_label_set_text(plabel, "\n\nProfile is enabled");
Countdown = 3; Countdown = 3;
while (Countdown > 0)
{
Countdown--;
usleep(1000*1000);
}
network_select_task_end();
lv_plugin_scr_close(obj, gen_nvtmsg_data(NVTRET_ENTER_MENU, 0));
hidde_Network_Selection_page();
break; break;
case 0xff: case 0xff:
break; break;
@ -607,7 +623,7 @@ void Option_Network_Selection_Key(lv_obj_t* obj, uint32_t key)
} }
else else
{ {
ProfileFocused = 0; ProfileFocused = ProfileTotal-1;
} }
update_Network_Selection_msg(obj); update_Network_Selection_msg(obj);
} }
@ -623,13 +639,7 @@ void Option_Network_Selection_Key(lv_obj_t* obj, uint32_t key)
{ {
lv_obj_set_hidden(container_main_menu_scr_uiflowmenucommonoption, true); lv_obj_set_hidden(container_main_menu_scr_uiflowmenucommonoption, true);
lv_label_set_text(plabel, "\n\nNetwork Switching..."); lv_label_set_text(plabel, "\n\nNetwork Switching...");
sf_cardv_set_operationSelectResp(0xff);
SF_MESSAGE_BUF_S stMessageBuf = {0};
stMessageBuf.arg1 = SF_DEV_CMD_ESIM_OPERATION_SELECT;
stMessageBuf.arg2 = SF_CONTROL_TYPE_LOCAL;
stMessageBuf.arg3 = ProfileFocused;
stMessageBuf.cmdId = CMD_DEV;
sf_com_message_send_to_app(&stMessageBuf);
if(network_select_task == NULL){ if(network_select_task == NULL){
Countdown = 0; Countdown = 0;
network_select_task = lv_task_create(network_select_task_cb, 1000, LV_TASK_PRIO_MID, (void*)obj); network_select_task = lv_task_create(network_select_task_cb, 1000, LV_TASK_PRIO_MID, (void*)obj);
@ -711,7 +721,8 @@ static void qr_page_task_cb(lv_task_t* task){
/*Create a 100x100 QR code*/ /*Create a 100x100 QR code*/
printf("[qr_page_task_cb]qr code create...\n"); printf("[qr_page_task_cb]qr code create...\n");
qr = lv_qrcode_create(obj, 115, (lv_color_t) { .full = 0x02}, (lv_color_t) { .full = 0x23});//23
qr = lv_qrcode_create(obj, 120, (lv_color_t) { .full = 0x02}, (lv_color_t) { .full = 0x23});//23
lv_obj_set_pos(qr, 42, 75); lv_obj_set_pos(qr, 42, 75);
lv_qrcode_update(qr, qr_date, strlen(qr_date)); lv_qrcode_update(qr, qr_date, strlen(qr_date));

View File

@ -475,6 +475,12 @@ static void LV_MenuCommonOption_UpdateContent(TM_MENU *pMenu)
ui_hidden = false; ui_hidden = false;
break; break;
} }
default:
{
itemIconId = LV_PLUGIN_IMG_ID_SF_LIST_SELECTED;//√
lv_obj_set_pos(image_option2_scr_uiflowmenucommonoption, 272, 0);
break;
}
} }
} }
@ -1163,6 +1169,15 @@ static void UIFlowMenuCommonOption_ScrClose(lv_obj_t* obj)
message_item_close(); message_item_close();
UIMenuStoreInfo *puiPara = sf_ui_para_get(); UIMenuStoreInfo *puiPara = sf_ui_para_get();
printf("camera mode = %d\n", puiPara->CamMode); printf("camera mode = %d\n", puiPara->CamMode);
UINT16 itemIconId = LV_PLUGIN_IMG_ID_SF_LIST_SELECTED;//√
lv_obj_set_pos(image_option1_scr_uiflowmenucommonoption, 272, 0);
lv_obj_set_pos(image_option2_scr_uiflowmenucommonoption, 272, 0);
lv_obj_set_pos(image_option3_scr_uiflowmenucommonoption, 272, 0);
lv_obj_set_pos(image_option4_scr_uiflowmenucommonoption, 272, 0);
lv_plugin_menu_set_item_img_id(menu_option, 0, LV_PLUGIN_MENU_ITEM_VISIBLE_STATE_NUM, itemIconId);
lv_plugin_menu_set_item_img_id(menu_option, 1, LV_PLUGIN_MENU_ITEM_VISIBLE_STATE_NUM, itemIconId);
lv_plugin_menu_set_item_img_id(menu_option, 2, LV_PLUGIN_MENU_ITEM_VISIBLE_STATE_NUM, itemIconId);
lv_plugin_menu_set_item_img_id(menu_option, 3, LV_PLUGIN_MENU_ITEM_VISIBLE_STATE_NUM, itemIconId);
} }
static void UIFlowMenuCommonOption_ChildScrClose(lv_obj_t* obj) static void UIFlowMenuCommonOption_ChildScrClose(lv_obj_t* obj)

View File

@ -28,7 +28,7 @@ EXTRA_INCLUDE += \
-I$(NVT_HDAL_DIR)/vendor/media/include \ -I$(NVT_HDAL_DIR)/vendor/media/include \
#--------- ENVIRONMENT SETTING -------------------- #--------- ENVIRONMENT SETTING --------------------
WARNING = -Wall -Wundef -Wsign-compare -Wno-missing-braces -Wstrict-prototypes -Werror WARNING = -Wall -Wundef -Wno-missing-braces -Wstrict-prototypes -Werror
COMPILE_OPTS = -I. -O2 -fPIC -ffunction-sections -fdata-sections -DSOCKLEN_T=socklen_t -D__LINUX_USER__ -D_TODO_=0 COMPILE_OPTS = -I. -O2 -fPIC -ffunction-sections -fdata-sections -DSOCKLEN_T=socklen_t -D__LINUX_USER__ -D_TODO_=0
C_PREDEFINED = -D_NVT_CONSOLE_ C_PREDEFINED = -D_NVT_CONSOLE_
C_CFLAGS = $(PLATFORM_CFLAGS) $(COMPILE_OPTS) $(WARNING) $(EXTRA_INCLUDE) $(C_PREDEFINED) C_CFLAGS = $(PLATFORM_CFLAGS) $(COMPILE_OPTS) $(WARNING) $(EXTRA_INCLUDE) $(C_PREDEFINED)
@ -186,7 +186,7 @@ EXTRA_INCLUDE += \
-I$(NVT_HDAL_DIR)/vendor/media/include \ -I$(NVT_HDAL_DIR)/vendor/media/include \
-I$(NVT_HDAL_DIR)/include \ -I$(NVT_HDAL_DIR)/include \
C_CFLAGS = $(PLATFORM_CFLAGS) $(EXTRA_INCLUDE) -DDEBUG -Wno-format -D_TODO_=0 -Wno-inline C_CFLAGS = $(PLATFORM_CFLAGS) $(EXTRA_INCLUDE) -DDEBUG -Wno-format -Wno-sign-compare -D_TODO_=0 -Wno-inline
SRC = \ SRC = \
lvgl/src/lv_font/lv_font.c \ lvgl/src/lv_font/lv_font.c \
@ -291,9 +291,9 @@ SRC = \
lvgl/src/lv_hal/lv_hal_indev.c \ lvgl/src/lv_hal/lv_hal_indev.c \
lvgl/src/lv_hal/lv_hal_tick.c \ lvgl/src/lv_hal/lv_hal_tick.c \
lvgl/src/lv_gpu/lv_gpu_nvt_dma2d.c \ lvgl/src/lv_gpu/lv_gpu_nvt_dma2d.c \
lvgl/src/lv_lib_qrcode/lv_qrcode.c \ lvgl/src/lv_lib_qrcode/lv_qrcode.c \
lvgl/src/lv_lib_qrcode/qrcodegen.c \ lvgl/src/lv_lib_qrcode/qrcodegen.c \
copy = if [ ! -z "$(1)" -a "$(1)" != " " ]; then cp -avf $(1) $(2); fi copy = if [ ! -z "$(1)" -a "$(1)" != " " ]; then cp -avf $(1) $(2); fi
OBJ = $(SRC:.c=.o) OBJ = $(SRC:.c=.o)

View File

@ -73,6 +73,77 @@ lv_obj_t * lv_qrcode_create(lv_obj_t * parent, lv_coord_t size, lv_color_t dark_
} }
lv_coord_t lv_qrcode_base_size(const void * data, uint32_t data_len)
{
uint8_t* qr0 = NULL;
uint8_t* data_tmp = NULL;
lv_res_t ret = LV_RES_OK;
if(data_len > qrcodegen_BUFFER_LEN_MAX){
ret = LV_RES_INV;
goto EXIT;
}
qr0 = (uint8_t*)lv_mem_alloc(qrcodegen_BUFFER_LEN_MAX);
if(qr0 == NULL){
ret = LV_RES_INV;
goto EXIT;
}
data_tmp = (uint8_t*)lv_mem_alloc(qrcodegen_BUFFER_LEN_MAX);
if(data_tmp == NULL){
ret = LV_RES_INV;
goto EXIT;
}
memcpy(data_tmp, data, data_len);
bool ok = qrcodegen_encodeBinary(data_tmp, data_len,
qr0, qrcodegen_Ecc_MEDIUM,
qrcodegen_VERSION_MIN, qrcodegen_VERSION_MAX,
qrcodegen_Mask_AUTO, true);
if (!ok) {
ret = LV_RES_INV;
goto EXIT;
}
int qr_size = qrcodegen_getSize(qr0);
EXIT:
if(qr0){
lv_mem_free(qr0);
}
if(data_tmp){
lv_mem_free(data_tmp);
}
if(ret == LV_RES_INV)
return -1;
else
return qr_size;
}
lv_coord_t lv_qrcode_evaluate_size(lv_coord_t target_size, uint8_t border_ratio, const void * data, uint32_t data_len)
{
lv_coord_t qr_size = lv_qrcode_base_size(data, data_len);
if(qr_size <= 0){
return -1;
}
/* size with no border */
target_size = target_size - (target_size % qr_size);
lv_coord_t scale = target_size / qr_size;
lv_coord_t scaled = qr_size * scale;
lv_coord_t border = (scaled * border_ratio) / 100;
return (target_size + (border * 2));
}
/** /**
* Set the data of a QR code object * Set the data of a QR code object
* @param qrcode pointer to aQ code object * @param qrcode pointer to aQ code object
@ -125,6 +196,7 @@ lv_res_t lv_qrcode_update(lv_obj_t * qrcode, const void * data, uint32_t data_le
int scale = obj_w / qr_size; int scale = obj_w / qr_size;
int scaled = qr_size * scale; int scaled = qr_size * scale;
int margin = (obj_w - scaled) / 2; int margin = (obj_w - scaled) / 2;
lv_img_dsc_t * img = lv_canvas_get_img(qrcode); lv_img_dsc_t * img = lv_canvas_get_img(qrcode);
uint8_t * buf_u8 = (uint8_t *)img->data + 8; /*+8 skip the palette*/ uint8_t * buf_u8 = (uint8_t *)img->data + 8; /*+8 skip the palette*/
/* Copy the qr code canvas: /* Copy the qr code canvas:
@ -167,7 +239,7 @@ lv_res_t lv_qrcode_update(lv_obj_t * qrcode, const void * data, uint32_t data_le
} }
/*The Qr is probably scaled so simply to the repeated rows*/ /*The Qr is probably scaled so simply to the repeated rows*/
int s; uint32_t s;
const uint8_t * row_ori = buf_u8 + row_byte_cnt * y; const uint8_t * row_ori = buf_u8 + row_byte_cnt * y;
for(s = 1; s < scale; s++) { for(s = 1; s < scale; s++) {
memcpy((uint8_t*)buf_u8 + row_byte_cnt * (y + s), row_ori, row_byte_cnt); memcpy((uint8_t*)buf_u8 + row_byte_cnt * (y + s), row_ori, row_byte_cnt);

View File

@ -55,6 +55,23 @@ lv_res_t lv_qrcode_update(lv_obj_t * qrcode, const void * data, uint32_t data_le
*/ */
void lv_qrcode_delete(lv_obj_t * qrcode); void lv_qrcode_delete(lv_obj_t * qrcode);
/**
* Calculate best fit size with border ratio.
* Please use this API before lv_qrcode_create
*
* lv_coord_t target_size = 100;
* lv_coord_t evaluate_size = lv_qrcode_evaluate_size(target_size, 5, data, data_len);
* lv_obj_t * qr = lv_qrcode_create(parent, evaluate_size, dark_color, light_color);
*
* @param target_size
* @param margin_ratio 0-100, 5 means qrcode keeps 5% margin of scaled size , 0 is no margin
* @param data data to display
* @param data_len length of data in bytes
* @return best fit size
*/
lv_coord_t lv_qrcode_evaluate_size(lv_coord_t target_size, uint8_t border_ratio, const void * data, uint32_t data_len);
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/

View File

@ -853,7 +853,7 @@ testable int calcSegmentBitLength(enum qrcodegen_Mode mode, size_t numChars) {
return -1; return -1;
} }
assert(result >= 0); assert(result >= 0);
if (result > (long)INT16_MAX) if (result > (unsigned int)INT16_MAX)
return -1; return -1;
return (int)result; return (int)result;
} }