From: CCC <2393524978@qq.com> Date: Fri, 28 Apr 2023 09:02:53 +0000 (+0800) Subject: xiugai X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=1acfe2bff88c7b21e2fab19f243cd3e83ef75f73;p=mirrors%2FASR3603_Z5.git xiugai --- diff --git a/2.sdk/gui/lv_watch/CMakeLists.txt b/2.sdk/gui/lv_watch/CMakeLists.txt index ebc31b3d..93de9eac 100644 --- a/2.sdk/gui/lv_watch/CMakeLists.txt +++ b/2.sdk/gui/lv_watch/CMakeLists.txt @@ -77,7 +77,7 @@ set(lv_watch_sources lv_objx/lv_watch_slider/lv_watch_slider.c lv_objx/lv_watch_list/lv_watch_list.c lv_objx/lv_watch_obj/lv_watch_obj.c - lv_theme_watch_night.c + #lv_theme_watch_night.c lv_watch_common.c lv_watch.c lv_apps/language/language.c diff --git a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor.c b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor.c index 3f196173..44b06266 100644 --- a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor.c +++ b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor.c @@ -47,9 +47,21 @@ void mmi_weather_info_set(app_adaptor_weather_t * weather) } -static mmi_health_info_t s_health_info = {0}; -void mmi_health_info_get(mmi_health_info_t * health_info) +static uint8_t s_health_info_init = 0; +static nv_watch_health_info_t s_health_info = {0}; +void mmi_health_info_get(nv_watch_health_info_t * health_info) { + if(0 == s_health_info_init) + { + uint32_t nv_data_length = sizeof(nv_watch_health_info_t); + + if(nv_data_length != UI_NV_Read_Req(NV_SECTION_UI_HEALTH_INFO, 0, nv_data_length, (uint8_t *)&s_health_info)) + { + printf("[@CHENG_DEBUG][%s][%d]: nv read fail\n", __FUNCTION__, __LINE__); + } + s_health_info_init = 1; + } + health_info->heart_value = s_health_info.heart_value; health_info->blood_high_value = s_health_info.blood_high_value; health_info->blood_low_value = s_health_info.blood_low_value; @@ -57,13 +69,20 @@ void mmi_health_info_get(mmi_health_info_t * health_info) health_info->body_value = s_health_info.body_value; } -void mmi_health_info_set(mmi_health_info_t * health_info) +void mmi_health_info_set(nv_watch_health_info_t * health_info) { s_health_info.heart_value = health_info->heart_value; s_health_info.blood_high_value = health_info->blood_high_value; s_health_info.blood_low_value = health_info->blood_low_value; s_health_info.spo2_value = health_info->spo2_value; s_health_info.body_value = health_info->body_value; + + uint32_t nv_data_length = sizeof(nv_watch_health_info_t); + + if(nv_data_length != UI_NV_Write_Req(NV_SECTION_UI_HEALTH_INFO, 0, nv_data_length, (uint8_t *)&s_health_info)) + { + printf("[@CHENG_DEBUG][%s][%d]: nv write fail\n", __FUNCTION__, __LINE__); + } } #endif diff --git a/2.sdk/gui/lv_watch/framework/nvm/ui_nvm.h b/2.sdk/gui/lv_watch/framework/nvm/ui_nvm.h index e2455b2a..8b0b385b 100644 --- a/2.sdk/gui/lv_watch/framework/nvm/ui_nvm.h +++ b/2.sdk/gui/lv_watch/framework/nvm/ui_nvm.h @@ -35,11 +35,10 @@ extern "C" { #define NV_SECTION_UI_SMSMSG_LEN (sizeof(nv_watch_sms_msg_t)) #define NV_SECTION_UI_GPS_AIDPOS_LEN (sizeof(nv_watch_gps_aidpos_t)) //#if __MMI_ZHSX_SUPPORT__ -//#if USE_LV_WATCH_WECHAT != 0 #define NV_SECTION_UI_WEHAT_MSG_LEN (sizeof(nv_watch_wechat_msg_info_t)) -//#endif #define NV_SECTION_UI_HEALTH_MEASURE_LEN (sizeof(nv_watch_health_measure_timed_t)) #define NV_SECTION_UI_PROTOCOL_DATA_LEN (sizeof(nv_watch_protocol_data_t)) +#define NV_SECTION_UI_HEALTH_INFO_LEN (sizeof(nv_watch_health_info_t)) //#endif #define NV_SECTION_LEN(sectionid) (sectionid ## _LEN) @@ -119,12 +118,10 @@ typedef lv_fs_dir_t ui_dir_t; #define NV_SECTION_UI_SMSMSG_FILE "ui_smsmsg.nv" #define NV_SECTION_UI_GPS_AIDPOS_FILE "ui_gps_aidpos.nv" //#if __MMI_ZHSX_SUPPORT__ -//#if USE_LV_WATCH_WECHAT != 0 #define NV_SECTION_UI_WEHAT_MSG_FILE "ui_wechat_msg.nv" -//#endif #define NV_SECTION_UI_HEALTH_MEASURE_FILE "ui_health_measure.nv" #define NV_SECTION_UI_PROTOCOL_DATA_FILE "ui_protocol_data.nv" - +#define NV_SECTION_UI_HEALTH_INFO_FILE "ui_health_info.nv" //#endif #define NV_SECTION_FILE_PATH(sectionid) (sectionid ## _FILE) diff --git a/2.sdk/gui/lv_watch/framework/nvm/ui_nvm_api.c b/2.sdk/gui/lv_watch/framework/nvm/ui_nvm_api.c index d9888453..33c0c3fe 100644 --- a/2.sdk/gui/lv_watch/framework/nvm/ui_nvm_api.c +++ b/2.sdk/gui/lv_watch/framework/nvm/ui_nvm_api.c @@ -73,12 +73,14 @@ uint32_t UI_NV_Get_Section_Len(NV_UI_SECTION_ID SectionId) //#ifdef __MMI_ZHSX_SUPPORT__ case NV_SECTION_UI_WEHAT_MSG: - return(NV_SECTION_LEN(NV_SECTION_UI_WEHAT_MSG)); + return (NV_SECTION_LEN(NV_SECTION_UI_WEHAT_MSG)); case NV_SECTION_UI_HEALTH_MEASURE: - return(NV_SECTION_LEN(NV_SECTION_UI_HEALTH_MEASURE)); + return (NV_SECTION_LEN(NV_SECTION_UI_HEALTH_MEASURE)); case NV_SECTION_UI_PROTOCOL_DATA: - return(NV_SECTION_LEN(NV_SECTION_UI_PROTOCOL_DATA)); + return (NV_SECTION_LEN(NV_SECTION_UI_PROTOCOL_DATA)); + case NV_SECTION_UI_HEALTH_INFO: + return (NV_SECTION_LEN(NV_SECTION_UI_HEALTH_INFO)); //#endif default: @@ -151,12 +153,14 @@ char * UI_NV_Get_Section_path(NV_UI_SECTION_ID SectionId) //#ifdef __MMI_ZHSX_SUPPORT__ case NV_SECTION_UI_WEHAT_MSG: - return(NV_SECTION_FILE_PATH(NV_SECTION_UI_WEHAT_MSG)); + return (NV_SECTION_FILE_PATH(NV_SECTION_UI_WEHAT_MSG)); case NV_SECTION_UI_HEALTH_MEASURE: - return(NV_SECTION_FILE_PATH(NV_SECTION_UI_HEALTH_MEASURE)); + return (NV_SECTION_FILE_PATH(NV_SECTION_UI_HEALTH_MEASURE)); case NV_SECTION_UI_PROTOCOL_DATA: - return(NV_SECTION_FILE_PATH(NV_SECTION_UI_PROTOCOL_DATA)); + return (NV_SECTION_FILE_PATH(NV_SECTION_UI_PROTOCOL_DATA)); + case NV_SECTION_UI_HEALTH_INFO: + return (NV_SECTION_FILE_PATH(NV_SECTION_UI_HEALTH_INFO)); //#endif default: @@ -198,6 +202,7 @@ uint8_t UI_NV_Reset_Default(NV_UI_SECTION_ID SectionId) nv_watch_wechat_msg_info_t * wechat_msg; nv_watch_health_measure_timed_t * health_measure; nv_watch_protocol_data_t * protocol_data; + nv_watch_health_info_t * health_info; //#endif switch(SectionId) { @@ -369,6 +374,12 @@ uint8_t UI_NV_Reset_Default(NV_UI_SECTION_ID SectionId) mmi_watch_protocol_data_nv_default(protocol_data); TempData = (char *)protocol_data; break; + + case NV_SECTION_UI_HEALTH_INFO: + health_info = lv_mem_alloc(SectionLen); + memset(health_info, 0, SectionLen); + TempData = (char *)health_info; + break; //#endif default: TempData = NULL; diff --git a/2.sdk/gui/lv_watch/include/app_adaptor_interface.h b/2.sdk/gui/lv_watch/include/app_adaptor_interface.h index 38a86c49..e5e7d14d 100644 --- a/2.sdk/gui/lv_watch/include/app_adaptor_interface.h +++ b/2.sdk/gui/lv_watch/include/app_adaptor_interface.h @@ -382,23 +382,15 @@ typedef struct #ifdef __MMI_ZHSX_SUPPORT__ +#include "ui_nvm_interface.h" + #define MMI_WEATHER_CITY_NAME_LEN_MAX (64) void mmi_weather_info_set(app_adaptor_weather_t * weather); -typedef struct -{ - uint16_t heart_value; - uint16_t blood_high_value; - uint16_t blood_low_value; - uint16_t spo2_value; - //float wrist_value; - float body_value; -}mmi_health_info_t; - -void mmi_health_info_get(mmi_health_info_t * health_info); -void mmi_health_info_set(mmi_health_info_t * health_info); +void mmi_health_info_get(nv_watch_health_info_t * health_info); +void mmi_health_info_set(nv_watch_health_info_t * health_info); #endif /** diff --git a/2.sdk/gui/lv_watch/include/ui_activity_id.h b/2.sdk/gui/lv_watch/include/ui_activity_id.h index f164df32..b03e81e3 100644 --- a/2.sdk/gui/lv_watch/include/ui_activity_id.h +++ b/2.sdk/gui/lv_watch/include/ui_activity_id.h @@ -170,6 +170,7 @@ enum ACT_ID_SETTING_UPAY_MENU, /*246: alipay menu*/ #endif + ACT_ID_WATCH_COMMON, #ifdef __MMI_WECHAT_SUPPORT__ ACT_ID_WECHAT_MAIN, ACT_ID_WECHAT_RECORDING, diff --git a/2.sdk/gui/lv_watch/include/ui_nvm_interface.h b/2.sdk/gui/lv_watch/include/ui_nvm_interface.h index 19bf8d20..31982d8f 100644 --- a/2.sdk/gui/lv_watch/include/ui_nvm_interface.h +++ b/2.sdk/gui/lv_watch/include/ui_nvm_interface.h @@ -197,6 +197,16 @@ typedef struct uint32_t weather_update_interval; // unit-second } __packed nv_watch_protocol_data_t; +typedef struct +{ + uint16_t heart_value; + uint16_t blood_high_value; + uint16_t blood_low_value; + uint16_t spo2_value; + //float wrist_value; + float body_value; +} __packed nv_watch_health_info_t; + //#endif @@ -376,11 +386,10 @@ enum NV_SECTION_UI_SMSMSG, // nv_watch_sms_msg_t NV_SECTION_UI_GPS_AIDPOS, // nv_watch_gps_aidpos_t //#if __MMI_ZHSX_SUPPORT__ -//#if USE_LV_WATCH_WECHAT != 0 NV_SECTION_UI_WEHAT_MSG, // nv_watch_wechat_msg_info_t -//#endif NV_SECTION_UI_HEALTH_MEASURE, // nv_watch_health_measure_timed_t NV_SECTION_UI_PROTOCOL_DATA, // nv_watch_protocol_data_t + NV_SECTION_UI_HEALTH_INFO, // nv_watch_health_info_t //#endif NV_SECTION_UI_MAX_NUM diff --git a/2.sdk/gui/lv_watch/lv_apps/call_log/call_log.c b/2.sdk/gui/lv_watch/lv_apps/call_log/call_log.c index ca923847..a29d3e35 100644 --- a/2.sdk/gui/lv_watch/lv_apps/call_log/call_log.c +++ b/2.sdk/gui/lv_watch/lv_apps/call_log/call_log.c @@ -110,7 +110,7 @@ static void call_log_update_call_log_ll(uint8_t call_log_num, nv_watch_call_log_ static lv_obj_t * call_log_no_log_info_create(lv_obj_t * obj) { lv_obj_t * label = lv_label_create(obj, NULL); - lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font30); //&lv_watch_font20); + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); //&lv_watch_font20); lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_obj_set_click(label, false); lv_label_set_text_id(label, WATCH_TEXT_ID_NO_CALL_LOG_INFO); diff --git a/2.sdk/gui/lv_watch/lv_apps/dial/dial_element.c b/2.sdk/gui/lv_watch/lv_apps/dial/dial_element.c index 9f73af66..bbd3e4a6 100644 --- a/2.sdk/gui/lv_watch/lv_apps/dial/dial_element.c +++ b/2.sdk/gui/lv_watch/lv_apps/dial/dial_element.c @@ -509,7 +509,7 @@ static void dial_update_canvas_label(watch_element_base_t * base) app_adaptor_weather_t weather; app_adaptor_pedometer_record_t record; //app_adaptor_health_info_t health; - mmi_health_info_t health_info = {0}; + nv_watch_health_info_t health_info = {0}; lv_point_t pos; if(ELEMENT_TYPE_WEEK == base->element_type || ELEMENT_TYPE_DATE == base->element_type diff --git a/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode.h b/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode.h index a136525f..0b6e8922 100644 --- a/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode.h +++ b/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode.h @@ -225,7 +225,7 @@ void camera_preview_test_stop(void); #ifdef __MMI_ZHSX_SUPPORT__ -void mmi_watch_reset(void); +void mmi_watch_reset(lv_obj_t * activity_obj); #endif /********************** diff --git a/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_reset.c b/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_reset.c index 401ac2a3..b9053b5d 100644 --- a/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_reset.c +++ b/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_reset.c @@ -190,22 +190,64 @@ static void factoryreset_no_btn_event_cb(lv_obj_t * btn, lv_event_t e) #ifdef __MMI_ZHSX_SUPPORT__ -void mmi_watch_reset(void) +void mmi_watch_reset_prepare_destory(lv_obj_t * activity_obj) { - //lv_watch_go_home(); - lv_obj_t * par = lv_scr_act(); + +} + +void mmi_watch_reset(lv_obj_t * activity_obj) +{ + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); - lv_obj_clean(par); - lv_obj_t * label = lv_label_create(par, NULL); - lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20); - lv_label_set_text_id(label, WATCH_TEXT_ID_FACTORY_RESETING); - lv_label_set_long_mode(label, LV_LABEL_LONG_BREAK); - lv_obj_set_width(label, LV_HOR_RES * 2 / 3); - lv_obj_align(label, par, LV_ALIGN_CENTER, 0, 0); + app_adaptor_wake_up_short_time(); + + if(NULL == activity_obj) + { + lv_watch_activity_ext_t activity_ext = {0}; + + activity_ext.actId = ACT_ID_WATCH_COMMON; + activity_ext.create = mmi_watch_reset; + activity_ext.prepare_destory = mmi_watch_reset_prepare_destory; + + activity_obj = lv_watch_creat_activity_obj(&activity_ext); + if(NULL == activity_obj) + return ; + } + + lv_obj_t * watch_obj = lv_watch_obj_create(activity_obj); + if(NULL == watch_obj) + return ; + + lv_obj_t * cont = lv_cont_create(watch_obj, NULL); + lv_obj_set_size(cont, LV_HOR_RES, LV_VER_RES); + lv_obj_align(cont, watch_obj, LV_ALIGN_IN_BOTTOM_MID, 0, 0); + lv_obj_set_style_local_bg_color(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_bg_opa(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_obj_set_style_local_pad_left(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0); + lv_obj_set_style_local_pad_right(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0); + lv_obj_set_click(cont, false); + lv_watch_obj_add_element(cont); + + lv_obj_t * label_info = lv_label_create(cont, NULL); + //lv_obj_set_size(label_info, LV_HOR_RES, 30); + //lv_obj_set_width(label_info, LV_HOR_RES * 2 / 3); + lv_obj_add_style(label_info, LV_LABEL_PART_MAIN, &lv_watch_font26); + lv_label_set_text_id(label_info, WATCH_TEXT_ID_FACTORY_RESETING); + //lv_label_set_long_mode(label_info, LV_LABEL_LONG_BREAK); + //lv_label_set_align(label_info, LV_LABEL_ALIGN_CENTER); + lv_obj_align(label_info, cont, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_click(label_info, false); // delay reset for 50ms to ensure text displaying lv_task_t *task_p = lv_task_create(factory_reset_handle, 50, LV_TASK_PRIO_HIGHEST, NULL); lv_task_once(task_p); + + + +// //lv_watch_go_home(); +// //lv_obj_t * par = lv_scr_act(); +// lv_obj_t * act_obj = lv_watch_get_top_activity_obj(); //lv_watch_get_bg_activity_obj(); //lv_watch_get_top_activity_obj(); +// factoryreset_yes_btn_event_cb(act_obj, LV_EVENT_CLICKED); } #endif diff --git a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.c b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.c index cbc8368b..c943f72e 100644 --- a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.c +++ b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.c @@ -1,16 +1,10 @@ -/********************* - * INCLUDES - *********************/ #include "lv_watch.h" #ifdef __MMI_HEALTH_MEASURE_HEART_SUPPORT__ -#include - - lv_heart_rate_obj_ext_t * heart_rate_get_ext(void) { lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_HEALTH_MEASURE_HEART); @@ -286,5 +280,5 @@ void health_heart_rate_create_event_cb(lv_obj_t * btn, lv_event_t e) } } - #endif + diff --git a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.h b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.h index c7d24b89..37073662 100644 --- a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.h +++ b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_heart_rate.h @@ -8,10 +8,6 @@ extern "C" { #endif -/********************* - * INCLUDES - *********************/ - #ifdef LV_CONF_INCLUDE_SIMPLE #include "lvgl.h" #include "lv_ex_conf.h" diff --git a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c index 698c89da..b7e96ebf 100644 --- a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c +++ b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c @@ -1,10 +1,9 @@ -#ifdef __MMI_ZHSX_SUPPORT__ +#include "lv_watch.h" -//#include -#include "health_measure.h" +#ifdef __MMI_ZHSX_SUPPORT__ static nv_watch_health_measure_timed_t s_health_measure_timed_data = {0}; @@ -501,7 +500,7 @@ void mmi_health_measure_send_heart(void) mmi_protocol_action_send_heart(heart_value); - mmi_health_info_t health_info = {0}; + nv_watch_health_info_t health_info = {0}; mmi_health_info_get(&health_info); health_info.heart_value = heart_value; mmi_health_info_set(&health_info); @@ -516,7 +515,7 @@ void mmi_health_measure_send_temperature(void) mmi_protocol_action_send_temperature(body_value); - mmi_health_info_t health_info = {0}; + nv_watch_health_info_t health_info = {0}; mmi_health_info_get(&health_info); health_info.body_value = body_value; mmi_health_info_set(&health_info); @@ -532,7 +531,7 @@ void mmi_health_measure_send_blood(void) mmi_protocol_action_send_blood(blood_high_value, blood_low_value); - mmi_health_info_t health_info = {0}; + nv_watch_health_info_t health_info = {0}; mmi_health_info_get(&health_info); health_info.blood_high_value = blood_high_value; health_info.blood_low_value = blood_low_value; @@ -548,7 +547,7 @@ void mmi_health_measure_send_spo2(void) mmi_protocol_action_send_spo2(spo2_value); - mmi_health_info_t health_info = {0}; + nv_watch_health_info_t health_info = {0}; mmi_health_info_get(&health_info); health_info.spo2_value = spo2_value; mmi_health_info_set(&health_info); diff --git a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.h b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.h index 805c823b..c5a33b23 100644 --- a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.h +++ b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.h @@ -1,8 +1,6 @@ -#ifdef __MMI_ZHSX_SUPPORT__ - #ifndef __HEALTH_MEASURE_H__ #define __HEALTH_MEASURE_H__ @@ -10,10 +8,6 @@ extern "C" { #endif -/********************* - * INCLUDES - *********************/ - #ifdef LV_CONF_INCLUDE_SIMPLE #include "lvgl.h" #include "lv_ex_conf.h" @@ -22,6 +16,7 @@ extern "C" { #include "../../../lv_ex_conf.h" #endif +#ifdef __MMI_ZHSX_SUPPORT__ #define __HEALTH_MEASURE_DEBUG__ #ifdef __HEALTH_MEASURE_DEBUG__ @@ -30,6 +25,7 @@ extern "C" { #define HEALTH_MEASURE_DEBUG_PRINTF(fmt, ...) #endif + //#define __HEALTH_MEASURE_FAKE_DATA__ @@ -93,10 +89,10 @@ bool mmi_health_measure_blood_timed_action(bool direct_trigger, uint32_t cur_tim bool mmi_health_measure_spo2_timed_action(bool direct_trigger, uint32_t cur_time_stamp); -#ifdef __cplusplus -} /* extern "C" */ #endif +#ifdef __cplusplus +} /* extern "C" */ #endif #endif diff --git a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.c b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.c index 90a4d757..d656a7ea 100644 --- a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.c +++ b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.c @@ -1,16 +1,10 @@ -/********************* - * INCLUDES - *********************/ #include "lv_watch.h" #ifdef __MMI_HEALTH_MEASURE_SPO2_SUPPORT__ -#include - - lv_spo2_obj_ext_t * health_spo2_get_ext(void) { lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_HEALTH_MEASURE_SPO2); diff --git a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.h b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.h index 2ae5147e..76411acf 100644 --- a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.h +++ b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_spo2.h @@ -8,10 +8,6 @@ extern "C" { #endif -/********************* - * INCLUDES - *********************/ - #ifdef LV_CONF_INCLUDE_SIMPLE #include "lvgl.h" #include "lv_ex_conf.h" diff --git a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.c b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.c index f6e1e5cf..46a22e53 100644 --- a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.c +++ b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.c @@ -1,15 +1,10 @@ -/********************* - * INCLUDES - *********************/ #include "lv_watch.h" #ifdef __MMI_HEALTH_MEASURE_TEMPERATURE_SUPPORT__ -#include - #if 1 lv_temperature_obj_ext_t * health_temperature_get_ext(void) diff --git a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.h b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.h index dadd44ac..64f17070 100644 --- a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.h +++ b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_temperature.h @@ -8,10 +8,6 @@ extern "C" { #endif -/********************* - * INCLUDES - *********************/ - #ifdef LV_CONF_INCLUDE_SIMPLE #include "lvgl.h" #include "lv_ex_conf.h" diff --git a/2.sdk/gui/lv_watch/lv_apps/phone/phone.c b/2.sdk/gui/lv_watch/lv_apps/phone/phone.c index 5dcd708a..311a19c9 100644 --- a/2.sdk/gui/lv_watch/lv_apps/phone/phone.c +++ b/2.sdk/gui/lv_watch/lv_apps/phone/phone.c @@ -86,7 +86,7 @@ static void phone_dialing(lv_obj_t * content) //name or number label = lv_label_create(content, NULL); - lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font24); + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_label_set_long_mode(label, LV_LABEL_LONG_SROLL); lv_obj_set_width(label, lv_obj_get_width(content) - 10); @@ -147,7 +147,7 @@ static void phone_ring(lv_obj_t * content) //name or number label = lv_label_create(content, NULL); - lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font24); + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_label_set_long_mode(label, LV_LABEL_LONG_SROLL); lv_obj_set_width(label, lv_obj_get_width(content) - 10); @@ -198,7 +198,7 @@ static void phone_connected(lv_obj_t * content) //name or number lv_obj_t * label = lv_label_create(content, NULL); - lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font24); + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_label_set_long_mode(label, LV_LABEL_LONG_SROLL); lv_obj_set_width(label, lv_obj_get_width(content) - 10); diff --git a/2.sdk/gui/lv_watch/lv_apps/primary_menu/primary_menu_data.c b/2.sdk/gui/lv_watch/lv_apps/primary_menu/primary_menu_data.c index 409b0037..a7d8501e 100644 --- a/2.sdk/gui/lv_watch/lv_apps/primary_menu/primary_menu_data.c +++ b/2.sdk/gui/lv_watch/lv_apps/primary_menu/primary_menu_data.c @@ -5,8 +5,6 @@ #if USE_LV_WATCH_PRIMARY_MENU != 0 -#include - #ifdef __MMI_ZHSX_SUPPORT__ diff --git a/2.sdk/gui/lv_watch/lv_apps/qrcode/qrcode.c b/2.sdk/gui/lv_watch/lv_apps/qrcode/qrcode.c index 74eeb94b..7652e8b8 100644 --- a/2.sdk/gui/lv_watch/lv_apps/qrcode/qrcode.c +++ b/2.sdk/gui/lv_watch/lv_apps/qrcode/qrcode.c @@ -115,7 +115,7 @@ static lv_obj_t * qrcode_create_content(lv_obj_t * par) lv_obj_align(qrcode, content, LV_ALIGN_CENTER, 0, 0); lv_obj_t * label = lv_label_create(par, NULL); - lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font24); + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); lv_label_set_text(label, imei); lv_obj_set_click(label, false); lv_obj_align(label, content, LV_ALIGN_OUT_BOTTOM_MID, 0, 6); diff --git a/2.sdk/gui/lv_watch/lv_apps/shutdown/shutdown.c b/2.sdk/gui/lv_watch/lv_apps/shutdown/shutdown.c index a62a4c1e..aa9404fb 100644 --- a/2.sdk/gui/lv_watch/lv_apps/shutdown/shutdown.c +++ b/2.sdk/gui/lv_watch/lv_apps/shutdown/shutdown.c @@ -69,7 +69,7 @@ lv_obj_t * shutdown_create(lv_obj_t * activity_obj, bool confirm) //label = lv_label_create(obj, NULL); //lv_obj_set_width(label, lv_obj_get_width(obj) - 40); - lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font30); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26); lv_label_set_text_id(label, WATCH_TEXT_ID_CONFIRM_SHUTDOWN); lv_obj_align(label, obj, LV_ALIGN_CENTER, 0, -40); @@ -216,6 +216,9 @@ void shutdown_confirm_btn_action(lv_obj_t * btn, lv_event_t event) #ifdef __MMI_ZHSX_SUPPORT__ void mmi_watch_power_off(void) { + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + + app_adaptor_wake_up_short_time(); shutdown_confirm_btn_action(NULL, LV_EVENT_CLICKED); } #endif diff --git a/2.sdk/gui/lv_watch/lv_apps/sms_msg/sms_msg.c b/2.sdk/gui/lv_watch/lv_apps/sms_msg/sms_msg.c index 87576d1c..28d6f17a 100644 --- a/2.sdk/gui/lv_watch/lv_apps/sms_msg/sms_msg.c +++ b/2.sdk/gui/lv_watch/lv_apps/sms_msg/sms_msg.c @@ -196,8 +196,6 @@ void sms_msg_create_event_cb(lv_obj_t * btn,lv_event_t e) return; } } - - } static void sms_msg_list_create(lv_obj_t * obj, lv_ll_t * sms_list) @@ -235,9 +233,15 @@ static void sms_msg_list_create(lv_obj_t * obj, lv_ll_t * sms_list) lv_obj_t * srcl_cont = lv_page_get_scrl(list); if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(srcl_cont); lv_obj_set_signal_cb(srcl_cont, lv_list_scrollable_signal); +#ifdef __MMI_ZHSX_SUPPORT__ + lv_obj_set_style_local_pad_inner(srcl_cont, LV_LIST_PART_BG, LV_STATE_DEFAULT, 5); //100); + lv_obj_set_style_local_pad_top(srcl_cont, LV_LIST_PART_BG, LV_STATE_DEFAULT, 5); //70); + lv_obj_set_style_local_pad_bottom(srcl_cont, LV_LIST_PART_BG, LV_STATE_DEFAULT, 5); //70); +#else lv_obj_set_style_local_pad_inner(srcl_cont, LV_LIST_PART_BG, LV_STATE_DEFAULT, 100); lv_obj_set_style_local_pad_top(srcl_cont, LV_LIST_PART_BG, LV_STATE_DEFAULT, 70); lv_obj_set_style_local_pad_bottom(srcl_cont, LV_LIST_PART_BG, LV_STATE_DEFAULT, 70); +#endif lv_watch_obj_add_element(srcl_cont); sms_msg_t * smsmsg = _lv_ll_get_head(sms_list); @@ -282,6 +286,14 @@ void sms_msg_app_new_sms_info_ind(app_adp_new_sms_info_ind_t *sms_info) printf("yzmin --> %s, time = %s\n", __FUNCTION__,sms_info->time); printf("yzmin ----> data_len = %d, data = %s\n",sms_info->data_len,sms_info->data); +#ifdef __MMI_ZHSX_SUPPORT_SMS__ + if(true == mmi_protocol_sms_content_parse(sms_info->data, sms_info->number)) + { + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return; + } +#endif + Hal_NFFS_File_Play_Onetime(AUDIO_SETTING_AUDIO_MSG, query_current_volume(), NULL, 0); Hal_Vibrator_Play_Onetime(NULL, 1000); if(0 == Hal_Pm_Get_State()) @@ -604,6 +616,54 @@ static void sms_msg_item_btn_cb(lv_obj_t * btn,lv_event_t e) return; } +#ifdef __MMI_ZHSX_SUPPORT__ +static void mbox_sms_label(lv_sms_item_ext_t * ext) +{ + if(ext == NULL) + return; + + lv_sms_msg_ext_t * msg_ext = sms_msg_get_ext(); + LV_ASSERT_MEM(msg_ext); + if(msg_ext->content != NULL) + { + lv_obj_t *mbox_count = lv_cont_create(msg_ext->content, NULL); + lv_obj_set_size(mbox_count, LV_HOR_RES, LV_VER_RES); + lv_cont_set_fit(mbox_count, LV_FIT_NONE); + lv_obj_set_click(mbox_count, true); + lv_obj_add_style(mbox_count, LV_CONT_PART_MAIN,&lv_watch_cont_opa2); + lv_obj_set_style_local_bg_opa(mbox_count, LV_CONT_PART_MAIN,LV_STATE_DEFAULT, LV_OPA_100); + lv_obj_set_style_local_radius(mbox_count, LV_CONT_PART_MAIN,LV_STATE_DEFAULT, 0); + lv_obj_align(mbox_count, NULL, LV_ALIGN_CENTER, 0, 0); + + lv_obj_t * msg_ta = lv_textarea_create(mbox_count, NULL); + LV_ASSERT_MEM(msg_ta); + lv_obj_set_size(msg_ta, LV_HOR_RES - 15 * 2, LV_VER_RES - 20 - 15 * 2 - 40); + lv_obj_add_style(msg_ta, LV_TEXTAREA_PART_BG,&lv_watch_font26); + lv_obj_set_style_local_bg_opa(msg_ta, LV_TEXTAREA_PART_BG,LV_STATE_DEFAULT, LV_OPA_0); + lv_textarea_set_text(msg_ta,ext->smsmsg.data); + lv_textarea_set_cursor_pos(msg_ta, 0); + lv_textarea_set_cursor_hidden(msg_ta,true); + lv_textarea_set_scrollbar_mode(msg_ta,LV_SCROLLBAR_MODE_OFF); + lv_textarea_set_edge_flash(msg_ta, true); + lv_obj_align(msg_ta, mbox_count, LV_ALIGN_IN_TOP_MID, 0, 20); + lv_obj_set_click(msg_ta, false); + + lv_obj_t * close_btn = lv_btn_create(mbox_count, NULL); + lv_watch_set_free_ptr(close_btn, ext); + lv_obj_set_size(close_btn, 100, 40); + lv_obj_set_style_local_bg_color(close_btn, LV_OBJ_PART_MAIN,LV_STATE_DEFAULT,LV_COLOR_MAKE(0x55, 0x55, 0x55)); + lv_obj_set_style_local_bg_opa(close_btn, LV_OBJ_PART_MAIN,LV_STATE_DEFAULT, LV_OPA_100); + lv_obj_set_style_local_radius(close_btn, LV_OBJ_PART_MAIN,LV_STATE_DEFAULT, 100); + + lv_obj_t * label = lv_label_create(close_btn, NULL); + lv_label_set_text_id(label, WATCH_TEXT_ID_BACK); + lv_obj_add_style(label, LV_LABEL_PART_MAIN,&lv_watch_font26); + lv_obj_add_protect(close_btn, LV_PROTECT_PRESS_LOST); + lv_obj_set_event_cb(close_btn, sms_cancel_vbtn_cb); + lv_obj_align(close_btn, mbox_count, LV_ALIGN_IN_BOTTOM_MID, 0, -15); + } +} +#else static void mbox_sms_label(lv_sms_item_ext_t * ext) { if(ext == NULL) @@ -649,8 +709,8 @@ static void mbox_sms_label(lv_sms_item_ext_t * ext) lv_obj_align(close_btn, mbox_count, LV_ALIGN_IN_BOTTOM_MID, 0, -12); } - } +#endif static void sms_cancel_vbtn_cb(lv_obj_t * btn,lv_event_t e) { @@ -808,11 +868,15 @@ void sms_msg_list_update(void) static void sms_no_msg_create(lv_obj_t * obj) { lv_obj_t * label = lv_label_create(obj, NULL); +#ifdef __MMI_ZHSX_SUPPORT__ + lv_obj_add_style(label, LV_LABEL_PART_MAIN,&lv_watch_font26); +#else if(1 == lv_lang_act()) { lv_obj_add_style(label, LV_LABEL_PART_MAIN,&lv_watch_font20); } else { lv_obj_add_style(label, LV_LABEL_PART_MAIN,&lv_watch_font14); } +#endif lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_obj_set_click(label, false); lv_label_set_text_id(label, WATCH_TEXT_ID_NO_VOICE_MSG); diff --git a/2.sdk/gui/lv_watch/lv_apps/weather/weather.c b/2.sdk/gui/lv_watch/lv_apps/weather/weather.c index a017e4b6..763e9a08 100644 --- a/2.sdk/gui/lv_watch/lv_apps/weather/weather.c +++ b/2.sdk/gui/lv_watch/lv_apps/weather/weather.c @@ -12,6 +12,205 @@ #include +#ifdef __MMI_ZHSX_SUPPORT__ + +const watch_weather_list weather_list[] = { + { ICON_SUNNY, WATCH_TEXT_ID_SUNNY }, /* WATCH_WEATHER_ID_SUNNY = 0, */ + { ICON_CLOUDY, WATCH_TEXT_ID_CLOUDY }, /* WATCH_WEATHER_ID_CLOUDY, */ + { ICON_LIGHT_RAIN, WATCH_TEXT_ID_LIGHT_RAIN }, /* WATCH_WEATHER_ID_LIGHT_RAIN, */ + { ICON_HEAVY_RAIN, WATCH_TEXT_ID_HEAVY_RAIN }, /* WATCH_WEATHER_ID_HEAVY_RAIN, */ + { ICON_LIGHT_SNOW, WATCH_TEXT_ID_LIGHT_SNOW }, /* WATCH_WEATHER_ID_LITTLE_SNOW, */ + { ICON_HEAVY_SNOW, WATCH_TEXT_ID_HEAVY_SNOW }, /* WATCH_WEATHER_ID_HEAVY_SNOW, */ + { ICON_FOG, WATCH_TEXT_ID_FOG }, /* WATCH_WEATHER_ID_FOG, */ + { ICON_HAZE, WATCH_TEXT_ID_HAZE }, /* WATCH_WEATHER_ID_HAZE, */ + { ICON_WEATHER_OTHERS, WATCH_TEXT_ID_OTHER_WEATHER }, /* WATCH_WEATHER_ID_OTHERS = 99, */ + { ICON_NO_NETWORK, WATCH_TEXT_ID_NO_NETWORK }, /* WATCH_WEATHER_ID_NO_INFO = 255*/ +}; + +static lv_obj_t * weather_content_no_info_create(lv_obj_t * par) +{ + lv_obj_t * content = lv_watch_cont_create(par, LV_LAYOUT_COLUMN_MID, &lv_style_transp_fit, lv_obj_get_width(par)); + + lv_obj_t * img = lv_img_create(content, NULL); + if(img == NULL) + return NULL; + + lv_img_set_src(img, weather_list[9].img_src); + + lv_obj_t * label = lv_label_create(content, NULL); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font30); + lv_label_set_text_id(label, weather_list[9].txtId); + lv_obj_set_click(label, false); + + return(content); +} + +static lv_obj_t * weather_content_create(lv_obj_t * par, app_adaptor_weather_t * weather) +{ + lv_obj_t * content = lv_watch_cont_create(par, LV_LAYOUT_COLUMN_MID, &lv_style_transp_fit, lv_obj_get_width(par)); + lv_obj_t * img = lv_img_create(content, NULL); + int8_t index; + + if(weather->weather_id >= sizeof(weather_list) / sizeof(weather_list[0]) - 1) { + index = 8; + } else { + index = weather->weather_id; + } + + if(img == NULL) + return NULL; + + lv_img_set_src(img, weather_list[index].img_src); + + lv_obj_t * label = lv_label_create(content, NULL); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20); + + lv_label_set_text_id(label, weather_list[index].txtId); + + lv_obj_set_click(label, false); + + return(content); +} + +static lv_obj_t * temperature_content_create(lv_obj_t * par, app_adaptor_weather_t * weather) +{ + char str[10] = ""; + + lv_obj_t * content = lv_watch_cont_create(par, LV_LAYOUT_COLUMN_LEFT, &lv_watch_style_transp, lv_obj_get_width(par) / 2); + lv_obj_set_base_dir(content, LV_BIDI_DIR_LTR); + + lv_obj_t * label = lv_label_create(content, NULL); + lv_obj_set_style_local_pad_inner(content, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font40_yellow); + snprintf(str, 10, "%d", weather->current_temperature); + lv_label_set_text(label, str); + lv_obj_set_click(label, false); + + label = lv_label_create(content, NULL); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font10); + lv_label_set_text(label, "o"); + lv_obj_set_click(label, false); + lv_obj_set_style_local_pad_top(label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -2); + + label = lv_label_create(content, NULL); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font40_yellow); + lv_label_set_text(label, "C"); + lv_obj_set_click(label, false); + + + lv_obj_t * content1 = lv_watch_cont_create(content, LV_LAYOUT_ROW_TOP, &lv_watch_style_transp, lv_obj_get_width(par) / 2); + lv_obj_align(content1, label, LV_ALIGN_OUT_RIGHT_MID, 0, 0); + lv_obj_set_style_local_pad_inner(content1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0); + label = lv_label_create(content1, NULL); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20); + snprintf(str, 10, "%d-%d", weather->lowest_temperature, weather->highest_temperature); + lv_label_set_text(label, str); + lv_obj_set_click(label, false); + + label = lv_label_create(content1, NULL); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font10); + lv_obj_set_style_local_pad_top(label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -2); + lv_label_set_text(label, "o"); + lv_obj_set_click(label, false); + + label = lv_label_create(content1, NULL); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20); + lv_label_set_text(label, "C"); + lv_obj_set_click(label, false); + + return(content); +} + +static lv_obj_t * detail_content_create(lv_obj_t * par, app_adaptor_weather_t * weather) +{ + lv_obj_t * content = lv_watch_cont_create(par, LV_LAYOUT_COLUMN_MID, &lv_watch_style_transp, lv_obj_get_width(par)); + lv_obj_set_base_dir(content, LV_BIDI_DIR_LTR); + lv_cont_set_layout(content, LV_LAYOUT_OFF); + + lv_obj_t * label = lv_label_create(content, NULL); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font30); + if(0 != strlen(weather->city)) + lv_label_set_text(label, weather->city); + else + lv_label_set_text(label, ""); + + lv_obj_set_click(label, false); + + return(content); +} + +void weather_update(lv_obj_t * cont) +{ + app_adaptor_weather_t weather_info = {}; + app_adaptor_get_weather_req(&weather_info); + + lv_watch_png_cache_all_free(); + + lv_weather_ext_t * weather_ext = (lv_weather_ext_t *)lv_obj_get_ext_attr(cont); + if(weather_ext->content1 != NULL) { + lv_obj_del(weather_ext->content1); + weather_ext->content1 = NULL; + } + + if(weather_ext->content2 != NULL) { + lv_obj_del(weather_ext->content2); + weather_ext->content2 = NULL; + } + + if(weather_ext->content3 != NULL) { + lv_obj_del(weather_ext->content3); + weather_ext->content3 = NULL; + } + + if(0 == strlen(weather_info.city)) + { + weather_ext->content1 = weather_content_no_info_create(cont); + lv_obj_align(weather_ext->content1, cont, LV_ALIGN_IN_TOP_MID, 0, 20); + } + else + { + weather_ext->content1 = weather_content_create(cont, &weather_info); + lv_obj_align(weather_ext->content1, cont, LV_ALIGN_IN_TOP_MID, 0, 20); + + weather_ext->content2 = temperature_content_create(cont, &weather_info); + lv_obj_align(weather_ext->content2, weather_ext->content1, LV_ALIGN_OUT_BOTTOM_LEFT, 20, 10); + + weather_ext->content3 = detail_content_create(cont, &weather_info); + lv_obj_align(weather_ext->content3, weather_ext->content2, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); + } +} + +lv_obj_t * weather_create(lv_obj_t * tileview, uint16_t id) +{ + lv_obj_t * tab; + if(id == 0xFF) { + tab = tileview; + } else { + tab = launcher_tileview_add_tile(tileview, id); + + LV_ASSERT_MEM(tab); + if(tab == NULL) { + return(NULL); + } + } + + // containt for weather + lv_obj_t * weather_cont = lv_cont_create(tab, NULL); + lv_weather_ext_t * weather_ext = lv_obj_allocate_ext_attr(weather_cont, sizeof(lv_weather_ext_t)); + lv_obj_set_click(weather_cont, false); + lv_obj_set_size(weather_cont, lv_obj_get_width(tab), lv_obj_get_height(tab)); + lv_obj_add_style(weather_cont, LV_CONT_PART_MAIN, &lv_watch_style_transp); + weather_ext->content1 = NULL; + weather_ext->content2 = NULL; + weather_ext->content3 = NULL; + + weather_update(weather_cont); + + return(tab); +} + +#else + /********************* * DEFINES *********************/ @@ -258,5 +457,6 @@ static lv_obj_t * detail_content_create(lv_obj_t * par, app_adaptor_weather_t * return(content); } /* detail_content_create */ +#endif #endif /*USE_LV_WATCH_WEATHER*/ diff --git a/2.sdk/gui/lv_watch/lv_apps/wechat/wechat.h b/2.sdk/gui/lv_watch/lv_apps/wechat/wechat.h index b9b5c56b..a150fdeb 100644 --- a/2.sdk/gui/lv_watch/lv_apps/wechat/wechat.h +++ b/2.sdk/gui/lv_watch/lv_apps/wechat/wechat.h @@ -8,7 +8,6 @@ extern "C" { #endif - #ifdef LV_CONF_INCLUDE_SIMPLE #include "lvgl.h" #include "lv_watch_conf.h" diff --git a/2.sdk/gui/lv_watch/lv_apps/wechat/wechat_ui.c b/2.sdk/gui/lv_watch/lv_apps/wechat/wechat_ui.c index 5613c63a..2f6d2d99 100644 --- a/2.sdk/gui/lv_watch/lv_apps/wechat/wechat_ui.c +++ b/2.sdk/gui/lv_watch/lv_apps/wechat/wechat_ui.c @@ -97,6 +97,8 @@ void wechat_msg_info_new_item_add(nv_watch_wechat_msg_item_info_t * msg_item) { uint32_t msg_item_info_size = sizeof(nv_watch_wechat_msg_item_info_t); + WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + if(NV_WATCH_WECHAT_NUM_MAX <= s_wechat_msg_info->msg_count) { lv_fs_remove(s_wechat_msg_info->msg_item[0].msg_data_full_file_name); @@ -360,6 +362,8 @@ bool wechat_msg_send_to_server(void) } else { + WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: errno=%d,file_size=%d\n", __FUNCTION__, __LINE__, res, file_size); + if(true == mmi_protocol_action_send_talk(file_buf, file_size)) { wechat_msg_info_new_item_add(&s_wechat_msg_item_info); @@ -497,6 +501,8 @@ void wechat_msg_sending_result_screen_timeout(void *para) { lv_wechat_msg_sending_ext_t * sending_ext = (lv_wechat_msg_sending_ext_t *)para; + WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + if(NULL != sending_ext->result_timer_id) { Hal_Timer_Stop(sending_ext->result_timer_id); @@ -513,6 +519,8 @@ void wechat_msg_sending_screen_timeout(void *para) { lv_wechat_msg_sending_ext_t * sending_ext = (lv_wechat_msg_sending_ext_t *)para; + WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + if(NULL != sending_ext->sending_timer_id) { Hal_Timer_Stop(sending_ext->sending_timer_id); @@ -572,14 +580,16 @@ lv_obj_t * wechat_msg_sending_screen_create(lv_obj_t * activity_obj) activity_ext.create = (lv_watch_activity_create_f_t)wechat_msg_sending_screen_create; activity_ext.prepare_destory = wechat_msg_sending_screen_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; lv_wechat_msg_sending_ext_t * sending_ext = (lv_wechat_msg_sending_ext_t *)lv_obj_allocate_ext_attr(obj, sizeof(lv_wechat_msg_sending_ext_t)); - LV_ASSERT_MEM(sending_ext); + if(NULL == sending_ext) + return NULL; sending_ext->send_result = wechat_msg_send_to_server(); sending_ext->sending_timer_id = Hal_Timer_Start(1000 * 3, wechat_msg_sending_screen_timeout, sending_ext, FALSE); @@ -709,8 +719,6 @@ void wechat_msg_recording_audio_ctrl_callback(AUDIO_CTRL_PRIORITY priority) WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); return; } - WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); - //wechat_msg_same_priority_task_end(); } else if(AUDIO_CTRL_PRIORITY_5 > priority) { @@ -831,8 +839,9 @@ void wechat_msg_recording_screen_create(void) s_wechat_play_anim_count = 0; lv_obj_t * label_warning = lv_label_create(cont, NULL); - lv_obj_set_style_local_text_font(label_warning, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_THEME_WATCH_NIGHT_FONT_SMALL); - lv_obj_set_style_local_text_color(label_warning, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); + //lv_obj_set_style_local_text_font(label_warning, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_THEME_WATCH_NIGHT_FONT_SMALL); + //lv_obj_set_style_local_text_color(label_warning, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); + lv_obj_add_style(label_warning, LV_LABEL_PART_MAIN, &lv_watch_font26_black); //lv_label_set_long_mode(label_warning, LV_LABEL_LONG_BREAK); //lv_obj_set_width(label_warning, lv_obj_get_width(obj) * 2 / 3); lv_label_set_text_id(label_warning, WATCH_TEXT_ID_SLIDE_UP_WARNING); @@ -913,7 +922,7 @@ void wechat_msg_record_button_event_cb(lv_obj_t * obj, lv_event_t e) { lv_coord_t point_y = indev->proc.types.pointer.last_point.y; lv_coord_t img_record_top = obj->coords.y1; - if(point_y < (img_record_top - 20)) + if(30 < img_record_top - point_y) // (point_y < (img_record_top - 20)) { /*last point is above img, consider as sliding up and cancel recording*/ WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: indev_y=%d, img_y=%d\n", __FUNCTION__, __LINE__, point_y, img_record_top); @@ -1122,9 +1131,6 @@ void wechat_chat_list_voice_item_playing_audio_ctrl_callback(AUDIO_CTRL_PRIORITY WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); return; } - - WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); - //wechat_msg_same_priority_task_end(); } else if(AUDIO_CTRL_PRIORITY_5 > priority) { @@ -1584,7 +1590,7 @@ lv_obj_t * wechat_create(lv_obj_t * activity_obj, lv_wechat_created_from_e from) //create no msg label ext->label_no_msg = lv_label_create(cont, NULL); - lv_obj_add_style(ext->label_no_msg, LV_LABEL_PART_MAIN, &lv_watch_font30_black); + lv_obj_add_style(ext->label_no_msg, LV_LABEL_PART_MAIN, &lv_watch_font26_black); lv_label_set_text_id(ext->label_no_msg, WATCH_TEXT_ID_NO_VOICE_MSG); //lv_label_set_align(ext->label_no_msg, LV_LABEL_ALIGN_CENTER); lv_obj_align(ext->label_no_msg, cont, LV_ALIGN_CENTER, 0, -10); diff --git a/2.sdk/gui/lv_watch/lv_objx/lv_watch_list/lv_watch_list.c b/2.sdk/gui/lv_watch/lv_objx/lv_watch_list/lv_watch_list.c index 550d1a37..e8bd2761 100644 --- a/2.sdk/gui/lv_watch/lv_objx/lv_watch_list/lv_watch_list.c +++ b/2.sdk/gui/lv_watch/lv_objx/lv_watch_list/lv_watch_list.c @@ -114,7 +114,7 @@ lv_obj_t * lv_watch_list_create(lv_obj_t * activity_obj) lv_obj_set_width(list, lv_obj_get_width(content)); lv_coord_t height = lv_obj_get_height(content) - lv_obj_get_height(label_cont) - - pad_ver * 2; + ; //- pad_ver * 2; lv_obj_set_height(list, height); return obj; @@ -163,6 +163,9 @@ lv_obj_t * lv_watch_list_add(lv_obj_t * obj, const void * img_src, watchLangTxtI lv_label_set_long_mode(label, LV_LABEL_LONG_EXPAND); //set text id of btn label, it will update language when language changed lv_label_set_text_id(label, txtId); +#ifdef __MMI_ZHSX_SUPPORT__ + //lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); +#endif return btn; } diff --git a/2.sdk/gui/lv_watch/lv_theme_watch_night.h b/2.sdk/gui/lv_watch/lv_theme_watch_night.h index 29a9ffa8..43f9511b 100644 --- a/2.sdk/gui/lv_watch/lv_theme_watch_night.h +++ b/2.sdk/gui/lv_watch/lv_theme_watch_night.h @@ -59,6 +59,10 @@ LV_FONT_DECLARE(lv_font_ttf_22) LV_FONT_DECLARE(lv_font_ttf_24) LV_FONT_DECLARE(lv_font_ttf_26) LV_FONT_DECLARE(lv_font_ttf_28) +#define LV_THEME_WATCH_NIGHT_FONT_22 &lv_font_ttf_22 +#define LV_THEME_WATCH_NIGHT_FONT_24 &lv_font_ttf_24 +#define LV_THEME_WATCH_NIGHT_FONT_26 &lv_font_ttf_26 +#define LV_THEME_WATCH_NIGHT_FONT_28 &lv_font_ttf_28 #endif #define LV_THEME_WATCH_NIGHT_FONT_20 &lv_font_ttf_20 #define LV_THEME_WATCH_NIGHT_FONT_30 &lv_font_ttf_30 @@ -94,11 +98,19 @@ LV_FONT_DECLARE(lv_font_droidSansFallbackFull_30_compressed) #define LV_THEME_WATCH_NIGHT_COLOR_SECONDARY LV_COLOR_GRAY #define LV_THEME_WATCH_NIGHT_FLAG 0 +#if 0 //def __MMI_ZHSX_SUPPORT__ +#define LV_THEME_WATCH_NIGHT_FONT_SMALL LV_THEME_WATCH_NIGHT_FONT_30 +#define LV_THEME_WATCH_NIGHT_FONT_NORMAL LV_THEME_WATCH_NIGHT_FONT_30 +#define LV_THEME_WATCH_NIGHT_FONT_SUBTITLE LV_THEME_WATCH_NIGHT_FONT_30 +#define LV_THEME_WATCH_NIGHT_FONT_TITLE LV_THEME_WATCH_NIGHT_FONT_30 +#define LV_THEME_WATCH_NIGHT_FONT_BIG LV_THEME_WATCH_NIGHT_FONT_30 +#else #define LV_THEME_WATCH_NIGHT_FONT_SMALL LV_THEME_WATCH_NIGHT_FONT_20 #define LV_THEME_WATCH_NIGHT_FONT_NORMAL LV_THEME_WATCH_NIGHT_FONT_20 #define LV_THEME_WATCH_NIGHT_FONT_SUBTITLE LV_THEME_WATCH_NIGHT_FONT_20 #define LV_THEME_WATCH_NIGHT_FONT_TITLE LV_THEME_WATCH_NIGHT_FONT_20 #define LV_THEME_WATCH_NIGHT_FONT_BIG LV_THEME_WATCH_NIGHT_FONT_30 +#endif extern lv_style_t lv_style_pretty; extern lv_style_t lv_style_transp; diff --git a/2.sdk/gui/lv_watch/mmi_customer_default.h b/2.sdk/gui/lv_watch/mmi_customer_default.h new file mode 100644 index 00000000..e5e2c647 --- /dev/null +++ b/2.sdk/gui/lv_watch/mmi_customer_default.h @@ -0,0 +1,141 @@ + + + +#ifndef __MMI_CUSTOMER_DEFAULT_H__ +#define __MMI_CUSTOMER_DEFAULT_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif //__cplusplus + +#ifdef LV_CONF_INCLUDE_SIMPLE +#include "lvgl.h" +#include "lv_watch_conf.h" +#else +#include "../../../lvgl/lvgl.h" +#include "../../../lv_watch_conf.h" +#endif + +#ifdef __MMI_ZHSX_SUPPORT__ + +//server ip +#ifdef MMI_CUSTOMER_IP_ADDRESS +#define MMI_PROTOCOL_IP_ADDRESS_DEFAULT MMI_CUSTOMER_IP_ADDRESS +#else +#define MMI_PROTOCOL_IP_ADDRESS_DEFAULT "api.xcloudtech.com" +#endif + +#ifdef MMI_CUSTOMER_IP_PORT +#define MMI_PROTOCOL_IP_PORT_DEFAULT MMI_CUSTOMER_IP_PORT +#else +#define MMI_PROTOCOL_IP_PORT_DEFAULT (9000) +#endif + + +#ifdef MMI_CUSTOMER_HEARTBEAT_ACTION_INTERVAL +#define MMI_PROTOCOL_HEARTBEAT_ACTION_INTERVAL MMI_CUSTOMER_HEARTBEAT_ACTION_INTERVAL +#else +#define MMI_PROTOCOL_HEARTBEAT_ACTION_INTERVAL (60 * 5) // unit:s +#endif + +#ifdef MMI_CUSTOMER_LOCATION_UPLOAD_INTERVAL +#define MMI_PROTOCOL_LOCATION_UPLOAD_INTERVAL MMI_CUSTOMER_LOCATION_UPLOAD_INTERVAL +#else +#define MMI_PROTOCOL_LOCATION_UPLOAD_INTERVAL (60 * 20) // unit:s +#endif + +#ifdef MMI_CUSTOMER_WEATHER_UPDATE_INTERVAL +#define MMI_PROTOCOL_WEATHER_UPDATE_INTERVAL MMI_CUSTOMER_WEATHER_UPDATE_INTERVAL +#else +#define MMI_PROTOCOL_WEATHER_UPDATE_INTERVAL (60 * 60 * 6) // unit:s +#endif + + +//health measure process +#ifdef MMI_CUSTOMER_MEASURE_HEART_DURATION +#define MMI_HEALTH_MEASURE_HEART_DURATION MMI_CUSTOMER_MEASURE_HEART_DURATION +#else +#define MMI_HEALTH_MEASURE_HEART_DURATION (44 * 1000) // unit:ms +#endif + +#ifdef MMI_CUSTOMER_MEASURE_TEMPERATURE_DURATION +#define MMI_HEALTH_MEASURE_TEMPERATURE_DURATION MMI_CUSTOMER_MEASURE_TEMPERATURE_DURATION +#else +#define MMI_HEALTH_MEASURE_TEMPERATURE_DURATION (24 * 1000) // unit:ms +#endif + +#ifdef MMI_CUSTOMER_MEASURE_BLOOD_DURATION +#define MMI_HEALTH_MEASURE_BLOOD_DURATION MMI_CUSTOMER_MEASURE_BLOOD_DURATION +#else +#define MMI_HEALTH_MEASURE_BLOOD_DURATION (34 * 1000) // unit:ms +#endif + +#ifdef MMI_CUSTOMER_MEASURE_SPO2_DURATION +#define MMI_HEALTH_MEASURE_SPO2_DURATION MMI_CUSTOMER_MEASURE_SPO2_DURATION +#else +#define MMI_HEALTH_MEASURE_SPO2_DURATION (34 * 1000) // unit:ms +#endif + + +//health measure timed +#ifdef MMI_CUSTOMER_HEART_TIMED_FLAG +#define MMI_HEALTH_HEART_TIMED_FLAG MMI_CUSTOMER_HEART_TIMED_FLAG +#else +#define MMI_HEALTH_HEART_TIMED_FLAG false +#endif + +#ifdef MMI_CUSTOMER_HEART_TIMED_INTERVAL +#define MMI_HEALTH_HEART_TIMED_INTERVAL MMI_CUSTOMER_HEART_TIMED_INTERVAL +#else +#define MMI_HEALTH_HEART_TIMED_INTERVAL (10 * 60) // unit:s +#endif + +#ifdef MMI_CUSTOMER_TEMPERATURE_TIMED_FLAG +#define MMI_HEALTH_TEMPERATURE_TIMED_FLAG MMI_CUSTOMER_TEMPERATURE_TIMED_FLAG +#else +#define MMI_HEALTH_TEMPERATURE_TIMED_FLAG false +#endif + +#ifdef MMI_CUSTOMER_TEMPERATURE_TIMED_INTERVAL +#define MMI_HEALTH_TEMPERATURE_TIMED_INTERVAL MMI_CUSTOMER_TEMPERATURE_TIMED_INTERVAL +#else +#define MMI_HEALTH_TEMPERATURE_TIMED_INTERVAL (10 * 60) // unit:s +#endif + +#ifdef MMI_CUSTOMER_BLOOD_TIMED_FLAG +#define MMI_HEALTH_BLOOD_TIMED_FLAG MMI_CUSTOMER_BLOOD_TIMED_FLAG +#else +#define MMI_HEALTH_BLOOD_TIMED_FLAG false +#endif + +#ifdef MMI_CUSTOMER_BLOOD_TIMED_INTERVAL +#define MMI_HEALTH_BLOOD_TIMED_INTERVAL MMI_CUSTOMER_BLOOD_TIMED_INTERVAL +#else +#define MMI_HEALTH_BLOOD_TIMED_INTERVAL (10 * 60) // unit:s +#endif + +#ifdef MMI_CUSTOMER_SPO2_TIMED_FLAG +#define MMI_HEALTH_SPO2_TIMED_FLAG MMI_CUSTOMER_SPO2_TIMED_FLAG +#else +#define MMI_HEALTH_SPO2_TIMED_FLAG false +#endif + +#ifdef MMI_CUSTOMER_SPO2_TIMED_INTERVAL +#define MMI_HEALTH_SPO2_TIMED_INTERVAL MMI_CUSTOMER_SPO2_TIMED_INTERVAL +#else +#define MMI_HEALTH_SPO2_TIMED_INTERVAL (10 * 60) // unit:s +#endif + + + + +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif //__cplusplus + +#endif + + diff --git a/2.sdk/gui/lv_watch/mmi_location/mmi_location.h b/2.sdk/gui/lv_watch/mmi_location/mmi_location.h index 1ce66485..7a8e0d57 100644 --- a/2.sdk/gui/lv_watch/mmi_location/mmi_location.h +++ b/2.sdk/gui/lv_watch/mmi_location/mmi_location.h @@ -1,8 +1,6 @@ -#ifdef __MMI_ZHSX_SUPPORT__ - #ifndef __MMI_LOCATION_H__ #define __MMI_LOCATION_H__ @@ -11,9 +9,15 @@ extern "C" { #endif //__cplusplus +#ifdef LV_CONF_INCLUDE_SIMPLE +#include "lvgl.h" +#include "lv_watch_conf.h" +#else +#include "../../../lvgl/lvgl.h" +#include "../../../lv_watch_conf.h" +#endif -#include "lv_watch.h" - +#ifdef __MMI_ZHSX_SUPPORT__ typedef void (*FUNC_CB)(int); @@ -83,13 +87,8 @@ typedef struct typedef struct { - //gps MMI_WATCH_GPS_DATA_T gps_data; - - //cell MMI_WATCH_CELL_DATA_T cell_data; - - //wifi app_adp_wifi_ap_list wifi_data; } MMI_WATCH_LOCATION_DATA_T; @@ -114,12 +113,12 @@ void mmi_watch_location_mission_get_weather_action(void); +#endif + #ifdef __cplusplus } /* extern "C" */ #endif //__cplusplus #endif -#endif - diff --git a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c index 8bc52af6..998540f9 100644 --- a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c +++ b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c @@ -5,9 +5,6 @@ #ifdef __MMI_ZHSX_SUPPORT__ -#include "../modem/mmi_modem_tcp/mmi_modem_tcp_net.h" - - static nv_watch_protocol_data_t s_watch_protocol_data = {0}; static bool s_watch_bind_state = false; @@ -19,6 +16,7 @@ static uint32_t s_watch_heartbeat_action_time_stamp = 0; static void mmi_protocol_watch_timed_mission_timer_cb(uint32_t para); static void mmi_protocol_watch_heartbeat_timer_cb(uint32_t para); +bool mmi_protocol_action_location(void); bool mmi_watch_tcp_connect_state_get(void) @@ -85,7 +83,7 @@ void mmi_watch_protocol_data_nv_default(nv_watch_protocol_data_t * data) { PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: nv default\n", __FUNCTION__, __LINE__); - data->watch_host_name = MMI_PROTOCOL_IP_ADDRESS_DEFAULT; + strcpy(data->watch_host_name, MMI_PROTOCOL_IP_ADDRESS_DEFAULT); data->watch_host_port = MMI_PROTOCOL_IP_PORT_DEFAULT; data->heartbeat_action_interval = MMI_PROTOCOL_HEARTBEAT_ACTION_INTERVAL; data->location_upload_interval = MMI_PROTOCOL_LOCATION_UPLOAD_INTERVAL; diff --git a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.h b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.h index ac0f4a6a..8ffb2301 100644 --- a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.h +++ b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.h @@ -1,8 +1,6 @@ -#ifdef __MMI_ZHSX_SUPPORT__ - #ifndef __MMI_PROTOCOL_API_H__ #define __MMI_PROTOCOL_API_H__ @@ -11,6 +9,16 @@ extern "C" { #endif //__cplusplus +#ifdef LV_CONF_INCLUDE_SIMPLE +#include "lvgl.h" +#include "lv_watch_conf.h" +#else +#include "../../../lvgl/lvgl.h" +#include "../../../lv_watch_conf.h" +#endif + +#ifdef __MMI_ZHSX_SUPPORT__ + #define __MMI_PROTOCOL_DEBUG__ #ifdef __MMI_PROTOCOL_DEBUG__ @@ -75,12 +83,12 @@ bool mmi_protocol_action_send_get_weather(MMI_WATCH_LOCATION_DATA_T * location_d +#endif + #ifdef __cplusplus } /* extern "C" */ #endif //__cplusplus #endif -#endif - diff --git a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c index 804740f2..4f3b9576 100644 --- a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c +++ b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c @@ -833,7 +833,7 @@ bool mmi_protocol_fzd_parse_ACTION_BIND(unsigned char * next_buff, unsigned int { mmi_protocol_watch_bind_state_set(false); uos_sleep(10); - mmi_watch_reset(); + mmi_watch_reset(NULL); } } else @@ -938,7 +938,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_FACTORY(unsigned char * next_buff, unsign result = true; mmi_protocol_fzd_respond_without_data(action); uos_sleep(10); - mmi_watch_reset(); + mmi_watch_reset(NULL); return result; } @@ -951,7 +951,6 @@ bool mmi_protocol_fzd_parse_SERVER_SET_POWEROFF(unsigned char * next_buff, unsig result = true; mmi_protocol_fzd_respond_without_data(action); uos_sleep(10); - app_adaptor_wake_up_short_time(); mmi_watch_power_off(); return result; @@ -1467,7 +1466,8 @@ bool mmi_protocol_fzd_ACTION_TALK(char * data_buff, int data_buff_len) return false; } - memory_size= FZD_MAX(data_buff_len * ENCRYPT_EXT_COEF/100, FZD_MIN(ENCRYPT_EXT_MIN, data_buff_len)); + memory_size = data_buff_len; + memory_size += FZD_MAX(data_buff_len * ENCRYPT_EXT_COEF/100, FZD_MIN(ENCRYPT_EXT_MIN, data_buff_len)); content_buff = (unsigned char *)lv_mem_alloc(memory_size); if(NULL == content_buff) { @@ -1476,7 +1476,11 @@ bool mmi_protocol_fzd_ACTION_TALK(char * data_buff, int data_buff_len) } _lv_memset_00(content_buff, memory_size); + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: memory_size=%d\n", __FUNCTION__, __LINE__, memory_size); + content_lenth = mmi_protocol_fzd_voice_data_encrypt(data_buff, data_buff_len, content_buff); + + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: content_lenth=%d\n", __FUNCTION__, __LINE__, content_lenth); result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); lv_mem_free(content_buff); diff --git a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.h b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.h index 71cb598b..9c238164 100644 --- a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.h +++ b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.h @@ -1,8 +1,6 @@ -#ifdef __MMI_ZHSX_SUPPORT_FZD__ - #ifndef __MMI_PROTOCOL_FZD_H__ #define __MMI_PROTOCOL_FZD_H__ @@ -11,19 +9,20 @@ extern "C" { #endif //__cplusplus +#ifdef LV_CONF_INCLUDE_SIMPLE +#include "lvgl.h" +#include "lv_watch_conf.h" +#else +#include "../../../lvgl/lvgl.h" +#include "../../../lv_watch_conf.h" +#endif -#include "lv_watch.h" - - - -//Server address and port -//#define HOST_NAME "api.xcloudtech.com" -//#define HOST_PORT (9000) +#ifdef __MMI_ZHSX_SUPPORT_FZD__ /**************************************** -Êý¾Ý¸ñʽ : [MD5_DATA³§ÉÌ*É豸ID*ÄÚÈݳ¤¶È*ÄÚÈݱêʶ,ÄÚÈÝÊý¾Ý] +FORMAT: [MD5_DATADEVICE_NAME*DEVICE_ID*CONTENT_LENGTH*CONTENT_KEY,CONTENT_VALUE] ****************************************/ @@ -42,11 +41,10 @@ extern "C" #define MMI_PROTOCOL_FZD_DEVICE_ID_LEN (15) #define MMI_PROTOCOL_FZD_CONTENT_LEN_LEN (4) -// total:[MD5_DATADEVICE_NAME*DEVICE_ID*CONTENT_LEN*ACTION_STRING,ACTION_CONTENT] -// send fixed:[MD5_DATADEVICE_NAME*DEVICE_ID*CONTENT_LEN*] +// send fixed:[MD5_DATADEVICE_NAME*DEVICE_ID*CONTENT_LENGTH*] #define MMI_PROTOCOL_FZD_SEND_FIXED_CONTENT_LEN (MMI_PROTOCOL_FZD_BRACKET_LEN * 2 + MMI_PROTOCOL_FZD_MD5_DATA_LEN + MMI_PROTOCOL_FZD_DEVICE_NAME_LEN \ + MMI_PROTOCOL_FZD_SEPARATOR_LEN * 3 + MMI_PROTOCOL_FZD_DEVICE_ID_LEN + MMI_PROTOCOL_FZD_CONTENT_LEN_LEN) -// receive fixed:[DEVICE_NAME*DEVICE_ID*CONTENT_LEN*] +// receive fixed:[DEVICE_NAME*DEVICE_ID*CONTENT_LENGTH*] #define MMI_PROTOCOL_FZD_RECEIVE_FIXED_CONTENT_LEN (MMI_PROTOCOL_FZD_BRACKET_LEN * 2 + MMI_PROTOCOL_FZD_DEVICE_NAME_LEN \ + MMI_PROTOCOL_FZD_SEPARATOR_LEN * 3 + MMI_PROTOCOL_FZD_DEVICE_ID_LEN + MMI_PROTOCOL_FZD_CONTENT_LEN_LEN) @@ -205,12 +203,12 @@ bool mmi_protocol_fzd_parse_SERVER_SET_CENTER_NUMBER(unsigned char * next_buff, +#endif + #ifdef __cplusplus } /* extern "C" */ #endif //__cplusplus #endif -#endif - diff --git a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.c b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.c new file mode 100644 index 00000000..18805862 --- /dev/null +++ b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.c @@ -0,0 +1,155 @@ + + + +#include "lv_watch.h" + +#ifdef __MMI_ZHSX_SUPPORT_SMS__ + + +static MMI_PROTOCOL_SMS_PARSE_STRUCT s_sms_parse_info[] = +{ + {"SETIP:", 6, mmi_protocol_sms_parse_set_ip}, + //{"setip:", 6, mmi_protocol_sms_parse_set_ip}, + {"POWEROFF", 8, mmi_protocol_sms_parse_power_off}, + {"SETFACTORY", 10, mmi_protocol_sms_parse_set_factory}, + + + /*******add before this line*******/ + {"", 0, NULL} +}; + + +//SETIP:api.xcloudtech.com:9000 +bool mmi_protocol_sms_parse_set_ip(char * data, char * number) +{ + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: num=%s\n", __FUNCTION__, __LINE__, number); + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %s\n", __LINE__, data); + + if(0 == strlen(data)) + { + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return false; + } + + char ip_address[NV_WATCH_HOST_NAME_LEN_MAX] = {0}; + int ip_port = 0; + uint8_t i = 0; + + while(':' != data[i]) + { + ip_address[i] = data[i]; + i++; + } + i++; + ip_port = atoi(data + i); + + // + //reply sms + // + + mmi_watch_host_name_set(ip_address); + mmi_watch_host_port_set(ip_port); + + send_task_msg_tcp_reconnect(NULL); + + return true; +} + +//POWEROFF +bool mmi_protocol_sms_parse_power_off(char * data, char * number) +{ + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: num=%s\n", __FUNCTION__, __LINE__, number); + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %s\n", __LINE__, data); + + if(0 != strlen(data)) + { + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return false; + } + + // + //reply sms + // + + uos_sleep(10); + mmi_watch_power_off(); + + return true; +} + +//SETFACTORY +bool mmi_protocol_sms_parse_set_factory(char * data, char * number) +{ + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: num=%s\n", __FUNCTION__, __LINE__, number); + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %s\n", __LINE__, data); + + if(0 != strlen(data)) + { + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return false; + } + + // + //reply sms + // + + uos_sleep(10); + mmi_watch_reset(NULL); + + return true; +} + + + + +bool mmi_protocol_sms_content_parse(char * sms_content, char * sms_send_number) +{ + bool result = false; + + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: num=%s\n", __FUNCTION__, __LINE__, sms_send_number); + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %s\n", __LINE__, sms_content); + + if(NULL != sms_content) + { + int content_len = 0, num_len = 0; + char data[NV_SMS_MAX_DATA_LEN] = {0}; + char number[NV_CONTACTS_MAX_NUMBER_LEN] = {0}; + uint8_t i = 0; + + content_len = strlen(sms_content); + if(NV_SMS_MAX_DATA_LEN <= content_len) + content_len = NV_SMS_MAX_DATA_LEN - 1; + _lv_memcpy(data, sms_content, content_len); + + num_len = strlen(sms_send_number); + if(NV_CONTACTS_MAX_NUMBER_LEN <= content_len) + num_len = NV_CONTACTS_MAX_NUMBER_LEN - 1; + _lv_memcpy(number, sms_send_number, num_len); + + while(0 != s_sms_parse_info[i].str_len) + { + if(content_len < s_sms_parse_info[i].str_len) + { + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + } + else if(0 == strncmp(s_sms_parse_info[i].fixed_str, data, s_sms_parse_info[i].str_len)) + { + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + + if(NULL != s_sms_parse_info[i].parse_cb) + { + result = s_sms_parse_info[i].parse_cb(data + s_sms_parse_info[i].str_len, number); + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: result=%d\n", __FUNCTION__, __LINE__, result); + break; + } + } + i++; + } + } + + return result; +} + +#endif + + diff --git a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.h b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.h new file mode 100644 index 00000000..1cc70312 --- /dev/null +++ b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.h @@ -0,0 +1,55 @@ + + + +#ifndef __MMI_PROTOCOL_SMS_H__ +#define __MMI_PROTOCOL_SMS_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif //__cplusplus + +#ifdef LV_CONF_INCLUDE_SIMPLE +#include "lvgl.h" +#include "lv_watch_conf.h" +#else +#include "../../../lvgl/lvgl.h" +#include "../../../lv_watch_conf.h" +#endif + +#ifdef __MMI_ZHSX_SUPPORT_SMS__ + +#define __MMI_PROTOCOL_SMS_DEBUG__ +#ifdef __MMI_PROTOCOL_SMS_DEBUG__ +#define SMS_DEBUG_PRINTF(fmt, ...) printf("[SMS]"fmt, ##__VA_ARGS__) +#else +#define SMS_DEBUG_PRINTF(fmt, ...) +#endif + + +typedef bool (* SMS_PARSE_CB)(char *, char *); + +typedef struct +{ + const char * fixed_str; + int str_len; + SMS_PARSE_CB parse_cb; +} MMI_PROTOCOL_SMS_PARSE_STRUCT; + + +bool mmi_protocol_sms_content_parse(char * sms_content, char * sms_send_number); +bool mmi_protocol_sms_parse_set_ip(char * data, char * number); +bool mmi_protocol_sms_parse_power_off(char * data, char * number); +bool mmi_protocol_sms_parse_set_factory(char * data, char * number); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif //__cplusplus + +#endif + +#endif + + diff --git a/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.c b/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.c new file mode 100644 index 00000000..95b8b322 --- /dev/null +++ b/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.c @@ -0,0 +1,84 @@ + + + +#include "lv_watch.h" + +#ifdef __MMI_ZHSX_SUPPORT__ + +void mmi_float_to_str(double float_num, uint8_t int_num, char * data_str) +{ + uint8_t i = 0; + uint32_t high_part = 0; + double low_part = 0.0; + char high_part_str[16] = {0}, low_part_str[16] = {0}; + + high_part = (int)float_num; + sprintf(high_part_str, "%d", high_part); + + low_part = float_num - high_part; + for(i = 0; i < int_num; i++) + { + uint32_t temp_high = 0; + + low_part = low_part * 10; + temp_high = (int)low_part; + low_part -= temp_high; + low_part_str[i] = '0' + temp_high; + } + low_part_str[i] = '\0'; + + sprintf(data_str, "%s.%s", high_part_str, low_part_str); +} + +signed char mmi_char_to_upper(signed char c) +{ + if ( c >= 'a' && c <= 'z' ) + { + c = c - 'a' + 'A'; + } + + return c; +} + +void mmi_str_to_upper(signed char *str, signed int len) +{ + signed int i = 0; + + for(i = 0; i < len; i++) + { + str[i] = mmi_char_to_upper(str[i]); + } +} + +signed int mmi_hex_string_to_number(signed char* hex_str, unsigned char hex_str_len) +{ + int int_value = 0; + uint8_t i = 0, t_value = 0; + char t_char = 0; + + if(NULL == hex_str || 0 == hex_str_len) + return 0; + + for(i = 0; i < hex_str_len; i++) + { + t_char = hex_str[i]; + if('a' <= t_char && 'z' >= t_char) + t_char = t_char - 'a' + 'A'; + + t_value = ('A' <= t_char) ? (t_char - 'A' + 10) : (t_char - '0'); + int_value = int_value * 16 + t_value; + } + + return int_value; +} + + + + + + + + +#endif + + diff --git a/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.h b/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.h index f62ab943..0916a2a2 100644 --- a/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.h +++ b/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.h @@ -1,8 +1,6 @@ -#ifdef __MMI_ZHSX_SUPPORT__ - #ifndef __MMI_COMMON_H__ #define __MMI_COMMON_H__ @@ -11,9 +9,15 @@ extern "C" { #endif //__cplusplus +#ifdef LV_CONF_INCLUDE_SIMPLE +#include "lvgl.h" +#include "lv_watch_conf.h" +#else +#include "../../../lvgl/lvgl.h" +#include "../../../lv_watch_conf.h" +#endif -//#include "lv_watch.h" - +#ifdef __MMI_ZHSX_SUPPORT__ void mmi_float_to_str(double float_num, uint8_t int_num, char * data_str); @@ -25,6 +29,7 @@ signed int mmi_hex_string_to_number(signed char* hex_str, unsigned char hex_str_ +#endif #ifdef __cplusplus } /* extern "C" */ @@ -32,6 +37,4 @@ signed int mmi_hex_string_to_number(signed char* hex_str, unsigned char hex_str_ #endif -#endif - diff --git a/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.c b/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.c index 50803f35..bfa047ef 100644 --- a/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.c +++ b/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.c @@ -1,9 +1,9 @@ -#ifdef __MMI_ZHSX_SUPPORT__ +#include "lv_watch.h" -#include "mmi_sundry.h" +#ifdef __MMI_ZHSX_SUPPORT__ static TIMER_ID s_watch_search_timer_id = NULL; diff --git a/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.h b/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.h index 9e86fbdf..43970a78 100644 --- a/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.h +++ b/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.h @@ -1,8 +1,6 @@ -#ifdef __MMI_ZHSX_SUPPORT__ - #ifndef __MMI_SUNDRY_H__ #define __MMI_SUNDRY_H__ @@ -11,9 +9,15 @@ extern "C" { #endif //__cplusplus +#ifdef LV_CONF_INCLUDE_SIMPLE +#include "lvgl.h" +#include "lv_watch_conf.h" +#else +#include "../../../lvgl/lvgl.h" +#include "../../../lv_watch_conf.h" +#endif -#include "lv_watch.h" - +#ifdef __MMI_ZHSX_SUPPORT__ #define __MMI_SUNDRY_DEBUG__ #ifdef __MMI_SUNDRY_DEBUG__ diff --git a/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_manage.c b/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_manage.c index 4ea21a8f..25603811 100644 --- a/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_manage.c +++ b/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_manage.c @@ -156,7 +156,7 @@ void mmi_modem_tcp_connect(void *param) } #ifdef __MMI_ZHSX_SUPPORT__ - res = ValNetworkSocketInit_with_callback(NULL, mmi_watch_host_name_get, mmi_watch_host_port_get, (socket_callback)manage_socket_callback); + res = ValNetworkSocketInit_with_callback(NULL, mmi_watch_host_name_get(), mmi_watch_host_port_get(), (socket_callback)manage_socket_callback); #else res = ValNetworkSocketInit_with_callback(NULL, HOST_NAME, HOST_PORT, (socket_callback)manage_socket_callback); #endif diff --git a/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_msg_handler_impl.c b/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_msg_handler_impl.c index 040240b6..48fa9dc0 100644 --- a/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_msg_handler_impl.c +++ b/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_msg_handler_impl.c @@ -179,14 +179,14 @@ void read_tcp_cmdmsg_handler_impl(void *msg) signed long recv_ret; int recv_len = 0; //char *recv_str = (char *)malloc(PKG_LEN); - char *recv_str = (char *)Hal_Mem_Alloc(PKG_LEN); + char *recv_str = (char *)Hal_Mem_Alloc(LARGE_PKG_LEN); if(NULL == recv_str) { printf("[@CHENG_DEBUG][%s][%d]: \n",__FUNCTION__,__LINE__); return; } - memset(recv_str , 0x00, PKG_LEN); - recv_ret = mmi_modem_tcp_read(recv_str, PKG_LEN, &recv_len); + Hal_Mem_Set(recv_str , 0x00, LARGE_PKG_LEN); + recv_ret = mmi_modem_tcp_read(recv_str, LARGE_PKG_LEN, &recv_len); printf("[@CHENG_DEBUG][%s][%d]: ret=%d,len=%d,ptr=0x%x\n", __FUNCTION__, __LINE__, recv_ret, recv_len, recv_str); printf("[@CHENG_DEBUG][%d]: str=%s\n", __LINE__, recv_str); diff --git a/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_net.c b/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_net.c index cb82f59b..80015f7c 100644 --- a/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_net.c +++ b/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_net.c @@ -23,9 +23,9 @@ void tcp_connect_cb(int t) void mmi_modem_tcp_task_init(void) { #ifdef __MMI_ZHSX_SUPPORT__ + printf("[@CHENG_DEBUG][%s][%d]: \n",__FUNCTION__,__LINE__); mmi_watch_protocol_data_nv_read(); mmi_modem_tcp_task_interface_init(); - printf("[@CHENG_DEBUG][%s][%d]: \n",__FUNCTION__,__LINE__); launcher_tcp_connect(NULL); #else diff --git a/2.sdk/gui/lv_watch/resource/audio/R_CALL_1.mid b/2.sdk/gui/lv_watch/resource/audio/R_CALL_1.mid new file mode 100644 index 00000000..b530188a Binary files /dev/null and b/2.sdk/gui/lv_watch/resource/audio/R_CALL_1.mid differ diff --git a/2.sdk/gui/lv_watch/resource/audio/R_CALL_1.mp3 b/2.sdk/gui/lv_watch/resource/audio/R_CALL_1.mp3 new file mode 100644 index 00000000..7c892e18 Binary files /dev/null and b/2.sdk/gui/lv_watch/resource/audio/R_CALL_1.mp3 differ diff --git a/2.sdk/gui/lv_watch/resource/gif/anim_temperature_measuring.gif b/2.sdk/gui/lv_watch/resource/gif/anim_temperature_measuring.gif index 5b3cb0a0..88cbec21 100644 Binary files a/2.sdk/gui/lv_watch/resource/gif/anim_temperature_measuring.gif and b/2.sdk/gui/lv_watch/resource/gif/anim_temperature_measuring.gif differ diff --git a/2.sdk/gui/lv_watch/resource/png/health_measure/icon_temperature_measure_done.png b/2.sdk/gui/lv_watch/resource/png/health_measure/icon_temperature_measure_done.png index 379a1d7e..3a314339 100644 Binary files a/2.sdk/gui/lv_watch/resource/png/health_measure/icon_temperature_measure_done.png and b/2.sdk/gui/lv_watch/resource/png/health_measure/icon_temperature_measure_done.png differ diff --git a/2.sdk/gui/lv_watch/resource/png/health_measure/icon_temperature_measure_fail.png b/2.sdk/gui/lv_watch/resource/png/health_measure/icon_temperature_measure_fail.png index 8f54b604..ea35b3f1 100644 Binary files a/2.sdk/gui/lv_watch/resource/png/health_measure/icon_temperature_measure_fail.png and b/2.sdk/gui/lv_watch/resource/png/health_measure/icon_temperature_measure_fail.png differ