A27R版本修改
This commit is contained in:
@ -3,14 +3,117 @@
|
||||
#include "../common/data_port.h"
|
||||
#include "../common/universal.h"
|
||||
|
||||
#ifdef AMT630HV100
|
||||
#include "FreeRTOS.h"
|
||||
#include "gpio_protocol.h"
|
||||
#endif
|
||||
|
||||
#define TIME_COUNTDOWN 60
|
||||
|
||||
uint8_t prompt_flag = 0;
|
||||
|
||||
uint32_t refresh_TIME1S_flag = 0;
|
||||
uint8_t time_countdown = TIME_COUNTDOWN;
|
||||
|
||||
extern uint8_t wifi_flag;//升级界面标志
|
||||
extern uint8_t bt_upgrade_flag;
|
||||
|
||||
extern char strQrText[200];
|
||||
extern char strCarplayPWD[50];
|
||||
extern void getTextAfterLastEqual(char *strQrText, char *text);
|
||||
extern void ap_get_ssid(char *strQrText, char *text);
|
||||
extern void ap_get_pwd(char *strQrText, char *text);
|
||||
extern widget_t *qr_create(widget_t *parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
|
||||
void insert_str(char *str, const char *insert_str1, const char *insert_str2) {
|
||||
char *pos = strstr(str, "S:");
|
||||
if (pos != NULL) {
|
||||
pos += 2; // 移动到"S:"后面的位置
|
||||
|
||||
char temp[100];
|
||||
strcpy(temp, pos); // 保存"S:"后面的内容
|
||||
|
||||
strcpy(pos, insert_str1); // 插入insert_str1
|
||||
strcat(str, ";P:");
|
||||
strcat(str, insert_str2);
|
||||
strcat(str, ";;");
|
||||
strcat(str, temp); // 恢复"S:"后面的内容
|
||||
}
|
||||
}
|
||||
|
||||
void prompt_win_init(widget_t *win){
|
||||
Set_sys_pace(0);
|
||||
Set_sys_plan(0);
|
||||
|
||||
if(bt_upgrade_flag){
|
||||
widget_t* countdown_view = widget_lookup(win, "countdown_view", TRUE);
|
||||
widget_t* wifi_view = widget_lookup(win, "wifi_view", TRUE);
|
||||
widget_set_visible(countdown_view,FALSE);
|
||||
widget_set_visible(wifi_view,FALSE);
|
||||
}else{
|
||||
widget_t* wifi_view = widget_lookup(win, "wifi_view", TRUE);
|
||||
|
||||
if(strlen(strQrText) != 0){
|
||||
char wifitext[100] = "WIFI:T:WPA;S:";
|
||||
char strssid[50] = {0};
|
||||
char strpwd[50] = {0};
|
||||
#if (MOTO_WARE_HOSE == MOTO_ICMX_A580A)
|
||||
// strcpy(strssid, strQrText);
|
||||
// strcpy(strpwd, strCarplayPWD);
|
||||
ap_get_ssid(strQrText, strssid);
|
||||
ap_get_pwd(strQrText, strpwd);
|
||||
#elif (MOTO_WARE_HOSE == MOTO_ICMX_A590A)
|
||||
ap_get_ssid(strQrText, strssid);
|
||||
ap_get_pwd(strQrText, strpwd);
|
||||
#endif
|
||||
|
||||
printf("wifi_name>%s.\r\n",strssid);
|
||||
|
||||
printf("wifi_pwd>%s.\r\n",strpwd);
|
||||
insert_str(wifitext, strssid, strpwd);
|
||||
printf("wifi_text>>>%s.",wifitext);
|
||||
|
||||
widget_t* AP = widget_lookup(win, "AP", TRUE);
|
||||
widget_t* PWD = widget_lookup(win, "PWD", TRUE);
|
||||
widget_t* state = widget_lookup(win, "state", TRUE);
|
||||
|
||||
widget_t *wifi_qr = qr_create(win, 72, 270, 200, 200);
|
||||
qr_set_value(wifi_qr, wifitext);
|
||||
widget_set_text_utf8(AP, strssid);
|
||||
widget_set_text_utf8(PWD, strpwd);
|
||||
if(Get_sys_wifi()){
|
||||
widget_set_style_str(state, "normal.text_color", "#00FF00");
|
||||
if(Get_sys_language())
|
||||
widget_set_text_utf8(state,"Connect");
|
||||
else
|
||||
widget_set_text_utf8(state,"已连接");
|
||||
}else{
|
||||
widget_set_style_str(state, "normal.text_color", "#FF0000");
|
||||
if(Get_sys_language())
|
||||
widget_set_text_utf8(state,"Disconnect");
|
||||
else
|
||||
widget_set_text_utf8(state,"未连接");
|
||||
}
|
||||
}else{
|
||||
widget_set_visible(wifi_view,FALSE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static ret_t prompt_refresh(const timer_info_t* timer){ //demo Progress bar Color change
|
||||
widget_t*win = WIDGET(timer->ctx);
|
||||
widget_t* plan_bar = widget_lookup(win, "plan_bar", TRUE);
|
||||
widget_t* point_text = widget_lookup(win, "point_text", TRUE);
|
||||
widget_t* state = widget_lookup(win, "state", TRUE);
|
||||
widget_t* countdown_view = widget_lookup(win, "countdown_view", TRUE);
|
||||
widget_t* wifi_view = widget_lookup(win, "wifi_view", TRUE);
|
||||
|
||||
// widget_t* prompt_image = NULL;
|
||||
double buf =0;
|
||||
uint8_t count =0;
|
||||
double x,y;
|
||||
uint8_t language_state = Get_sys_language();
|
||||
|
||||
widget_use_style(win,"ui_bg_color_bk");
|
||||
|
||||
@ -22,26 +125,123 @@ static ret_t prompt_refresh(const timer_info_t* timer){ //demo Progress bar Colo
|
||||
count = (int)buf;
|
||||
widget_set_value(plan_bar,count);
|
||||
if(Get_sys_upgrade()==1){
|
||||
widget_set_text_utf8(point_text,"升级拷贝中...");
|
||||
if(language_state)
|
||||
widget_set_text_utf8(point_text,"Upgrading copy...");
|
||||
else
|
||||
widget_set_text_utf8(point_text,"升级拷贝中...");
|
||||
// widget_set_text_utf8(point_text,"升级拷贝中...");
|
||||
}else{
|
||||
widget_set_text_utf8(point_text,"升级中...");
|
||||
if(language_state)
|
||||
widget_set_text_utf8(point_text,"Upgrading in progress...");
|
||||
else
|
||||
widget_set_text_utf8(point_text,"升级中...");
|
||||
}
|
||||
}
|
||||
|
||||
if(bt_upgrade_flag){
|
||||
widget_set_visible(countdown_view,FALSE);
|
||||
widget_set_visible(wifi_view,FALSE);
|
||||
}else{
|
||||
if(Get_sys_wifi()){
|
||||
widget_set_style_str(state, "normal.text_color", "#00FF00");
|
||||
if(language_state)
|
||||
widget_set_text_utf8(state,"Connect");
|
||||
else
|
||||
widget_set_text_utf8(state,"已连接");
|
||||
widget_set_visible(countdown_view,FALSE);
|
||||
if(time_countdown!= TIME_COUNTDOWN){
|
||||
time_countdown = TIME_COUNTDOWN;
|
||||
char tmpStr[10] = {0};
|
||||
widget_t* countdown = widget_lookup(win, "countdown", TRUE);
|
||||
tk_snprintf(tmpStr, sizeof(tmpStr), "%d", time_countdown);
|
||||
widget_set_text_utf8(countdown, tmpStr);
|
||||
wifi_flag = 2;
|
||||
#ifdef AMT630HV100
|
||||
refresh_TIME1S_flag = 0;
|
||||
#else
|
||||
refresh_TIME1S_flag = 0;
|
||||
#endif
|
||||
}
|
||||
}else{
|
||||
widget_set_style_str(state, "normal.text_color", "#FF0000");
|
||||
if(language_state)
|
||||
widget_set_text_utf8(state,"Disconnect");
|
||||
else
|
||||
widget_set_text_utf8(state,"未连接");
|
||||
widget_set_visible(countdown_view,TRUE);
|
||||
|
||||
#ifdef AMT630HV100
|
||||
if(xTaskGetTickCount() - refresh_TIME1S_flag > configTICK_RATE_HZ && (Get_sys_power_on_self_test()==100)){
|
||||
if(time_countdown){
|
||||
time_countdown--;
|
||||
char tmpStr[10] = {0};
|
||||
widget_t* countdown = widget_lookup(win, "countdown", TRUE);
|
||||
tk_snprintf(tmpStr, sizeof(tmpStr), "%d", time_countdown);
|
||||
widget_set_text_utf8(countdown, tmpStr);
|
||||
}else{
|
||||
return_theme();//如果目标是非主demo界面or投屏界面 则返回主demo界面
|
||||
}
|
||||
refresh_TIME1S_flag = xTaskGetTickCount();
|
||||
}
|
||||
#else
|
||||
if(refresh_TIME1S_flag >= 10 && (Get_sys_power_on_self_test()==100)){
|
||||
if(time_countdown){
|
||||
time_countdown--;
|
||||
char tmpStr[10] = {0};
|
||||
widget_t* countdown = widget_lookup(win, "countdown", TRUE);
|
||||
tk_snprintf(tmpStr, sizeof(tmpStr), "%d", time_countdown);
|
||||
widget_set_text_utf8(countdown, tmpStr);
|
||||
}else{
|
||||
wifi_flag=0;
|
||||
return_theme();//如果目标是非主demo界面or投屏界面 则返回主demo界面
|
||||
}
|
||||
refresh_TIME1S_flag = 0;
|
||||
}else{
|
||||
refresh_TIME1S_flag++;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return RET_REPEAT;
|
||||
}
|
||||
|
||||
static ret_t on_prompt_key_down(void* ctx, event_t* e) {
|
||||
key_event_t* evt = key_event_cast(e);
|
||||
// TODO: 在此添加控件事件处理程序代码
|
||||
Set_sys_return_demo(0);
|
||||
|
||||
// //wifi测试
|
||||
// Get_sys_wifi()?Set_sys_wifi(0):Set_sys_wifi(2);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
|
||||
static ret_t on_prompt_page_destroy(void *ctx, event_t *e) {
|
||||
time_countdown = TIME_COUNTDOWN;
|
||||
prompt_flag = 0;
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化窗口的子控件
|
||||
*/
|
||||
static ret_t visit_init_child(void* ctx, const void* iter) {
|
||||
//widget_t* win = WIDGET(ctx);
|
||||
widget_t* win = WIDGET(ctx);
|
||||
widget_t* widget = WIDGET(iter);
|
||||
const char* name = widget->name;
|
||||
|
||||
// 初始化指定名称的控件(设置属性或注册事件),请保证控件名称在窗口上唯一
|
||||
if (name != NULL && *name != '\0') {
|
||||
|
||||
if (tk_str_eq(name, "prompt")) {
|
||||
widget_on(widget, EVT_KEY_DOWN, on_prompt_key_down, win);
|
||||
widget_on(widget, EVT_DESTROY, on_prompt_page_destroy, win);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
@ -56,10 +256,11 @@ ret_t prompt_init(widget_t* win, void* ctx) {
|
||||
|
||||
widget_foreach(win, visit_init_child, win);
|
||||
|
||||
// widget_t* prompt_image = widget_lookup(win, "prompt_image", TRUE);
|
||||
// widget_use_style(prompt_image,"bg_blk");
|
||||
Set_sys_return_demo(0);
|
||||
prompt_win_init(win);
|
||||
|
||||
widget_add_timer(win, prompt_refresh, 100);//进度条提示
|
||||
prompt_flag = 1;
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user