factory mode add item: antenna coupling
author@CHENG <2393524978@qq.com>
Wed, 20 Nov 2024 06:43:22 +0000 (14:43 +0800)
committer@CHENG <2393524978@qq.com>
Wed, 20 Nov 2024 06:43:22 +0000 (14:43 +0800)
2.sdk/sdk/gui/lv_watch/framework/language/lang_ch.c
2.sdk/sdk/gui/lv_watch/framework/language/lang_en.c
2.sdk/sdk/gui/lv_watch/include/ui_textid.h
2.sdk/sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode.h
2.sdk/sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_main.c
2.sdk/sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_test.c
2.sdk/sdk/product/craneg_modem/lv_gui_main.c

index 3da3f2f..1d0c4e3 100644 (file)
@@ -994,6 +994,7 @@ const void * lang_text_ch[] = {
     "数据更新于", // WATCH_TEXT_ID_SLEEP_INFO_UPDATE_TIME,
     "暂无数据", // WATCH_TEXT_ID_NO_DATA_NOW,
     "更多详细信息请前往手机APP查看", // WATCH_TEXT_ID_DETAIL_INFO_IN_APP,
+    "天线耦合", // WATCH_TEXT_ID_ANTENNA_COUPLING,
 
     //CHENG_MODIFY
     "确认是否跌倒?", // WATCH_TEXT_ID_falldown,
index 3b7e0ac..a692fb5 100644 (file)
@@ -995,6 +995,7 @@ const void * lang_text_en[] = {
     "Update on", // WATCH_TEXT_ID_SLEEP_INFO_UPDATE_TIME,
     "No data", // WATCH_TEXT_ID_NO_DATA_NOW,
     "For more details, please view in the APP", // WATCH_TEXT_ID_DETAIL_INFO_IN_APP,
+    "Antenna coupling", // WATCH_TEXT_ID_ANTENNA_COUPLING,
 
     //CHENG_MODIFY
     "Confirm a fall",
index e35b0ca..c1f559f 100644 (file)
@@ -1002,6 +1002,7 @@ enum
     WATCH_TEXT_ID_SLEEP_INFO_UPDATE_TIME,               /* "数据更新于"                 "Update on" */
     WATCH_TEXT_ID_NO_DATA_NOW,                          /* "暂无数据"                 "No data" */
     WATCH_TEXT_ID_DETAIL_INFO_IN_APP,                   /* "更多详细信息请前往手机APP查看"      "For more details, please view in the APP" */
+    WATCH_TEXT_ID_ANTENNA_COUPLING,                     /* "天线耦合"      "Antenna coupling" */
 
     //CHENG_MODIFY
     WATCH_TEXT_ID_FALLDWON,                            /*确认是否跌倒*/
index 7dd1969..c1234c3 100644 (file)
@@ -225,6 +225,7 @@ void factorymode_sport_hr_test_create_btn_cb(lv_obj_t * btn,lv_event_t e);
 void factorymode_temperature_test_create_btn_cb(lv_obj_t * btn,lv_event_t e);
 #endif
 void factory_mode_calibration_create_btn_cb(lv_obj_t * btn,lv_event_t e);
+void factorymode_antenna_coupling_create_btn_cb(lv_obj_t * btn,lv_event_t e);
 void factorymode_agetest_create_btn_cb(lv_obj_t * btn,lv_event_t e);
 void factorymode_init_test_res(void);
 void factorymode_save_test_res(void);
index 1dd0fcb..ddca9bf 100644 (file)
@@ -115,6 +115,7 @@ const struct {
     { WATCH_TEXT_ID_BLUETOOTH, factory_mode_bt_test_main_create_btn_cb},
 #endif
     {WATCH_TEXT_ID_CALOBRATION, factory_mode_calibration_create_btn_cb},
+    {WATCH_TEXT_ID_ANTENNA_COUPLING, factorymode_antenna_coupling_create_btn_cb},
     { WATCH_TEXT_ID_AGING_MODE, factorymode_agetest_create_btn_cb},
 //#endif
 };
index 590fab4..9118383 100644 (file)
@@ -47,6 +47,7 @@ enum {
 #ifndef __MMI_NOT_SUPPORT_VIBRATION__
        FAC_VIBRATION,
 #endif
+       FAC_ANTENNA_COUPLING,
     MAX = 0xFF
 };
 typedef uint8_t testing_status_t;
@@ -124,6 +125,7 @@ static void factorymode_agetest_prepare_destory(lv_obj_t * activity_obj);
 static lv_obj_t * factorymode_agetest_create(lv_obj_t * activity_obj);
 static void factorymode_agetest_lcd_test_create(void *param);
 static void factory_agetest_lcdcolor_timer_func(void * param);
+static void factorymode_antenna_coupling_test_stop(void);
 
 /**********************
  *  STATIC VARIABLES
@@ -140,6 +142,9 @@ extern void sos_key_param_set(uint8_t param);
 #endif
 
 extern AUDIOHAL_ERR_T AudioHAL_AifLoopBack(unsigned char loop);
+extern void mmi_at_antenna_coupling_test_stop(void);
+extern void mmi_at_antenna_coupling_test_start(void);
+
 
 /**********************
  *   STATIC FUNCTIONS
@@ -204,6 +209,11 @@ static void factorymode_test_prepare_destory(lv_obj_t * activity_obj)
                        Hal_Vibrator_Play_End();
                        break;
        #endif
+
+               case FAC_ANTENNA_COUPLING:
+                       factorymode_antenna_coupling_test_stop();
+                       break;
+                       
         default:
             break;
     }
@@ -2966,15 +2976,16 @@ static void vibration_start_btn_cb(lv_obj_t * btn, lv_event_t e)
                lv_label_set_long_mode(prompt_label, LV_LABEL_LONG_BREAK);
                lv_obj_set_width(prompt_label, LV_HOR_RES);
                lv_label_set_align(prompt_label, LV_LABEL_ALIGN_CENTER);
-               lv_obj_add_style(prompt_label, LV_LABEL_PART_MAIN, &lv_watch_font20);
+               lv_obj_add_style(prompt_label, LV_LABEL_PART_MAIN, &FACTORY_MODE_TEST_ITEM_TEXT_FONT);
                lv_obj_align(prompt_label, NULL, LV_ALIGN_IN_TOP_MID, 0, 50);
                
 
         lv_obj_t * back_btn = lv_btn_create(par, NULL);
-        lv_obj_set_size(back_btn, LV_HOR_RES * 2 / 3, 40);
+        //lv_obj_set_size(back_btn, LV_HOR_RES * 2 / 3, 40);
+               lv_obj_set_size(back_btn, LV_HOR_RES / 2, LV_HOR_RES / 6);
         lv_obj_t * back_label = lv_label_create(back_btn, NULL);
         lv_label_set_text_id(back_label, WATCH_TEXT_ID_STOP_TEST);
-        lv_obj_add_style(back_label,LV_OBJ_PART_MAIN, &lv_watch_font20);
+        lv_obj_add_style(back_label,LV_OBJ_PART_MAIN, &FACTORY_MODE_TEST_ITEM_TEXT_FONT);
                lv_obj_align(back_btn, NULL, LV_ALIGN_CENTER, 0, -10);
         lv_obj_set_event_cb(back_btn, vibration_close_btn_cb);         
 
@@ -3011,7 +3022,7 @@ static lv_obj_t * factorymode_vibration_create(lv_obj_t * activity_obj)
     lv_obj_set_click(content, false);
 
     lv_obj_t * title_label = lv_label_create(content, NULL);
-    lv_obj_add_style(title_label,LV_OBJ_PART_MAIN, &lv_watch_font20_gray);
+    lv_obj_add_style(title_label,LV_OBJ_PART_MAIN, &FACTORY_MODE_TEST_ITEM_TITLE_FONT);
     lv_label_set_align(title_label, LV_LABEL_ALIGN_CENTER);
     lv_obj_set_click(title_label, false);
     lv_label_set_text_id(title_label, WATCH_TEXT_ID_VIBRATION);
@@ -3019,10 +3030,11 @@ static lv_obj_t * factorymode_vibration_create(lv_obj_t * activity_obj)
 
 
     lv_obj_t * start_btn = lv_btn_create(content, NULL);
-    lv_obj_set_size(start_btn, LV_HOR_RES * 2 / 3, 40);
+    //lv_obj_set_size(start_btn, LV_HOR_RES * 2 / 3, 40);
+    lv_obj_set_size(start_btn, LV_HOR_RES / 2, LV_HOR_RES / 6);
     lv_obj_t * label = lv_label_create(start_btn, NULL);
     lv_label_set_text_id(label, WATCH_TEXT_ID_START_TEST);
-    lv_obj_add_style(label,LV_OBJ_PART_MAIN, &lv_watch_font20);
+    lv_obj_add_style(label,LV_OBJ_PART_MAIN, &FACTORY_MODE_TEST_ITEM_TEXT_FONT);
     lv_obj_align(start_btn, NULL, LV_ALIGN_CENTER, 0, -10);
     lv_obj_add_protect(start_btn, LV_PROTECT_PRESS_LOST);
     lv_obj_set_event_cb(start_btn, vibration_start_btn_cb);
@@ -3039,5 +3051,116 @@ void factorymode_vibration_create_btn_cb(lv_obj_t * btn,lv_event_t e)
 }
 #endif
 
+// antenna coupling
+static unsigned char s_antenna_coupling_test_flag = 0;
+static void factorymode_antenna_coupling_test_stop(void)
+{
+       if(1 == s_antenna_coupling_test_flag)
+       {
+               mmi_at_antenna_coupling_test_stop();
+               s_antenna_coupling_test_flag = 0;
+       }
+}
+
+static void factorymode_antenna_coupling_test_start(void)
+{
+       s_antenna_coupling_test_flag = 1;
+       mmi_at_antenna_coupling_test_start();
+}
+
+static void factorymode_antenna_coupling_close_btn_cb(lv_obj_t * btn,lv_event_t e)
+{
+    if(LV_EVENT_CLICKED != e)
+               return;
+       
+       factorymode_antenna_coupling_test_stop();
+       //lv_obj_del(btn);
+       lv_watch_del_top_interface();
+}
+
+static void factorymode_antenna_coupling_start_btn_cb(lv_obj_t * btn, lv_event_t e)
+{
+    if(e != LV_EVENT_CLICKED)
+               return;
+       
+    lv_obj_t * par = lv_obj_get_parent(btn);
+    if(par != NULL) 
+       {
+        lv_obj_del(btn);
+               
+        lv_obj_t * back_btn = lv_btn_create(par, NULL);
+        //lv_obj_set_size(back_btn, LV_HOR_RES * 2 / 3, 40);
+               lv_obj_set_size(back_btn, LV_HOR_RES / 2, LV_HOR_RES / 6);
+        lv_obj_t * back_label = lv_label_create(back_btn, NULL);
+        lv_label_set_text_id(back_label, WATCH_TEXT_ID_STOP_TEST);
+        lv_obj_add_style(back_label,LV_OBJ_PART_MAIN, &FACTORY_MODE_TEST_ITEM_TEXT_FONT);
+               lv_obj_align(back_btn, NULL, LV_ALIGN_CENTER, 0, -10);
+        lv_obj_set_event_cb(back_btn, factorymode_antenna_coupling_close_btn_cb);              
+
+           factorymode_antenna_coupling_test_start();
+    }
+}
+
+static lv_obj_t * factorymode_antenna_coupling_create(lv_obj_t * activity_obj)
+{
+    if(activity_obj == NULL) 
+       {
+        lv_watch_activity_ext_t activity_ext;
+        memset(&activity_ext, 0, sizeof(lv_watch_activity_ext_t));
+        activity_ext.actId = ACT_ID_FACTORY_MODE_TEST;
+        activity_ext.create = factorymode_antenna_coupling_create;
+        activity_ext.prepare_destory = factorymode_test_prepare_destory;
+        activity_obj = lv_watch_creat_activity_obj(&activity_ext);
+        LV_ASSERT_MEM(activity_obj);
+        if(NULL == activity_obj) {
+            return NULL;
+        }
+    }
+
+    lv_obj_t * obj = lv_watch_obj_create(activity_obj);
+    LV_ASSERT_MEM(obj);
+    if(NULL == obj) {
+        return NULL;
+    }
+
+    testing_st = FAC_ANTENNA_COUPLING;
+    lv_obj_t * content = lv_cont_create(obj, NULL);
+    lv_obj_set_size(content, lv_obj_get_width(obj), lv_obj_get_height(obj));
+    lv_obj_add_style(content,LV_OBJ_PART_MAIN, &lv_watch_style_transp);
+    lv_obj_align(content, NULL, LV_ALIGN_CENTER, 0, 0);
+    lv_obj_set_click(content, false);
+
+    lv_obj_t * title_label = lv_label_create(content, NULL);
+    lv_obj_add_style(title_label,LV_OBJ_PART_MAIN, &FACTORY_MODE_TEST_ITEM_TITLE_FONT);
+    lv_label_set_align(title_label, LV_LABEL_ALIGN_CENTER);
+    lv_obj_set_click(title_label, false);
+    lv_label_set_text_id(title_label, WATCH_TEXT_ID_ANTENNA_COUPLING);
+    lv_obj_align(title_label, content, LV_ALIGN_IN_TOP_MID, 0, 10);
+
+
+    lv_obj_t * start_btn = lv_btn_create(content, NULL);
+    //lv_obj_set_size(start_btn, LV_HOR_RES * 2 / 3, 40);
+    lv_obj_set_size(start_btn, LV_HOR_RES / 2, LV_HOR_RES / 6);
+    lv_obj_t * label = lv_label_create(start_btn, NULL);
+    lv_label_set_text_id(label, WATCH_TEXT_ID_START_TEST);
+    lv_obj_add_style(label,LV_OBJ_PART_MAIN, &FACTORY_MODE_TEST_ITEM_TEXT_FONT);
+    lv_obj_align(start_btn, NULL, LV_ALIGN_CENTER, 0, -10);
+    lv_obj_add_protect(start_btn, LV_PROTECT_PRESS_LOST);
+    lv_obj_set_event_cb(start_btn, factorymode_antenna_coupling_start_btn_cb);
+    lv_watch_obj_add_element(start_btn);
+
+    return obj;
+}
+
+void factorymode_antenna_coupling_create_btn_cb(lv_obj_t * btn,lv_event_t e)
+{
+       if(LV_EVENT_CLICKED == e)
+       {
+               s_antenna_coupling_test_flag = 0;
+               factorymode_antenna_coupling_create(NULL);
+       }
+}
+
+
 
 #endif /*USE_LV_WATCH_FACTORY_MODE*/
index dc4b319..c1f79ba 100644 (file)
@@ -1851,5 +1851,27 @@ error:
 }
 #include "factory_mode.c"
 
+
+void mmi_at_antenna_coupling_test_start(void)
+{
+       char const * command_str0 = "AT+CFUN=0\r\n";
+       //if (IsAtCmdSrvReady())
+       ATRecv(TEL_AT_CMD_ATP_6, (void*)command_str0, strlen(command_str0));
+
+       char const * command_str1 = "AT+LTEPOWER=0,8,0\r\n";
+       ATRecv(TEL_AT_CMD_ATP_6, (void*)command_str1, strlen(command_str1));
+}
+
+void mmi_at_antenna_coupling_test_stop(void)
+{
+       char const * command_str0 = "AT+LTEPOWER=0,1,9\r\n";
+       //if (IsAtCmdSrvReady())
+       ATRecv(TEL_AT_CMD_ATP_6, (void*)command_str0, strlen(command_str0));
+
+       char const * command_str1 = "AT+CFUN=1\r\n";
+       ATRecv(TEL_AT_CMD_ATP_6, (void*)command_str1, strlen(command_str1));
+}
+
+
 #endif