From: CCC <2393524978@qq.com> Date: Fri, 12 May 2023 09:42:04 +0000 (+0800) Subject: xiugai X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=aa97dae35bb584dd17dfb065ef8cfd0afdcb5dd4;p=mirrors%2FASR3603_Z5.git xiugai --- 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 02023186..c03b5bdd 100644 --- a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor.c +++ b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor.c @@ -159,6 +159,12 @@ void app_adaptor_send_sos_info_req(void) void app_adaptor_get_pedometer_info_req(app_adaptor_pedometer_record_t * record) { +#ifdef __MMI_ZHSX_SUPPORT__ + record->step = asl_pedometer_steps_get(); + record->kcal = record->step * 0.025; + record->km = record->step * 0.6 / 1000.0; +#else + #if 1//simware fix record->step = asl_pedometer_steps_get(); record->kcal = record->step * 0.025; @@ -171,6 +177,7 @@ void app_adaptor_get_pedometer_info_req(app_adaptor_pedometer_record_t * record) #if USE_LV_WATCH_PEDOMETER != 0 pedometer_update_steps(record->step); #endif +#endif } void app_adaptor_get_health_info_req(app_adaptor_health_info_t * health) diff --git a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.c b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.c index 624c8f1e..decaef23 100644 --- a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.c +++ b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.c @@ -84,7 +84,7 @@ uint32_t asl_pedometer_steps_get(void) return s_pedometer_data.step; } -void asl_pedometer_steps_save(void) +void asl_pedometer_steps_save(bool to_nv) { hal_rtc_t date = {0}; uint32_t steps = get_xmotion_steps(); @@ -97,7 +97,16 @@ void asl_pedometer_steps_save(void) s_pedometer_data.step += steps - s_sensor_last_steps; s_sensor_last_steps = steps; - nv_pedometer_step_data_save(&s_pedometer_data); + if(to_nv) + { + nv_pedometer_step_data_save(&s_pedometer_data); + } + else + { + #if USE_LV_WATCH_PEDOMETER != 0 + pedometer_update_screen(); + #endif + } } void asl_pedometer_steps_clear(void) diff --git a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.h b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.h index c1816149..968ec8d9 100644 --- a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.h +++ b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_sensor_interface.h @@ -72,7 +72,11 @@ uint8_t asl_pedometer_sensor_id_get(void); void asl_pedometer_poweron_on_init(void); void asl_pedometer_steps_update(uint32_t steps); uint32_t asl_pedometer_steps_get(void); +#ifdef __MMI_ZHSX_SUPPORT__ +void asl_pedometer_steps_save(bool to_nv); +#else void asl_pedometer_steps_save(void); +#endif void asl_pedometer_steps_clear(void); void asl_pedometer_xyz_get(int16_t *x, int16_t *y, int16_t *z); diff --git a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_timing_control.c b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_timing_control.c index 6438f46a..311dd581 100644 --- a/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_timing_control.c +++ b/2.sdk/gui/lv_watch/app_adaptor/app_adaptor_timing_control.c @@ -39,7 +39,7 @@ static void timing_timer_callback(uint32_t param) s_step_clear_flag = 0; } - asl_pedometer_steps_save(); + asl_pedometer_steps_save(false); uos_timer_stop(timing_control_timer); uos_timer_start(timing_control_timer, MS_TO_TICKS(TIMING_TIMER_INTERVAL), 0, timing_timer_callback, NULL); diff --git a/2.sdk/gui/lv_watch/framework/language/lang_ch.c b/2.sdk/gui/lv_watch/framework/language/lang_ch.c index eec95d59..18c29dab 100644 --- a/2.sdk/gui/lv_watch/framework/language/lang_ch.c +++ b/2.sdk/gui/lv_watch/framework/language/lang_ch.c @@ -23,7 +23,7 @@ const void * lang_text_ch[] = { "", //reserved for WATCH_TEXT_ID_NONE /* primary_menu.c */ "设置", - "微话", + "微聊", "电话", "录音机", "拍照", 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 8b0b385b..458757d0 100644 --- a/2.sdk/gui/lv_watch/framework/nvm/ui_nvm.h +++ b/2.sdk/gui/lv_watch/framework/nvm/ui_nvm.h @@ -39,6 +39,8 @@ extern "C" { #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)) +#define NV_SECTION_UI_SOS_NUMBER_LEN (sizeof(nv_watch_sos_number_t)) + //#endif #define NV_SECTION_LEN(sectionid) (sectionid ## _LEN) @@ -122,6 +124,8 @@ typedef lv_fs_dir_t ui_dir_t; #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" +#define NV_SECTION_UI_SOS_NUMBER_FILE "ui_sos_number.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 33c0c3fe..0d157548 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 @@ -14,7 +14,7 @@ */ uint32_t UI_NV_Get_Section_Len(NV_UI_SECTION_ID SectionId) { - printf("[@CHENG_DEBUG][%s][%d]: SectionId=%d, MAX_NUM=%d\n", __FUNCTION__, __LINE__, SectionId, NV_SECTION_UI_MAX_NUM); + //printf("[@CHENG_DEBUG][%s][%d]: SectionId=%d, MAX_NUM=%d\n", __FUNCTION__, __LINE__, SectionId, NV_SECTION_UI_MAX_NUM); switch(SectionId) { case NV_SECTION_UI_SETTINGS: @@ -81,6 +81,8 @@ uint32_t UI_NV_Get_Section_Len(NV_UI_SECTION_ID SectionId) return (NV_SECTION_LEN(NV_SECTION_UI_PROTOCOL_DATA)); case NV_SECTION_UI_HEALTH_INFO: return (NV_SECTION_LEN(NV_SECTION_UI_HEALTH_INFO)); + case NV_SECTION_UI_SOS_NUMBER: + return (NV_SECTION_LEN(NV_SECTION_UI_SOS_NUMBER)); //#endif default: @@ -161,6 +163,8 @@ char * UI_NV_Get_Section_path(NV_UI_SECTION_ID SectionId) 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)); + case NV_SECTION_UI_SOS_NUMBER: + return (NV_SECTION_FILE_PATH(NV_SECTION_UI_SOS_NUMBER)); //#endif default: @@ -203,6 +207,7 @@ uint8_t UI_NV_Reset_Default(NV_UI_SECTION_ID SectionId) nv_watch_health_measure_timed_t * health_measure; nv_watch_protocol_data_t * protocol_data; nv_watch_health_info_t * health_info; + nv_watch_sos_number_t * sos_number; //#endif switch(SectionId) { @@ -357,29 +362,35 @@ uint8_t UI_NV_Reset_Default(NV_UI_SECTION_ID SectionId) //#ifdef __MMI_ZHSX_SUPPORT__ case NV_SECTION_UI_WEHAT_MSG: wechat_msg = lv_mem_alloc(SectionLen); - memset(wechat_msg, 0, SectionLen); + memset(wechat_msg, 0x0, SectionLen); TempData = (char *)wechat_msg; break; case NV_SECTION_UI_HEALTH_MEASURE: health_measure = lv_mem_alloc(SectionLen); - memset(health_measure, 0, SectionLen); + memset(health_measure, 0x0, SectionLen); mmi_health_measure_timed_info_nv_default(health_measure); TempData = (char *)health_measure; break; case NV_SECTION_UI_PROTOCOL_DATA: protocol_data = lv_mem_alloc(SectionLen); - memset(protocol_data, 0, SectionLen); + memset(protocol_data, 0x0, SectionLen); 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); + memset(health_info, 0x0, SectionLen); TempData = (char *)health_info; break; + + case NV_SECTION_UI_SOS_NUMBER: + sos_number = lv_mem_alloc(SectionLen); + memset(sos_number, 0x0, SectionLen); + TempData = (char *)sos_number; + break; //#endif default: TempData = NULL; 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 31982d8f..fde930fa 100644 --- a/2.sdk/gui/lv_watch/include/ui_nvm_interface.h +++ b/2.sdk/gui/lv_watch/include/ui_nvm_interface.h @@ -186,7 +186,7 @@ typedef struct uint32_t spo2_timed_interval; // unit-second } __packed nv_watch_health_measure_timed_t; -#define NV_WATCH_HOST_NAME_LEN_MAX (128) +#define NV_WATCH_HOST_NAME_LEN_MAX (128 - 32) typedef struct { @@ -207,6 +207,11 @@ typedef struct float body_value; } __packed nv_watch_health_info_t; +#define NV_WATCH_SOS_NUMBER_MAX (3) +typedef struct +{ + char number[NV_WATCH_SOS_NUMBER_MAX][NV_CONTACTS_MAX_NUMBER_LEN]; +} __packed nv_watch_sos_number_t; //#endif @@ -390,6 +395,7 @@ enum 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 + NV_SECTION_UI_SOS_NUMBER, // nv_watch_sos_number_t //#endif NV_SECTION_UI_MAX_NUM diff --git a/2.sdk/gui/lv_watch/include/ui_textid.h b/2.sdk/gui/lv_watch/include/ui_textid.h index fc7f0222..b2e0a8ed 100644 --- a/2.sdk/gui/lv_watch/include/ui_textid.h +++ b/2.sdk/gui/lv_watch/include/ui_textid.h @@ -25,7 +25,7 @@ enum /*primary_menu.c*/ WATCH_TEXT_ID_NONE = 0, /* reserved for LV_LANG_TXT_ID_NONE */ WATCH_TEXT_ID_SETTINGS, /* "设置" "Settings" */ - WATCH_TEXT_ID_WECHAT, /* "微话" "Wechat" */ + WATCH_TEXT_ID_WECHAT, /* "微聊" "Wechat" */ WATCH_TEXT_ID_TELEPHONE, /* "电话" "Telephone" */ WATCH_TEXT_ID_RECODER, /* "录音机" "Recorder" */ WATCH_TEXT_ID_CAMERA, /* "拍照" "Camera" */ @@ -64,7 +64,7 @@ enum WATCH_TEXT_ID_IMSVOPS, /* "VoLTE业务未开通,请检查SIM卡并且当前网络已支持VoLTE" "The volte service is not enabled,Please check the SIM card and the current network supports volte" */ /*weather.c*/ - WATCH_TEXT_ID_NO_NETWORK, /* "无法获取数据,请稍候" "No network, please wait" */ + WATCH_TEXT_ID_NO_NETWORK, /* "暂无数据,请稍候" "No network, please wait" */ WATCH_TEXT_ID_SUNNY, /* "晴" "Sunny" */ WATCH_TEXT_ID_CLOUDY, /* "多云" "Cloudy" */ WATCH_TEXT_ID_LIGHT_RAIN, /* "小雨" "Light rain" */ diff --git a/2.sdk/gui/lv_watch/lv_apps/engineer_mode/engineer_mode_main.c b/2.sdk/gui/lv_watch/lv_apps/engineer_mode/engineer_mode_main.c index 5d1ebeca..591439fb 100644 --- a/2.sdk/gui/lv_watch/lv_apps/engineer_mode/engineer_mode_main.c +++ b/2.sdk/gui/lv_watch/lv_apps/engineer_mode/engineer_mode_main.c @@ -83,12 +83,16 @@ lv_obj_t * engineer_mode_main_create(lv_obj_t * activity_obj) init_style(); lv_obj_t * title = lv_label_create(obj, NULL); - lv_obj_set_size(title, LV_HOR_RES, LV_VER_RES / 4); + lv_obj_set_size(title, LV_HOR_RES, 30); // LV_VER_RES / 4); lv_label_set_text_id(title, WATCH_TEXT_ID_ENGINEER_MODE); - lv_obj_add_style(title, LV_LABEL_PART_MAIN, &lv_watch_font30); + lv_obj_add_style(title, LV_LABEL_PART_MAIN, &lv_watch_font26); // &lv_watch_font30); lv_obj_align(title, NULL, LV_ALIGN_IN_TOP_MID, 0, 5); lv_obj_t * list = lv_list_create(obj, NULL); +#ifdef __MMI_ZHSX_SUPPORT__ + lv_watch_obj_add_element(list); + lv_watch_obj_add_element(lv_page_get_scrl(list)); +#endif lv_obj_set_size(list, LV_HOR_RES, LV_VER_RES - lv_obj_get_height(title) - 30); lv_page_set_edge_flash(list, true); lv_obj_add_style(list, LV_LIST_PART_EDGE_FLASH, &lv_watch_cont_opa1); @@ -107,6 +111,10 @@ lv_obj_t * engineer_mode_main_create(lv_obj_t * activity_obj) lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_label_set_long_mode(label, LV_LABEL_LONG_BREAK); lv_obj_set_width(label, LV_HOR_RES - 10); + #ifdef __MMI_ZHSX_SUPPORT__ + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); + lv_watch_obj_add_element(btn); + #endif } lv_obj_set_click(list, true); diff --git a/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_main.c b/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_main.c index 3dd31360..39a1fbc2 100644 --- a/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_main.c +++ b/2.sdk/gui/lv_watch/lv_apps/factory_mode/factory_mode_main.c @@ -135,9 +135,9 @@ lv_obj_t * factorymode_main_create(lv_obj_t * activity_obj) factorymode_init_testmodule(); lv_obj_t * title = lv_label_create(obj, NULL); - lv_obj_set_size(title, LV_HOR_RES, LV_VER_RES / 4); + lv_obj_set_size(title, LV_HOR_RES, 30); // LV_VER_RES / 4); lv_label_set_text_id(title, WATCH_TEXT_ID_FACTORY_MODE); - lv_obj_add_style(title, LV_LABEL_PART_MAIN, &lv_watch_font30); + lv_obj_add_style(title, LV_LABEL_PART_MAIN, &lv_watch_font26); // &lv_watch_font30); lv_obj_align(title, NULL, LV_ALIGN_IN_TOP_MID, 0, 5); lv_obj_t * list = lv_list_create(obj, NULL); @@ -164,9 +164,13 @@ lv_obj_t * factorymode_main_create(lv_obj_t * activity_obj) lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_label_set_long_mode(label, LV_LABEL_LONG_BREAK); lv_obj_set_width(label, LV_HOR_RES - 10); + #ifdef __MMI_ZHSX_SUPPORT__ + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); + #else #if USE_LV_WATCH_UI_360_360 != 0 lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font40); #endif + #endif } lv_obj_set_click(list, true); 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 e29eb684..93366058 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 @@ -249,7 +249,16 @@ void mmi_watch_reset(lv_obj_t * activity_obj) { printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); - app_adaptor_wake_up_short_time(); + //app_adaptor_wake_up_short_time(); + if(0 == Hal_Pm_Get_State()) + { + Hal_Pm_WakeUp(); + } + else + { + watch_set_lcd_status(true); + watch_wakeup_time_reset(); + } if(NULL == activity_obj) { diff --git a/2.sdk/gui/lv_watch/lv_apps/launcher/launcher.c b/2.sdk/gui/lv_watch/lv_apps/launcher/launcher.c index 5dce2925..6dab706d 100644 --- a/2.sdk/gui/lv_watch/lv_apps/launcher/launcher.c +++ b/2.sdk/gui/lv_watch/lv_apps/launcher/launcher.c @@ -692,6 +692,12 @@ static void launcher_drop_pull_leds_create(lv_obj_t * tileview) if(i == ext->old_ext.act_id.x) { lv_led_on(ext->leds[i]); lv_obj_set_size(ext->leds[i], LAUNCHER_TILEVIEW_LED_ON_WIDTH, LAUNCHER_TILEVIEW_LED_ON_WIDTH); + #ifdef __MMI_ZHSX_SUPPORT__ + #if USE_LV_WATCH_PEDOMETER != 0 + if(1 == i) // + pedometer_update_screen(); + #endif + #endif } else { lv_led_off(ext->leds[i]); lv_obj_set_size(ext->leds[i], LAUNCHER_TILEVIEW_LED_OFF_WIDTH, LAUNCHER_TILEVIEW_LED_OFF_WIDTH); diff --git a/2.sdk/gui/lv_watch/lv_apps/lowbattery/lowbattery.c b/2.sdk/gui/lv_watch/lv_apps/lowbattery/lowbattery.c index fdc1b70a..530b6828 100644 --- a/2.sdk/gui/lv_watch/lv_apps/lowbattery/lowbattery.c +++ b/2.sdk/gui/lv_watch/lv_apps/lowbattery/lowbattery.c @@ -67,7 +67,9 @@ void lowbattery_task(lv_task_t * task) // enter low battery mode printf("enter low battery mode\n"); lowbattery_create_btn_action(NULL); + #if USE_LV_WATCH_AUDIO_PLAYER != 0 audio_player_lowbattery_process(); + #endif } else { // update time if(NULL == lv_watch_get_activity_obj(ACT_ID_PHONE)) { diff --git a/2.sdk/gui/lv_watch/lv_apps/pedometer/bodyinfo.c b/2.sdk/gui/lv_watch/lv_apps/pedometer/bodyinfo.c index ee1684d0..63c91cf4 100644 --- a/2.sdk/gui/lv_watch/lv_apps/pedometer/bodyinfo.c +++ b/2.sdk/gui/lv_watch/lv_apps/pedometer/bodyinfo.c @@ -84,7 +84,7 @@ lv_obj_t * bodyinfo_create(lv_obj_t * tileview, uint16_t id) lv_obj_t * label_height = lv_label_create(btn_height, NULL); lv_label_set_text_id(label_height, WATCH_TEXT_ID_BODY_HEIGHT); - lv_obj_add_style(label_height, LV_LABEL_PART_MAIN, &lv_watch_font20_gray); + lv_obj_add_style(label_height, LV_LABEL_PART_MAIN, &lv_watch_font26_gray); // &lv_watch_font20_gray); lv_obj_set_click(label_height, false); lv_obj_t * label_height_v = lv_label_create(btn_height, NULL); @@ -94,7 +94,7 @@ lv_obj_t * bodyinfo_create(lv_obj_t * tileview, uint16_t id) strcat(str, TEXT_CM); lv_label_set_text(label_height_v, str); lv_watch_set_free_ptr(label_height, TEXT_CM); - lv_obj_add_style(label_height_v, LV_LABEL_PART_MAIN, &lv_watch_font20); + lv_obj_add_style(label_height_v, LV_LABEL_PART_MAIN, &lv_watch_font26); // &lv_watch_font20); lv_label_set_align(label_height_v, LV_LABEL_ALIGN_LEFT); lv_label_set_align(label_height_v, LV_LABEL_ALIGN_LEFT); @@ -110,7 +110,7 @@ lv_obj_t * bodyinfo_create(lv_obj_t * tileview, uint16_t id) lv_obj_t * label_weight = lv_label_create(btn_weight, NULL); lv_label_set_text_id(label_weight, WATCH_TEXT_ID_BODY_WEIGHT); - lv_obj_add_style(label_weight, LV_LABEL_PART_MAIN, &lv_watch_font20_gray); + lv_obj_add_style(label_weight, LV_LABEL_PART_MAIN, &lv_watch_font26_gray); // &lv_watch_font20_gray); lv_obj_t * label_weight_v = lv_label_create(btn_weight, label_height_v); memset(str, 0, 16); @@ -131,7 +131,7 @@ lv_obj_t * bodyinfo_create(lv_obj_t * tileview, uint16_t id) lv_obj_t * label_goal = lv_label_create(btn_goal, NULL); lv_label_set_text_id(label_goal, WATCH_TEXT_ID_GOAL); lv_watch_set_free_ptr(label_goal, TEXT_STEP); - lv_obj_add_style(label_goal, LV_LABEL_PART_MAIN, &lv_watch_font20_gray); + lv_obj_add_style(label_goal, LV_LABEL_PART_MAIN, &lv_watch_font26_gray); // &lv_watch_font20_gray); lv_obj_t * label_goal_v = lv_label_create(btn_goal, label_height_v); memset(str, 0, 16); @@ -235,15 +235,6 @@ static void setting_btn_event_cb(lv_obj_t * obj, lv_event_t e) ext->label = lv_obj_get_child(obj, NULL); num = lv_obj_get_user_data(obj).user_num; - - #if 1 //CHENG_MODIFY - if(0 == num || 1 == num || 2 == num) - { - sel_value = get_value_from_btn(obj); - } - - #else - if(num == 0) { ext->height = get_value_from_btn(obj); ext->weight = get_value_from_btn(lv_obj_get_child_back(lv_obj_get_parent(obj), obj)); @@ -260,7 +251,6 @@ static void setting_btn_event_cb(lv_obj_t * obj, lv_event_t e) ext->step = get_value_from_btn(obj); sel_value = ext->step; } - #endif // printf("num = %d height = %d w = %d g = %d\n", num,ext->height, ext->weight, ext->step); roller_create(child_obj, num, sel_value); @@ -318,8 +308,10 @@ static lv_obj_t * roller_create(lv_obj_t * par, uint8_t type, uint16_t sel_value lv_obj_set_style_local_bg_opa(roller, LV_ROLLER_PART_BG, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_text_line_space(roller, LV_ROLLER_PART_BG, LV_STATE_DEFAULT, 20); lv_obj_set_style_local_text_color(roller, LV_ROLLER_PART_BG, LV_STATE_DEFAULT, LV_COLOR_GRAY); + lv_obj_set_style_local_text_font(roller, LV_ROLLER_PART_BG, LV_STATE_DEFAULT, LV_THEME_WATCH_NIGHT_FONT_26); lv_obj_set_style_local_bg_opa(roller, LV_ROLLER_PART_SELECTED, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_text_line_space(roller, LV_ROLLER_PART_SELECTED, LV_STATE_DEFAULT, 20); + lv_obj_set_style_local_text_font(roller, LV_ROLLER_PART_SELECTED, LV_STATE_DEFAULT, LV_THEME_WATCH_NIGHT_FONT_26); lv_roller_set_options(roller, roller_opt, LV_ROLLER_MODE_NORMAL); lv_roller_set_visible_row_count(roller, 3); @@ -335,7 +327,7 @@ static lv_obj_t * roller_create(lv_obj_t * par, uint8_t type, uint16_t sel_value else lv_obj_align(label, cont, LV_ALIGN_OUT_RIGHT_MID, 0, 0); lv_label_set_text(label, text); - lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font20_gray); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26_gray); // &lv_watch_font20_gray); lv_watch_tabview_add_element(roller); ext->info_label = label; return cont; diff --git a/2.sdk/gui/lv_watch/lv_apps/pedometer/pedometer.c b/2.sdk/gui/lv_watch/lv_apps/pedometer/pedometer.c index f90f320b..ca95d3ca 100644 --- a/2.sdk/gui/lv_watch/lv_apps/pedometer/pedometer.c +++ b/2.sdk/gui/lv_watch/lv_apps/pedometer/pedometer.c @@ -10,6 +10,236 @@ #if USE_LV_WATCH_PEDOMETER!= 0 +#ifdef __MMI_ZHSX_SUPPORT__ + +static uint16_t pedometer_goalsteps = 10000; + + +#define PEDOMETER_DEF_ANGLE 5000 +#define PEDOMETER_CIRCLE_START 340 +#define PEDOMETER_CIRCLE_END 3300 +#define PEDOMETER_CIRCLE_R 100 +#define PEDOMETER_CIRCLE_R_OFFSET 1 + + +uint16_t pedometer_get_steps(void) +{ + return asl_pedometer_steps_get(); +} + +void pedometer_set_goalsteps(uint16_t goal) +{ + pedometer_goalsteps = goal; +} + +uint16_t pedometer_get_goalsteps(void) +{ + return pedometer_goalsteps; +} + +lv_pedometer_ext_t * pedometer_get_ext(void) +{ + lv_pedometer_ext_t * ext = NULL; + lv_obj_t * tab = NULL; + lv_obj_t * obj = lv_watch_get_activity_obj(ACT_ID_PEDOMETER); + if(obj) { + lv_obj_t * tileview = lv_obj_get_child_back(obj, NULL); + lv_obj_t * scrl = lv_page_get_scrl(tileview); + tab = lv_obj_get_child(scrl, lv_obj_get_child(scrl, NULL)); + } + if(tab) + ext = lv_obj_get_ext_attr(tab); + + return ext; +} + +static int16_t pedometer_set_value(lv_obj_t * pedometer) +{ + uint16_t steps = pedometer_get_steps(); + uint16_t goal_steps = pedometer_get_goalsteps(); + float delta = (float)steps / goal_steps; + int16_t val = delta * (PEDOMETER_CIRCLE_END - PEDOMETER_CIRCLE_START) + PEDOMETER_CIRCLE_START; + + if(val < PEDOMETER_CIRCLE_START) + val = PEDOMETER_CIRCLE_START; + if(val > PEDOMETER_CIRCLE_END) + val = PEDOMETER_CIRCLE_END; + + printf("[@CHENG_DEBUG][%s][%d]: %d,%d,%d\n", __FUNCTION__, __LINE__, steps, goal_steps, val); + lv_img_set_angle(pedometer, val); + return val; +} + +static lv_obj_t * digital_content_create(lv_obj_t * par, int16_t level, uint8_t first_time) +{ + lv_obj_t * par_obj = NULL; + + if(first_time) + { + lv_obj_t * content = lv_watch_cont_create(par, LV_LAYOUT_ROW_MID, &lv_style_transp_fit, lv_obj_get_width(par)); + lv_cont_set_fit2(content, LV_FIT_TIGHT, LV_FIT_TIGHT); + lv_obj_align(content, par, LV_ALIGN_CENTER, 0, 0); + par_obj = content; + } + else + { + par_obj = par; + } + lv_cont_set_layout(par_obj, LV_LAYOUT_OFF); + + char str[10] = ""; + snprintf(str, sizeof(str), "%d", level); + + const void * digitalSrcList[] = { + ICON_PEDOMETER_DIGITAL_0, + ICON_PEDOMETER_DIGITAL_1, + ICON_PEDOMETER_DIGITAL_2, + ICON_PEDOMETER_DIGITAL_3, + ICON_PEDOMETER_DIGITAL_4, + ICON_PEDOMETER_DIGITAL_5, + ICON_PEDOMETER_DIGITAL_6, + ICON_PEDOMETER_DIGITAL_7, + ICON_PEDOMETER_DIGITAL_8, + ICON_PEDOMETER_DIGITAL_9, + }; + + for(int8_t i = 0; i < strlen(str); i++) { + lv_obj_t * img = lv_img_create(par_obj, NULL); + LV_ASSERT_MEM(img); + if(img == NULL) return NULL; + lv_img_set_src(img, digitalSrcList[str[i] - '0']); + lv_obj_align(img, NULL, LV_ALIGN_IN_TOP_LEFT, i * (lv_obj_get_width(img) + 5), 0); + } + + return par_obj; +} + +void pedometer_update_screen(void) +{ + lv_drop_pull_obj_ext_t * ext = NULL; + +#if USE_LV_WATCH_LAUNCHER != 0 + ext = launcher_get_pull_ext(); +#endif + if(NULL == ext) + return; + + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + + lv_obj_t * label = ext->pedometer_goal; + char str[10] = ""; + snprintf(str, sizeof(str), "%d", pedometer_get_goalsteps()); + lv_label_set_text(label, str); + + lv_obj_t * pedometer = ext->pedometer_dot; + pedometer_set_value(pedometer); + + lv_obj_t * pedometer_cont = ext->pedometer_cont; + lv_obj_clean(pedometer_cont); + digital_content_create(pedometer_cont, pedometer_get_steps(), 0); +} + +void pedometer_update_goal(uint16_t goal) +{ + pedometer_set_goalsteps(goal); +} + +lv_obj_t * pedometer_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; + } + + lv_obj_t * img_color_circle = lv_img_create(tab, NULL); + LV_ASSERT_MEM(img_color_circle); + if(img_color_circle == NULL) return NULL; + lv_img_set_src(img_color_circle, ICON_COLOR_CIRCLE); + lv_obj_add_style(img_color_circle, LV_IMG_PART_MAIN, &lv_watch_image); +#if USE_LV_WATCH_UI_240_320 + lv_obj_set_y(img_color_circle, 30); +#else + lv_obj_align(img_color_circle, tab, LV_ALIGN_CENTER, 0, 0); +#endif + + lv_obj_t * pedometer = lv_img_create(img_color_circle, NULL); + lv_img_set_src(pedometer, ICON_STEP_DOT); + +#if USE_LV_WATCH_UI_240_320 + lv_obj_set_pos(pedometer, LV_HOR_RES / 2 - lv_obj_get_width(pedometer) / 2, + 120 + 100 - lv_obj_get_height(pedometer) / 2); +#else + lv_obj_set_pos(pedometer, LV_HOR_RES / 2 - lv_obj_get_width(pedometer) / 2, + LV_VER_RES / 2 + 100 - lv_obj_get_height(pedometer) / 2); +#endif + lv_img_set_pivot(pedometer, lv_obj_get_width(pedometer) / 2, + - (PEDOMETER_CIRCLE_R - lv_obj_get_width(pedometer) / 2 + PEDOMETER_CIRCLE_R_OFFSET)); + + lv_obj_t * content = lv_watch_cont_create(img_color_circle, LV_LAYOUT_COLUMN_MID, &lv_style_transp_fit, lv_obj_get_width(img_color_circle)); + + lv_obj_t * label = lv_label_create(content, NULL); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26); + lv_label_set_text_id(label, WATCH_TEXT_ID_TODAY); + lv_obj_set_click(label, false); + +#if USE_LV_WATCH_BODYINFO != 0 + nv_watch_pedometer_setting_t pedo; + memset(&pedo, 0, sizeof(nv_watch_pedometer_setting_t)); + bodyinfo_init(&pedo); + pedometer_set_goalsteps(pedo.goal); +#endif + + pedometer_set_value(pedometer); + + lv_obj_t * digital_content = digital_content_create(content, pedometer_get_steps(), 1); + + label = lv_label_create(content, NULL); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26); + lv_label_set_text_id(label, WATCH_TEXT_ID_STEPS); + lv_obj_set_click(label, false); + + lv_obj_t * img = lv_img_create(content, NULL); + LV_ASSERT_MEM(img); + if(img == NULL) return NULL; + lv_img_set_src(img, ICON_FLAG); + + label = lv_label_create(content, NULL); + lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font30); + char str[10] = ""; + snprintf(str, sizeof(str), "%d", pedometer_get_goalsteps()); + lv_label_set_text(label, str); + lv_obj_set_click(label, false); + + lv_obj_align(content, NULL, LV_ALIGN_CENTER, 0, 15); + +#if USE_LV_WATCH_LAUNCHER != 0 + lv_drop_pull_obj_ext_t * ext = launcher_get_pull_ext(); + if(NULL != ext) + { + ext->pedometer_dot = pedometer; + ext->pedometer_cont = digital_content; + ext->pedometer_goal = label; + } +#endif + + lv_tileview_add_element(tileview, pedometer); + lv_tileview_add_element(tileview, img_color_circle); + lv_tileview_add_element(tileview, content); + lv_obj_set_click(img_color_circle, false); + lv_obj_set_click(content, false); + lv_obj_set_click(pedometer, false); + + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + + return tab; +} + +#else + #include /********************* @@ -64,22 +294,12 @@ lv_obj_t * pedometer_create(lv_obj_t * tileview, uint16_t id) if(img_color_circle == NULL) return NULL; lv_img_set_src(img_color_circle, ICON_COLOR_CIRCLE); lv_obj_add_style(img_color_circle, LV_IMG_PART_MAIN, &lv_watch_image); -#if USE_LV_WATCH_UI_240_320 - lv_obj_set_y(img_color_circle, 30); -#else lv_obj_align(img_color_circle, tab, LV_ALIGN_CENTER, 0, 0); -#endif lv_obj_t * pedometer = lv_img_create(img_color_circle, NULL); lv_img_set_src(pedometer, ICON_STEP_DOT); - -#if USE_LV_WATCH_UI_240_320 - lv_obj_set_pos(pedometer, LV_HOR_RES / 2 - lv_obj_get_width(pedometer) / 2, - 120 + 100 - lv_obj_get_height(pedometer) / 2); -#else lv_obj_set_pos(pedometer, LV_HOR_RES / 2 - lv_obj_get_width(pedometer) / 2, LV_VER_RES / 2 + 100 - lv_obj_get_height(pedometer) / 2); -#endif lv_img_set_pivot(pedometer, lv_obj_get_width(pedometer) / 2, - (PEDOMETER_CIRCLE_R - lv_obj_get_width(pedometer) / 2 + PEDOMETER_CIRCLE_R_OFFSET)); @@ -291,5 +511,6 @@ static lv_obj_t * digital_content_create(lv_obj_t * par, int16_t level, uint8_t } return par_obj; } +#endif #endif /*USE_LV_WATCH_PEDOMETER*/ diff --git a/2.sdk/gui/lv_watch/lv_apps/pedometer/pedometer.h b/2.sdk/gui/lv_watch/lv_apps/pedometer/pedometer.h index 1cc35ecf..80c699b4 100644 --- a/2.sdk/gui/lv_watch/lv_apps/pedometer/pedometer.h +++ b/2.sdk/gui/lv_watch/lv_apps/pedometer/pedometer.h @@ -52,6 +52,20 @@ typedef struct { /********************** * GLOBAL PROTOTYPES **********************/ + +#ifdef __MMI_ZHSX_SUPPORT__ +lv_obj_t * pedometer_create(lv_obj_t * tileview, uint16_t id); +lv_obj_t * bodyinfo_create(lv_obj_t * tileview, uint16_t id); +#if USE_LV_WATCH_RECORD!= 0 +lv_obj_t * record_create(lv_obj_t * tileview, uint16_t id); +#endif +void bodyinfo_init(nv_watch_pedometer_setting_t* pedo_set); +uint16_t pedometer_get_goalsteps(void); +uint16_t pedometer_get_steps(void); +void pedometer_update_goal(uint16_t goal); +void pedometer_update_screen(void); +#else + lv_obj_t * pedometer_create(lv_obj_t * tileview, uint16_t id); lv_obj_t * bodyinfo_create(lv_obj_t * tileview, uint16_t id); lv_obj_t * record_create(lv_obj_t * tileview, uint16_t id); @@ -62,6 +76,7 @@ uint16_t pedometer_get_steps(void); void pedometer_update_goal(uint16_t goal); void pedometer_update_steps(uint16_t steps); void bodyinfo_init(nv_watch_pedometer_setting_t* pedo_set); +#endif /********************** * MACROS diff --git a/2.sdk/gui/lv_watch/lv_apps/phonebook/phonebook.c b/2.sdk/gui/lv_watch/lv_apps/phonebook/phonebook.c index 3d7e9625..c4ef6847 100644 --- a/2.sdk/gui/lv_watch/lv_apps/phonebook/phonebook.c +++ b/2.sdk/gui/lv_watch/lv_apps/phonebook/phonebook.c @@ -744,11 +744,11 @@ static void phonebook_add_btn(lv_obj_t * obj, char * phone_name, char * phone_nu static void phonebook_no_contacts_or_network_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_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_CONTACTS_OR_NETWORK); + lv_label_set_text_id(label, WATCH_TEXT_ID_NO_CONTACTS); // WATCH_TEXT_ID_NO_CONTACTS_OR_NETWORK); lv_obj_align(label, obj, LV_ALIGN_CENTER, 0, 0); return; 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 a7d8501e..11344304 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 @@ -39,7 +39,9 @@ static watch_app_info_t s_primary_grid_menu[] = #endif { ICON_VIDEOCALL, WATCH_TEXT_ID_VIDEOCALL, videocallmain_create }, +#if USE_LV_WATCH_AUDIO_PLAYER != 0 { ICON_MUSIC, WATCH_TEXT_ID_AUDIO_PLAYER, audio_player_create_event_cb }, +#endif { ICON_ALARM, WATCH_TEXT_ID_ALARM, alarm_create_event_cb }, { ICON_STOPWATCH, WATCH_TEXT_ID_STOPWATCH, stopwatch_create_event_cb }, { ICON_TIMER, WATCH_TEXT_ID_TIMER, timer_create_event_cb }, 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 7652e8b8..e9491eb5 100644 --- a/2.sdk/gui/lv_watch/lv_apps/qrcode/qrcode.c +++ b/2.sdk/gui/lv_watch/lv_apps/qrcode/qrcode.c @@ -118,7 +118,7 @@ static lv_obj_t * qrcode_create_content(lv_obj_t * par) 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); + lv_obj_align(label, content, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); #else /*cid.txt read from nvm*/ diff --git a/2.sdk/gui/lv_watch/lv_apps/restart_and_reset/restart_and_reset.c b/2.sdk/gui/lv_watch/lv_apps/restart_and_reset/restart_and_reset.c index fa45ce0a..aa460355 100644 --- a/2.sdk/gui/lv_watch/lv_apps/restart_and_reset/restart_and_reset.c +++ b/2.sdk/gui/lv_watch/lv_apps/restart_and_reset/restart_and_reset.c @@ -84,7 +84,7 @@ lv_obj_t * restart_and_reset_create(lv_obj_t * activity_obj) lv_img_set_src(img_restart, ICON_SETTING_REBOOT); label_restart = lv_label_create(btn_restart, NULL); - lv_obj_add_style(label_restart, LV_LABEL_PART_MAIN, &lv_watch_font20); + lv_obj_add_style(label_restart, LV_LABEL_PART_MAIN, &lv_watch_font26); // &lv_watch_font20); lv_label_set_text_id(label_restart, WATCH_TEXT_ID_RESTART); @@ -96,18 +96,18 @@ lv_obj_t * restart_and_reset_create(lv_obj_t * activity_obj) lv_img_set_src(img_reset, ICON_SETTING_RESTORE); label_reset = lv_label_create(btn_reset, NULL); - lv_obj_add_style(label_reset, LV_LABEL_PART_MAIN, &lv_watch_font20); + lv_obj_add_style(label_reset, LV_LABEL_PART_MAIN, &lv_watch_font26); // &lv_watch_font20); lv_label_set_text_id(label_reset, WATCH_TEXT_ID_FACTORY_RESET); lv_label_set_long_mode(label_reset, LV_LABEL_LONG_BREAK); lv_obj_set_width(label_reset, LV_HOR_RES * 2 / 3); if(lv_obj_get_base_dir(obj) == LV_BIDI_DIR_RTL){ - lv_obj_align(btn_restart, obj, LV_ALIGN_CENTER, 20, -20); - lv_obj_align(btn_reset, btn_restart, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, 10); + lv_obj_align(btn_restart, obj, LV_ALIGN_CENTER, 20, -40); // -20); + lv_obj_align(btn_reset, btn_restart, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, 30); // 10); } else { - lv_obj_align(btn_restart, obj, LV_ALIGN_CENTER, -20, -20); - lv_obj_align(btn_reset, btn_restart, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10); + lv_obj_align(btn_restart, obj, LV_ALIGN_CENTER, -20, -40); // -20); + lv_obj_align(btn_reset, btn_restart, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 30); // 10); } return obj; @@ -355,6 +355,16 @@ void restart_no_btn_action(lv_obj_t * btn, lv_event_t event) #ifdef __MMI_ZHSX_SUPPORT__ void mmi_watch_restart(void) { + //app_adaptor_wake_up_short_time(); + if(0 == Hal_Pm_Get_State()) + { + Hal_Pm_WakeUp(); + } + else + { + watch_set_lcd_status(true); + watch_wakeup_time_reset(); + } lv_watch_go_home(); #if USE_LV_BLUETOOTH != 0 bt_power_off(); diff --git a/2.sdk/gui/lv_watch/lv_apps/setting/setting_about.c b/2.sdk/gui/lv_watch/lv_apps/setting/setting_about.c index 0ba1fdb2..18146f0a 100644 --- a/2.sdk/gui/lv_watch/lv_apps/setting/setting_about.c +++ b/2.sdk/gui/lv_watch/lv_apps/setting/setting_about.c @@ -96,12 +96,12 @@ static lv_obj_t * setting_about_create(lv_obj_t * activity_obj) lv_obj_align(title_label, content, LV_ALIGN_IN_TOP_MID, 0, 10); lv_obj_t * model_label = lv_label_create(content, NULL); - lv_obj_add_style(model_label, LV_LABEL_PART_MAIN, &lv_watch_font20); + lv_obj_add_style(model_label, LV_LABEL_PART_MAIN, &lv_watch_font26); // &lv_watch_font20); lv_label_set_align(model_label, LV_LABEL_ALIGN_CENTER); lv_obj_set_click(model_label, false); lv_obj_t * version_label = lv_label_create(content, NULL); - lv_obj_add_style(version_label, LV_LABEL_PART_MAIN, &lv_watch_font20); + lv_obj_add_style(version_label, LV_LABEL_PART_MAIN, &lv_watch_font26); // &lv_watch_font20); lv_label_set_align(version_label, LV_LABEL_ALIGN_CENTER); lv_obj_set_click(version_label, false); lv_obj_set_base_dir(version_label, LV_BIDI_DIR_LTR); @@ -111,7 +111,7 @@ static lv_obj_t * setting_about_create(lv_obj_t * activity_obj) #if USE_LV_WATCH_ALIPAY != 0 lv_obj_t * labelId2 = lv_label_create(content, NULL); - lv_obj_add_style(labelId2,LV_OBJ_PART_MAIN, &lv_watch_font20); + lv_obj_add_style(labelId2,LV_OBJ_PART_MAIN, &lv_watch_font26); // &lv_watch_font20); lv_obj_set_click(labelId2, false); lv_obj_align(labelId2, content, LV_ALIGN_OUT_BOTTOM_MID, -10, -40); @@ -128,7 +128,7 @@ static lv_obj_t * setting_about_create(lv_obj_t * activity_obj) lv_label_set_text(model_label, model_str); lv_obj_align(model_label, content, LV_ALIGN_IN_TOP_MID, 0, 80); lv_label_set_text(version_label, version_str); - lv_obj_align(version_label, content, LV_ALIGN_IN_TOP_MID, 0, 105); + lv_obj_align(version_label, content, LV_ALIGN_IN_TOP_MID, 0, 110); // 105); lv_obj_set_event_cb(content, setting_about_click_event_cb); lv_watch_obj_add_element(content); diff --git a/2.sdk/gui/lv_watch/lv_apps/setting/setting_date_time.c b/2.sdk/gui/lv_watch/lv_apps/setting/setting_date_time.c index d4608845..b33c0d34 100644 --- a/2.sdk/gui/lv_watch/lv_apps/setting/setting_date_time.c +++ b/2.sdk/gui/lv_watch/lv_apps/setting/setting_date_time.c @@ -114,7 +114,7 @@ lv_obj_t * setting_date_time_create(lv_obj_t * activity_obj) lv_obj_add_style(btn_date, LV_BTN_PART_MAIN, &lv_style_transp_fit); lv_btn_set_fit2(btn_date, LV_FIT_NONE, LV_FIT_TIGHT); lv_btn_set_layout(btn_date, LV_LAYOUT_OFF); - lv_obj_set_width(btn_date, LV_HOR_RES * 3 / 5); + lv_obj_set_width(btn_date, LV_HOR_RES * 7 / 10); // LV_HOR_RES * 3 / 5); lv_obj_set_event_cb(btn_date, date_time_set_btn_action); lv_obj_add_protect(btn_date, LV_PROTECT_PRESS_LOST); lv_watch_obj_add_element(btn_date); @@ -129,16 +129,17 @@ lv_obj_t * setting_date_time_create(lv_obj_t * activity_obj) lv_obj_t * img_date = lv_img_create(cont_date, NULL); lv_img_set_src(img_date, ICON_DATE); - lv_obj_set_pos(img_date, 0, 0); + lv_obj_set_x(img_date, 0); // lv_obj_set_pos(img_date, 0, 0); lv_obj_t * label_setdate = lv_label_create(cont_date, title); lv_label_set_text_id(label_setdate, WATCH_TEXT_ID_DATE_SETTING); + lv_obj_add_style(label_setdate, LV_LABEL_PART_MAIN, &lv_watch_font26_gray); ext->label_date = lv_label_create(btn_date, NULL); memset(time_str, 0, SETTING_TIME_STR_LENGTH); snprintf(time_str, SETTING_TIME_STR_LENGTH, "%d-%02d-%02d", time.tm_year, time.tm_mon, time.tm_mday); lv_label_set_text(ext->label_date, time_str); - lv_obj_add_style(ext->label_date, LV_LABEL_PART_MAIN, &lv_watch_font20); + lv_obj_add_style(ext->label_date, LV_LABEL_PART_MAIN, &lv_watch_font26); // &lv_watch_font20); if(lv_obj_get_base_dir(cont_date) == LV_BIDI_DIR_RTL) lv_obj_align(ext->label_date, label_setdate, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, 10); else @@ -153,10 +154,11 @@ lv_obj_t * setting_date_time_create(lv_obj_t * activity_obj) lv_obj_set_width(cont_time, lv_obj_get_width(btn_time)); lv_obj_t * img_time = lv_img_create(cont_time, NULL); lv_img_set_src(img_time, ICON_TIME); - lv_obj_set_pos(img_time, 0, 0); + lv_obj_set_x(img_time, 0); // lv_obj_set_pos(img_time, 0, 0); lv_obj_t * label_settime = lv_label_create(cont_time, title); lv_label_set_text_id(label_settime, WATCH_TEXT_ID_TIME_SETTING); + lv_obj_add_style(label_settime, LV_LABEL_PART_MAIN, &lv_watch_font26_gray); ext->label_time = lv_label_create(btn_time, ext->label_date); lv_obj_set_base_dir(ext->label_time, LV_BIDI_DIR_LTR); 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 aa9404fb..38c75827 100644 --- a/2.sdk/gui/lv_watch/lv_apps/shutdown/shutdown.c +++ b/2.sdk/gui/lv_watch/lv_apps/shutdown/shutdown.c @@ -218,7 +218,16 @@ void mmi_watch_power_off(void) { printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); - app_adaptor_wake_up_short_time(); + //app_adaptor_wake_up_short_time(); + if(0 == Hal_Pm_Get_State()) + { + Hal_Pm_WakeUp(); + } + else + { + watch_set_lcd_status(true); + watch_wakeup_time_reset(); + } 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 28d6f17a..017da86b 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 @@ -286,6 +286,11 @@ 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); + //for(uint8_t i = 0; i < strlen(sms_info->data); i++) + //{ + // printf("[@CHENG_DEBUG][%s][%d]: %d,%d\n", __FUNCTION__, __LINE__, i, sms_info->data[i]); + //} + #ifdef __MMI_ZHSX_SUPPORT_SMS__ if(true == mmi_protocol_sms_content_parse(sms_info->data, sms_info->number)) { diff --git a/2.sdk/gui/lv_watch/lv_apps/sos/sos.c b/2.sdk/gui/lv_watch/lv_apps/sos/sos.c index f8fcbd12..6837566c 100644 --- a/2.sdk/gui/lv_watch/lv_apps/sos/sos.c +++ b/2.sdk/gui/lv_watch/lv_apps/sos/sos.c @@ -10,6 +10,263 @@ #if USE_LV_WATCH_SOS != 0 +#ifdef __MMI_ZHSX_SUPPORT__ + +static uint8_t s_sos_state = SOS_OFF; +static nv_watch_sos_number_t s_sos_number = {0}; +static uint8_t s_sos_dial_index = 0; + + +void mmi_sos_number_nv_write(void) +{ + uint32_t nv_data_length = sizeof(nv_watch_sos_number_t); + + if(nv_data_length != UI_NV_Write_Req(NV_SECTION_UI_SOS_NUMBER, 0, nv_data_length, (uint8_t *)&s_sos_number)) + { + printf("[@CHENG_DEBUG][%s][%d]: nv write fail\n", __FUNCTION__, __LINE__); + } +} + +void mmi_sos_number_nv_read(void) +{ + uint32_t nv_data_length = sizeof(nv_watch_sos_number_t); + + if(nv_data_length != UI_NV_Read_Req(NV_SECTION_UI_SOS_NUMBER, 0, nv_data_length, (uint8_t *)&s_sos_number)) + { + printf("[@CHENG_DEBUG][%s][%d]: nv read fail\n", __FUNCTION__, __LINE__); + } +} + +void mmi_sos_number_set(nv_watch_sos_number_t * sos_number) +{ + _lv_memcpy(&s_sos_number, sos_number, sizeof(nv_watch_sos_number_t)); + + mmi_sos_number_nv_write(); +} + +bool mmi_sos_number_is_empty(void) +{ + uint8_t i = 0; + + for(i = 0; i < NV_WATCH_SOS_NUMBER_MAX; i++) + { + printf("[@CHENG_DEBUG][%s][%d]: %s\n", __FUNCTION__, __LINE__, s_sos_number.number[i]); + } + + for(i = 0; i < NV_WATCH_SOS_NUMBER_MAX; i++) + { + if(0 != strlen(s_sos_number.number[i])) + return false; + } + + return true; +} + +uint8_t get_sos_status(void) +{ + return s_sos_state; +} + +static void set_sos_status(uint8_t state) +{ + s_sos_state = state; +} + +void sos_destory(void) +{ + if(SOS_GIF_ON == get_sos_status()) + { + lv_watch_png_cache_all_free(); + lv_sos_ext_t * ext = lv_obj_get_ext_attr(lv_watch_get_activity_obj(ACT_ID_SOS)); + gif_close(ext->gif_info); + ext->gif_info = NULL; + lv_task_del(ext->gif_task_p); + lv_obj_del(lv_watch_get_activity_obj(ACT_ID_SOS)); + } +} + +static void sos_do_dailing_next(void) +{ + bool is_continue = false; + + s_sos_dial_index++; + while(s_sos_dial_index < NV_WATCH_SOS_NUMBER_MAX) + { + if(0 != strlen(s_sos_number.number[s_sos_dial_index])) + { + is_continue = true; + break; + } + + s_sos_dial_index++; + } + + if(true == is_continue) + { + char * number = (char *)lv_mem_alloc(NV_CONTACTS_MAX_NUMBER_LEN); + if(NULL != number) + { + _lv_memcpy(number, s_sos_number.number[s_sos_dial_index], NV_CONTACTS_MAX_NUMBER_LEN); + phone_voice_call_req(number); + } + } +} + +static void sos_dialing_delay_task(lv_task_t * task) +{ + sos_phone_status_t status = (sos_phone_status_t)(uint32_t)task->user_data;; + + printf("[@CHENG_DEBUG][%s][%d]: %d,%d\n", __FUNCTION__, __LINE__, status, get_sos_status()); + + if(SOS_DIALING_ON == get_sos_status()) + { + if(SOS_PHONE_DIAL_SUCCESS == status) + { + sos_destory(); + } + else + { + sos_do_dailing_next(); + } + } +} + +void sos_phone_dailing_status_ind(sos_phone_status_t status) +{ + lv_task_once(lv_task_create(sos_dialing_delay_task, 10, LV_TASK_PRIO_MID, (void *)(unsigned long)status)); +} + +static void sos_task(lv_task_t * task) +{ + gif_info_t * info = (gif_info_t *)task->user_data; + + if(info->once_done) + { + sos_destory(); + set_sos_status(SOS_DIALING_ON); + + while(s_sos_dial_index < NV_WATCH_SOS_NUMBER_MAX) + { + if(0 != strlen(s_sos_number.number[s_sos_dial_index])) + break; + + s_sos_dial_index++; + } + + char * number = (char *)lv_mem_alloc(NV_CONTACTS_MAX_NUMBER_LEN); + if(NULL != number) + { + _lv_memcpy(number, s_sos_number.number[s_sos_dial_index], NV_CONTACTS_MAX_NUMBER_LEN); + phone_voice_call_req(number); + } + } +} + +static void sos_no_contacts_prepare_destory(lv_obj_t * activity_obj) +{ + lv_watch_png_cache_all_free(); +} + +static lv_obj_t * sos_no_contacts_create(lv_obj_t * activity_obj) +{ + if(NULL == activity_obj) + { + lv_watch_activity_ext_t activity_ext; + memset(&activity_ext, 0, sizeof(lv_watch_activity_ext_t)); + activity_ext.actId = ACT_ID_NO_CONTACTS_OR_NETWORK; + activity_ext.create = sos_no_contacts_create; + activity_ext.prepare_destory = sos_no_contacts_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_obj_t * label = lv_label_create(obj, NULL); + lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font26); + 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_CONTACTS); + lv_obj_align(label, obj, LV_ALIGN_CENTER, 0, 0); + + return obj; +} + +lv_obj_t * sos_create(lv_obj_t * activity_obj) +{ + if(true == mmi_sos_number_is_empty()) + { + activity_obj = sos_no_contacts_create(NULL); + return activity_obj; + } + + lv_watch_activity_ext_t activity_ext; + memset(&activity_ext, 0, sizeof(lv_watch_activity_ext_t)); + activity_ext.actId = ACT_ID_SOS; + activity_ext.create = sos_create; + activity_ext.prepare_destory = NULL; + activity_obj = lv_watch_creat_activity_obj(&activity_ext); + if(activity_obj == NULL) + return NULL; + + set_sos_status(SOS_GIF_ON); + lv_sos_ext_t * ext = lv_obj_allocate_ext_attr(activity_obj, sizeof(lv_sos_ext_t)); + if(ext == NULL) + return NULL; + + lv_obj_set_style_local_bg_color(activity_obj, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + + lv_obj_t * gif_cont = lv_cont_create(activity_obj, NULL); + lv_obj_set_size(gif_cont, LV_HOR_RES, 240); + lv_obj_align(gif_cont, NULL, LV_ALIGN_IN_TOP_MID, 0, (LV_VER_RES - 240) / 2); + + ext->gif_info = gif_open(gif_cont, ANIM_SOS, 1); + if(!ext->gif_info) + return activity_obj; + + s_sos_dial_index = 0; + ext->gif_task_p = lv_task_create(sos_task, 100, LV_TASK_PRIO_MID, (void *)ext->gif_info); + + app_adaptor_send_sos_info_req(); + + return activity_obj; +} + +lv_res_t sos_btn_action(lv_obj_t * btn) +{ + (void)btn; + + lv_obj_t * phone_obj = lv_watch_get_activity_obj(ACT_ID_PHONE); + if(phone_obj) + { + /* don't process sos or shutdown */ + return LV_RES_OK; + } + + if(false == watch_modem_sim_present_check_req()) + { + shutdown_create_btn_action(NULL,LV_EVENT_CLICKED); + } + else + { + lv_watch_go_home(); + lv_watch_png_cache_all_free(); + + lv_obj_t * obj = sos_create(NULL); + if(obj == NULL) + return LV_RES_OK; + } + + return LV_RES_OK; +} + +#else + #include /********************* @@ -235,5 +492,6 @@ static void sos_no_contacts_or_network_prepare_destory(lv_obj_t * activity_obj) { lv_watch_png_cache_all_free(); } +#endif #endif /*USE_LV_WATCH_PHONE*/ diff --git a/2.sdk/gui/lv_watch/lv_apps/sos/sos.h b/2.sdk/gui/lv_watch/lv_apps/sos/sos.h index a74bd925..b05d2b6a 100644 --- a/2.sdk/gui/lv_watch/lv_apps/sos/sos.h +++ b/2.sdk/gui/lv_watch/lv_apps/sos/sos.h @@ -67,6 +67,10 @@ void sos_destory(void); sos_status_t get_sos_status(void); void sos_phone_dailing_status_ind(sos_phone_status_t status); lv_obj_t * sos_create(lv_obj_t * activity_obj); +#ifdef __MMI_ZHSX_SUPPORT__ +void mmi_sos_number_nv_read(void); +void mmi_sos_number_set(nv_watch_sos_number_t * sos_number); +#endif /********************** * MACROS 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 a150fdeb..265f8462 100644 --- a/2.sdk/gui/lv_watch/lv_apps/wechat/wechat.h +++ b/2.sdk/gui/lv_watch/lv_apps/wechat/wechat.h @@ -39,6 +39,7 @@ extern "C" { #define WECHAT_MSG_SENDING_TIME_MAX (1000 * 3) // ms +#define WECHAT_MSG_TEXT_LEN_MAX (64) typedef enum @@ -102,6 +103,8 @@ typedef struct void wechat_chat_list_set_slide_enable(lv_watch_obj_ext_t * ext, bool enable); void mmi_wechat_msg_info_init(void); +void wechat_msg_info_nv_write(void); +bool wechat_msg_receive_from_server(char * data_buff, int data_buff_len, nv_wechat_msg_type_e type); void wechat_msg_voice_item_playing_stop(lv_wechat_ext_t * ext); void wechat_chat_list_msg_item_style_reset(lv_wechat_ext_t * ext); void wechat_main_screen_refresh(void); 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 2f6d2d99..d94e7bda 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 @@ -165,10 +165,7 @@ void wechat_prepare_destory(lv_obj_t * activity_obj) lv_watch_png_cache_all_free(); - wechat_msg_info_nv_write(); - lv_wechat_ext_t * ext = wechat_actId_ext_get(ACT_ID_WECHAT_MAIN); - //LV_ASSERT_MEM(ext); if(NULL == ext) return ; @@ -189,7 +186,12 @@ void wechat_prepare_destory(lv_obj_t * activity_obj) ext->delete_timer_id = NULL; } + WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + wechat_msg_voice_item_playing_stop(ext); + + WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + wechat_chat_list_msg_item_style_reset(ext); WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); @@ -259,16 +261,22 @@ void wechat_receive_audio_play_over_cb(void *para) Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5); } -bool wechat_msg_receive_from_server(char * data_buff, int data_buff_len) +bool wechat_msg_receive_from_server(char * data_buff, int data_buff_len, nv_wechat_msg_type_e type) { if(NULL == data_buff || 0 == data_buff_len) { WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); return false; } + if(WECHAT_MSG_TYPE_MAX <= type) + { + WECHAT_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return false; + } nv_watch_wechat_msg_item_info_t wechat_msg_item_info = {0}; hal_rtc_t cur_time = {0}; + char * t_file_ext[WECHAT_MSG_TYPE_MAX] = {"amr", "txt", "png", "png"}; Hal_Rtc_Gettime(&cur_time); wechat_msg_item_info.msg_time.tm_year = cur_time.tm_year; @@ -280,10 +288,11 @@ bool wechat_msg_receive_from_server(char * data_buff, int data_buff_len) wechat_msg_item_info.msg_from = 1; wechat_msg_item_info.unread_flag = 1; - wechat_msg_item_info.msg_type = WECHAT_MSG_TYPE_VOICE; - sprintf(wechat_msg_item_info.msg_data_full_file_name, "C:/wechat_r%04d%02d%02d_%02d%02d%02d.amr", /*WECHAT_MSG_DATA_FILE_PATH, */ + wechat_msg_item_info.msg_type = type; // WECHAT_MSG_TYPE_VOICE; + sprintf(wechat_msg_item_info.msg_data_full_file_name, "C:/wechat_r%04d%02d%02d_%02d%02d%02d.%s", /*WECHAT_MSG_DATA_FILE_PATH, */ wechat_msg_item_info.msg_time.tm_year, wechat_msg_item_info.msg_time.tm_mon, wechat_msg_item_info.msg_time.tm_mday, - wechat_msg_item_info.msg_time.tm_hour, wechat_msg_item_info.msg_time.tm_min, wechat_msg_item_info.msg_time.tm_sec); + wechat_msg_item_info.msg_time.tm_hour, wechat_msg_item_info.msg_time.tm_min, wechat_msg_item_info.msg_time.tm_sec, + t_file_ext[type]); lv_fs_file_t file_p = {0}; lv_fs_res_t res = 0; @@ -311,7 +320,10 @@ bool wechat_msg_receive_from_server(char * data_buff, int data_buff_len) wechat_msg_info_new_item_add(&wechat_msg_item_info); - if(false == wechat_msg_voice_is_playing() && false == wechat_msg_voice_is_recording()) + if(false == mmi_active_screen_is_prohibit_interrupted() + && false == wechat_msg_voice_is_playing() + && false == wechat_msg_voice_is_recording() + ) { //prompt app_adaptor_wake_up_short_time(); @@ -900,7 +912,7 @@ void wechat_msg_record_button_event_cb(lv_obj_t * obj, lv_event_t e) wechat_chat_list_set_slide_enable(&ext->old_ext, false); /*prevent to slide out while recording*/ - wechat_msg_voice_item_playing_stop(ext); + //wechat_msg_voice_item_playing_stop(ext); wechat_msg_recording_screen_create(); } else if(LV_EVENT_CLICKED == e || LV_EVENT_PRESS_LOST == e) @@ -967,16 +979,14 @@ void wechat_msg_voice_item_playing_stop(lv_wechat_ext_t * ext) if(NULL != list_page_ext->voice_playing_anim.var) { - lv_obj_t * bubble_img = lv_obj_get_parent(list_page_ext->voice_playing_anim.var); - Hal_File_Play_End(); Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_5); + + uint8_t msg_from = wechat_msg_info_index_item_msg_from_get(s_wechat_selected_item_index); lv_anim_del(list_page_ext->voice_playing_anim.var, NULL); - list_page_ext->voice_playing_anim.var = NULL; - - uint8_t msg_from = wechat_msg_info_index_item_msg_from_get(s_wechat_selected_item_index); lv_img_set_src(list_page_ext->voice_playing_anim.var, (0 == msg_from) ? ICON_WECHAT_MY_VOICE_ITEM_PLAYING3 : ICON_WECHAT_OTHER_VOICE_ITEM_PLAYING3); + list_page_ext->voice_playing_anim.var = NULL; } } @@ -1569,24 +1579,24 @@ lv_obj_t * wechat_create(lv_obj_t * activity_obj, lv_wechat_created_from_e from) if(NULL == ext) return NULL; -#ifndef __WECHAT_DEBUG__ - if((false == watch_modem_sim_present_check_req()) - || (MMI_MODEM_SIGNAL_BAR_0 == watch_modem_get_signal_bar_req())) + ext->cont = NULL; + ext->list = NULL; + ext->from = from; + ext->delete_timer_id = NULL; + + if(false == watch_modem_sim_present_check_req()) + //|| (MMI_MODEM_SIGNAL_BAR_0 == watch_modem_get_signal_bar_req())) { wechat_no_network_create(obj); return obj; } -#endif lv_obj_t * cont = lv_cont_create(obj, NULL); lv_obj_set_size(cont, lv_obj_get_width(obj), lv_obj_get_height(obj)); lv_obj_align(cont, obj, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_local_bg_color(cont, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(194, 252, 252)); lv_watch_obj_add_element(cont); - ext->cont = cont; - ext->list = NULL; - ext->from = from; //create no msg label ext->label_no_msg = lv_label_create(cont, NULL); diff --git a/2.sdk/gui/lv_watch/lv_watch.c b/2.sdk/gui/lv_watch/lv_watch.c index 9eebf403..05784015 100644 --- a/2.sdk/gui/lv_watch/lv_watch.c +++ b/2.sdk/gui/lv_watch/lv_watch.c @@ -178,6 +178,7 @@ void watch_power_on_req(void) #ifdef __MMI_WECHAT_SUPPORT__ mmi_wechat_msg_info_init(); #endif + mmi_sos_number_nv_read(); #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 9a68830c..17acf874 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 @@ -139,7 +139,7 @@ uint32_t mmi_protocol_watch_location_upload_interval_get(void) void mmi_protocol_watch_location_upload_interval_set(uint32_t value) { - s_watch_protocol_data.location_upload_interval = value; + s_watch_protocol_data.location_upload_interval = ((300 > value) ? 300 : value); // value; mmi_watch_protocol_data_nv_write(); } 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 53705eb1..10bc23bc 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 @@ -22,96 +22,6 @@ static unsigned char * mmi_protocol_fzd_action_string_get(MMI_PROTOCOL_FZD_ACTIO static bool mmi_protocol_fzd_content_parse(unsigned char * content_ptr, unsigned int content_length); -char *km_strtok_r(char *s, const char *delim, char **last) -{ - /*----------------------------------------------------------------*/ - /* Local Variables */ - /*----------------------------------------------------------------*/ - char *spanp; - int c, sc; - char *tok; - - /*----------------------------------------------------------------*/ - /* Code Body */ - /*----------------------------------------------------------------*/ - if (s == NULL && (s = *last) == NULL) - { - return (NULL); - } - - c = *s; - spanp = (signed char *)delim; - sc = *spanp; - if(strlen(delim) == 1 && c == sc) - { - *s++; - *last = s; - return (NULL); - } - - if(strlen(delim)==1&&s == NULL) - { - c = **last; - if(c==sc) - { - **last++; - return NULL; - } - } - - /* - * Skip (span) leading delimiters (s += strspn(s, delim), sort of). - */ -cont: - c = *s++; - for (spanp = (signed char *)delim; (sc = *spanp++) != 0;) - { - if (c == sc &&spanp == 0) - - goto cont; - } - - if (c == 0) /* no non-delimiter characters */ - { - *last = NULL; - return (NULL); - } - tok = s - 1; - - /* - * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). - * Note that delim must have one NUL; we stop if we see that, too. - */ - for (;;) - { - c = *s++; - spanp = (signed char *)delim; - - do - { - if ((sc = *spanp++) == c) - { - if (c == 0) - { - s = NULL; - } - else - { - s[-1] = 0; - } - - *last = s; - - return (tok); - } - } - while (sc != 0); - } - /* NOTREACHED */ -} - - - // // XX*IMEI*LEN*ACTION // @@ -600,7 +510,8 @@ static unsigned char * mmi_protocol_fzd_action_string_get(MMI_PROTOCOL_FZD_ACTIO {MMI_FZD_ACTION_SEND_SPO2, "oxygen"}, // #ifdef __MMI_WECHAT_SUPPORT__ - {MMI_FZD_ACTION_TALK, "TK"}, // + {MMI_FZD_ACTION_TALK, "TK"}, + {MMI_FZD_ACTION_TALK_MESSAGE, "MESSAGE"}, #endif {MMI_FZD_ACTION_GET_WEATHER, "WT"}, // @@ -742,6 +653,10 @@ static bool mmi_protocol_fzd_content_parse(unsigned char * content_ptr, unsigned case MMI_FZD_ACTION_TALK: mmi_protocol_fzd_parse_ACTION_TALK(next_buff, next_buff_len); break; + + case MMI_FZD_ACTION_TALK_MESSAGE: + mmi_protocol_fzd_parse_ACTION_TALK_MESSAGE(next_buff, next_buff_len); + break; #endif case MMI_FZD_ACTION_GET_WEATHER: @@ -916,16 +831,18 @@ bool mmi_protocol_fzd_parse_SERVER_SET_UD_INTERVAL(unsigned char * next_buff, un bool result = false; MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_UD_INTERVAL; + if(NULL == next_buff || 0 == next_buff_len) + { + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return false; + } + result = true; mmi_protocol_fzd_respond_without_data(action); - ////////// - ////////// - ////////// - //function - ////////// - ////////// - ////////// + uint32_t value = atoi(next_buff); + + mmi_protocol_watch_location_upload_interval_set(value); return result; } @@ -1018,7 +935,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_PHONEBOOK(unsigned char * next_buff, unsi temp_ptr = km_strtok_r(NULL, ",", &next_buff); if (NULL != temp_ptr) { - strncpy(server_set_contact[i].contact_number, temp_ptr, FZD_MIN(strlen(temp_ptr), WATCH_CONTACTS_MAX_NUMBER_LEN)); + strncpy(server_set_contact[i].contact_number, temp_ptr, FZD_MIN(strlen(temp_ptr), WATCH_CONTACTS_MAX_NUMBER_LEN - 1)); } else { @@ -1028,12 +945,9 @@ bool mmi_protocol_fzd_parse_SERVER_SET_PHONEBOOK(unsigned char * next_buff, unsi temp_ptr = km_strtok_r(NULL, ",", &next_buff); if (NULL != temp_ptr) { - uint8_t j = 0; + uint8_t t_len = 0; - for(j = 0; j*4 < strlen(temp_ptr); j++) - { - server_set_contact[i].contact_name[j] = mmi_hex_string_to_number(temp_ptr + j*4, 4); - } + mmi_unicode_hex_str_to_utf8_str(temp_ptr, strlen(temp_ptr), server_set_contact[i].contact_name, &t_len); } else { @@ -1516,9 +1430,31 @@ bool mmi_protocol_fzd_parse_ACTION_TALK(unsigned char * next_buff, unsigned int result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); next_buff_len_new = mmi_protocol_fzd_voice_data_decrypt(next_buff, next_buff_len); - result = wechat_msg_receive_from_server(next_buff, next_buff_len_new); + result = wechat_msg_receive_from_server(next_buff, next_buff_len_new, WECHAT_MSG_TYPE_VOICE); + } + + return result; +} + +bool mmi_protocol_fzd_parse_ACTION_TALK_MESSAGE(unsigned char * next_buff, unsigned int next_buff_len) +{ + bool result = false; + MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_ACTION_TALK_MESSAGE; + + if(NULL == next_buff || 0 == next_buff_len) + { + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return false; } + result = mmi_protocol_fzd_respond_without_data(action); + + unsigned char t_buff[WECHAT_MSG_TEXT_LEN_MAX + 1] = {0}; + uint8_t t_len = 0; + + mmi_unicode_hex_str_to_utf8_str(next_buff, next_buff_len, t_buff, &t_len); + result = wechat_msg_receive_from_server(t_buff, t_len, WECHAT_MSG_TYPE_TEXT); + return result; } #endif @@ -1744,7 +1680,7 @@ bool mmi_protocol_fzd_parse_ACTION_GET_WEATHER(unsigned char * next_buff, unsign unsigned char * temp_ptr = NULL; app_adaptor_weather_t weather_info = {0}; - uint8_t i = 0; + uint8_t t_len = 0; //date temp_ptr = km_strtok_r(NULL, ",", &next_buff); @@ -1787,10 +1723,7 @@ bool mmi_protocol_fzd_parse_ACTION_GET_WEATHER(unsigned char * next_buff, unsign weather_info.highest_temperature= atoi(temp_ptr); //city - for(i = 0; i*4 < strlen(next_buff); i++) - { - weather_info.city[i] = mmi_hex_string_to_number(next_buff + i*4, 4); - } + mmi_unicode_hex_str_to_utf8_str(next_buff, strlen(next_buff), weather_info.city, &t_len); mmi_weather_info_set(&weather_info); @@ -1811,13 +1744,28 @@ bool mmi_protocol_fzd_parse_SERVER_SET_SOS_NUMBER(unsigned char * next_buff, uns result = true; mmi_protocol_fzd_respond_without_data(action); - ////////// - ////////// - ////////// - //function - ////////// - ////////// - ////////// + uint8_t i = 0; + unsigned char * temp_ptr = NULL; + nv_watch_sos_number_t sos_number = {0}; + + while (NULL != next_buff) + { + temp_ptr = km_strtok_r(NULL, ",", &next_buff); + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %s,%s\n", __FUNCTION__, __LINE__, temp_ptr, next_buff); + + if (NULL != temp_ptr) + { + strncpy(sos_number.number[i], temp_ptr, FZD_MIN(strlen(temp_ptr), WATCH_CONTACTS_MAX_NUMBER_LEN - 1)); + } + + i++; + if(NV_WATCH_SOS_NUMBER_MAX <= i) + { + break; + } + } + + mmi_sos_number_set(&sos_number); return result; } 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 9c238164..5e44d092 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 @@ -112,6 +112,7 @@ typedef enum #ifdef __MMI_WECHAT_SUPPORT__ MMI_FZD_ACTION_TALK, // wechat + MMI_FZD_ACTION_TALK_MESSAGE, // text message #endif MMI_FZD_ACTION_GET_WEATHER, @@ -126,9 +127,6 @@ typedef enum } MMI_PROTOCOL_FZD_ACTION_ENUM; -//strtok -char *km_strtok_r(char *s, const char *delim, char **last); - void mmi_protocol_fzd_receive_data_process(char * recv_str, int recv_len); void * mmi_protocol_fzd_send_space_ptr_get(MMI_PROTOCOL_FZD_ACTION_ENUM action); @@ -189,6 +187,8 @@ bool mmi_protocol_fzd_ACTION_TALK(char * data_buff, int data_buff_len); bool mmi_protocol_fzd_parse_ACTION_TALK(unsigned char * next_buff, unsigned int next_buff_len); +bool mmi_protocol_fzd_parse_ACTION_TALK_MESSAGE(unsigned char * next_buff, unsigned int next_buff_len); + bool mmi_protocol_fzd_action_send_location(MMI_WATCH_LOCATION_DATA_T * location_data); bool mmi_protocol_fzd_action_send_cur_location(MMI_WATCH_LOCATION_DATA_T * location_data); 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 index 18805862..c5baca80 100644 --- a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.c +++ b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.c @@ -9,9 +9,11 @@ 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}, + {"SETUPLOAD:", 10, mmi_protocol_sms_parse_set_upload}, {"POWEROFF", 8, mmi_protocol_sms_parse_power_off}, {"SETFACTORY", 10, mmi_protocol_sms_parse_set_factory}, + {"SETREBOOT", 9, mmi_protocol_sms_parse_set_reboot}, + {"GETIMEI", 7, mmi_protocol_sms_parse_get_imei}, /*******add before this line*******/ @@ -19,8 +21,53 @@ static MMI_PROTOCOL_SMS_PARSE_STRUCT s_sms_parse_info[] = }; +static void mmi_protocol_sms_parse_sms_reply(char * content_str, char * fixed_str, char * number, app_adaptor_sms_send_result_ind cb) +{ + if(NULL == number) + { + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return ; + } + + char * sms_number = (char *)lv_mem_alloc(NV_CONTACTS_MAX_NUMBER_LEN); + _lv_memset_00(sms_number, sizeof(sms_number)); + _lv_memcpy(sms_number, number, NV_CONTACTS_MAX_NUMBER_LEN); + + char * sms_data = (char *)lv_mem_alloc(MMI_REPLY_SMS_DATA_LEN_MAX); + _lv_memset_00(sms_data, sizeof(sms_data)); + if(NULL != content_str) + sprintf(sms_data, "%s", content_str); + else + sprintf(sms_data, "%s OK", fixed_str); + + uint8_t sms_data_len = strlen(sms_data); + + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %s,%s,%d\n", __FUNCTION__, __LINE__, sms_number, sms_data, sms_data_len); + + app_adaptor_sms_send_req(sms_number, sms_data, sms_data_len, NULL, cb); +} + //SETIP:api.xcloudtech.com:9000 -bool mmi_protocol_sms_parse_set_ip(char * data, char * number) +static char ip_address[NV_WATCH_HOST_NAME_LEN_MAX] = {0}; +static int ip_port = 0; +static void mmi_protocol_sms_set_ip_cb(watch_app_adp_sms_send_result_type_t result) +{ + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, result); + + if(APP_SMS_SEND_SUCCESS == result) + { + mmi_watch_host_name_set(ip_address); + mmi_watch_host_port_set(ip_port); + + send_task_msg_tcp_reconnect(NULL); + } + else if(APP_SMS_SEND_FAIL == result) + { + // + } +} + +bool mmi_protocol_sms_parse_set_ip(char * fixed_str, 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); @@ -31,10 +78,11 @@ bool mmi_protocol_sms_parse_set_ip(char * data, char * number) return false; } - char ip_address[NV_WATCH_HOST_NAME_LEN_MAX] = {0}; - int ip_port = 0; uint8_t i = 0; + _lv_memset_00(ip_address, sizeof(ip_address)); + ip_port = 0; + while(':' != data[i]) { ip_address[i] = data[i]; @@ -43,20 +91,60 @@ bool mmi_protocol_sms_parse_set_ip(char * data, char * number) i++; ip_port = atoi(data + i); - // - //reply sms - // + mmi_protocol_sms_parse_sms_reply(NULL, fixed_str, number, mmi_protocol_sms_set_ip_cb); + + return true; +} - mmi_watch_host_name_set(ip_address); - mmi_watch_host_port_set(ip_port); +//SETUPLOAD:300 +static uint32_t upload_interval = 0; +static void mmi_protocol_sms_set_upload_cb(watch_app_adp_sms_send_result_type_t result) +{ + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, result); - send_task_msg_tcp_reconnect(NULL); + if(APP_SMS_SEND_SUCCESS == result) + { + mmi_protocol_watch_location_upload_interval_set(upload_interval); + } + else if(APP_SMS_SEND_FAIL == result) + { + // + } +} + +bool mmi_protocol_sms_parse_set_upload(char * fixed_str, 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; + } + + upload_interval = atoi(data); + mmi_protocol_sms_parse_sms_reply(NULL, fixed_str, number, mmi_protocol_sms_set_upload_cb); return true; } //POWEROFF -bool mmi_protocol_sms_parse_power_off(char * data, char * number) +static void mmi_protocol_sms_power_off_cb(watch_app_adp_sms_send_result_type_t result) +{ + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, result); + + if(APP_SMS_SEND_SUCCESS == result) + { + mmi_watch_power_off(); + } + else if(APP_SMS_SEND_FAIL == result) + { + // + } +} + +bool mmi_protocol_sms_parse_power_off(char * fixed_str, 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); @@ -67,18 +155,27 @@ bool mmi_protocol_sms_parse_power_off(char * data, char * number) return false; } - // - //reply sms - // - - uos_sleep(10); - mmi_watch_power_off(); + mmi_protocol_sms_parse_sms_reply(NULL, fixed_str, number, mmi_protocol_sms_power_off_cb); return true; } //SETFACTORY -bool mmi_protocol_sms_parse_set_factory(char * data, char * number) +static void mmi_protocol_sms_set_factory_cb(watch_app_adp_sms_send_result_type_t result) +{ + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, result); + + if(APP_SMS_SEND_SUCCESS == result) + { + mmi_watch_reset(NULL); + } + else if(APP_SMS_SEND_FAIL == result) + { + // + } +} + +bool mmi_protocol_sms_parse_set_factory(char * fixed_str, 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); @@ -89,16 +186,64 @@ bool mmi_protocol_sms_parse_set_factory(char * data, char * number) return false; } - // - //reply sms - // + mmi_protocol_sms_parse_sms_reply(NULL, fixed_str, number, mmi_protocol_sms_set_factory_cb); + + return true; +} - uos_sleep(10); - mmi_watch_reset(NULL); +//SETREBOOT +static void mmi_protocol_sms_set_reboot_cb(watch_app_adp_sms_send_result_type_t result) +{ + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, result); + + if(APP_SMS_SEND_SUCCESS == result) + { + mmi_watch_restart(); + } + else if(APP_SMS_SEND_FAIL == result) + { + // + } +} + +bool mmi_protocol_sms_parse_set_reboot(char * fixed_str, 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; + } + + mmi_protocol_sms_parse_sms_reply(NULL, fixed_str, number, mmi_protocol_sms_set_reboot_cb); return true; } +//GETIMEI +bool mmi_protocol_sms_parse_get_imei(char * fixed_str, 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 content_str[32] = {0}; + char imei_str[16] = {0}; + + app_adp_get_imei_req(imei_str); + sprintf(content_str, "IMEI:%s", imei_str); + + mmi_protocol_sms_parse_sms_reply(content_str, NULL, number, NULL); + + return true; +} @@ -122,23 +267,24 @@ bool mmi_protocol_sms_content_parse(char * sms_content, char * sms_send_number) _lv_memcpy(data, sms_content, content_len); num_len = strlen(sms_send_number); - if(NV_CONTACTS_MAX_NUMBER_LEN <= content_len) + if(NV_CONTACTS_MAX_NUMBER_LEN <= num_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) + i = 0; + while(0 != s_sms_parse_info[i].fixed_str_len) { - if(content_len < s_sms_parse_info[i].str_len) + if(content_len < s_sms_parse_info[i].fixed_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)) + else if(0 == strncmp(s_sms_parse_info[i].fixed_str, data, s_sms_parse_info[i].fixed_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); + result = s_sms_parse_info[i].parse_cb(s_sms_parse_info[i].fixed_str, data + s_sms_parse_info[i].fixed_str_len, number); SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: result=%d\n", __FUNCTION__, __LINE__, result); break; } 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 index 1cc70312..7308dcc3 100644 --- a/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.h +++ b/2.sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.h @@ -27,20 +27,25 @@ extern "C" #endif -typedef bool (* SMS_PARSE_CB)(char *, char *); +#define MMI_REPLY_SMS_DATA_LEN_MAX (128) + +typedef bool (* SMS_PARSE_CB)(char *, char *, char *); typedef struct { const char * fixed_str; - int str_len; + uint8_t fixed_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); +bool mmi_protocol_sms_parse_set_ip(char * fixed_str, char * data, char * number); +bool mmi_protocol_sms_parse_set_upload(char * fixed_str, char * data, char * number); +bool mmi_protocol_sms_parse_power_off(char * fixed_str, char * data, char * number); +bool mmi_protocol_sms_parse_set_factory(char * fixed_str, char * data, char * number); +bool mmi_protocol_sms_parse_set_reboot(char * fixed_str, char * data, char * number); +bool mmi_protocol_sms_parse_get_imei(char * fixed_str, char * data, char * number); diff --git a/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.c b/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.c index 3ce677cf..6c9d3008 100644 --- a/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.c +++ b/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.c @@ -5,6 +5,94 @@ #ifdef __MMI_ZHSX_SUPPORT__ +char * km_strtok_r(char * s, const char * delim, char ** last) +{ + /*----------------------------------------------------------------*/ + /* Local Variables */ + /*----------------------------------------------------------------*/ + char *spanp; + int c, sc; + char *tok; + + /*----------------------------------------------------------------*/ + /* Code Body */ + /*----------------------------------------------------------------*/ + if (s == NULL && (s = *last) == NULL) + { + return (NULL); + } + + c = *s; + spanp = (signed char *)delim; + sc = *spanp; + if(strlen(delim) == 1 && c == sc) + { + *s++; + *last = s; + return (NULL); + } + + if(strlen(delim)==1&&s == NULL) + { + c = **last; + if(c==sc) + { + **last++; + return NULL; + } + } + + /* + * Skip (span) leading delimiters (s += strspn(s, delim), sort of). + */ +cont: + c = *s++; + for (spanp = (signed char *)delim; (sc = *spanp++) != 0;) + { + if (c == sc &&spanp == 0) + + goto cont; + } + + if (c == 0) /* no non-delimiter characters */ + { + *last = NULL; + return (NULL); + } + tok = s - 1; + + /* + * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). + * Note that delim must have one NUL; we stop if we see that, too. + */ + for (;;) + { + c = *s++; + spanp = (signed char *)delim; + + do + { + if ((sc = *spanp++) == c) + { + if (c == 0) + { + s = NULL; + } + else + { + s[-1] = 0; + } + + *last = s; + + return (tok); + } + } + while (sc != 0); + } + /* NOTREACHED */ +} + void mmi_float_to_str(double float_num, uint8_t int_num, char * data_str) { uint8_t i = 0; @@ -72,62 +160,81 @@ signed int mmi_hex_string_to_number(signed char* hex_str, unsigned char hex_str_ return int_value; } - -void mmi_wstr_to_str(const uint16_t * src, uint8 * dst) +bool mmi_unicode_hex_str_to_utf8_str(unsigned char * src, uint32_t src_len, unsigned char * dest, uint32_t * dest_len) { - return ; + if ((NULL == src) || (0 == src_len) || (NULL == dest)) + { + return false; + } - -#if 0 - uint8 *return_str = dst; + if (0 != (src_len % 4)) + { + src_len -= (src_len % 4); + } - if(NULL == src || NULL == dst) - { - return ; - } + uint32_t i = 0, j = 0; + uint32_t t_len = 0, t_char = 0; + int32_t * t_buff = NULL; - while( !(*src & 0xFF00) && '\0' != (*dst++ = *src++) ) - { - ; - } + t_buff = (int32_t *)lv_mem_alloc(sizeof(int32_t) * src_len); + if(NULL == t_buff) + { + return false; + } -#elif 0 + for(i = 0; i*4 < src_len; i++) + { + t_buff[i] = mmi_hex_string_to_number(src + i*4, 4); + } + t_len = i; - uint8 index = 0; - uint16_t * ptr = src; - - if(NULL == src || NULL == dst) - { - return ; - } + int32_t ref = 0xe08080; + int32_t t_value1 = 0, t_value2 = 0; - while(*ptr) + for(i = 0, j = 0; i < t_len; i++) { - if(256 > *src) - { - if(*ptr == 162) // € - { - dst[index++] = 0xac; - dst[index] = 0x20; - } - else - { - dst[index++] = *((uint8 *)(ptr)); - dst[index] = 0; - } - } - else + int32_t result = ref; + + t_value1 = t_buff[i]; + + if(255 >= t_value1) { - dst[index++] = *((uint8 *)(ptr)); - dst[index] = *(((uint8 *)(ptr)) + 1); + dest[j++] = t_value1; + continue; } - ptr++; + // È¡×îºóÁùλ + t_value2 = t_value1 & 0x3f; + + // ½«×îºóÁùλ·ÅÔÚref×îºóÁùλµÄ¿ÕλÖà + result |= t_value2; + t_value1 = t_value1 >> 6; + + // È¡½ÓÏÂÀ´µÄÁùλ + t_value2 = t_value1 & 0x3f; + + // ·ÅÔÚref¶ÔÓ¦µÄÁù¸öλÖà + result |= (t_value2 << 8); + + // ±£Áô×îºóËÄλ + t_value1 = t_value1 >> 6; + + // ·ÅÔÚref¶ÔÓ¦µÄËĸöλÖà + result |= (t_value1 << 16); + + dest[j++] = (unsigned char)(result >> 16); + dest[j++] = (unsigned char)(result >> 8); + dest[j++] = (unsigned char)(result & 0x00FF); } -#endif -} + if(NULL != dest_len) + { + * dest_len = j; + } + lv_mem_free(t_buff); + return true; +} #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 a6bc79ed..c065088a 100644 --- a/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.h +++ b/2.sdk/gui/lv_watch/mmi_sundry/mmi_common.h @@ -21,14 +21,15 @@ extern "C" void mmi_float_to_str(double float_num, uint8_t int_num, char * data_str); +char * km_strtok_r(char * s, const char * delim, char ** last); + signed char mmi_char_to_upper(signed char c); void mmi_str_to_upper(signed char *str, signed int len); signed int mmi_hex_string_to_number(signed char* hex_str, unsigned char hex_str_len); -void mmi_wstr_to_str(const uint16_t * src, uint8 * dst); - +bool mmi_unicode_hex_str_to_utf8_str(unsigned char * src, uint32_t src_len, unsigned char * dest, uint32_t * dest_len); #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 bfa047ef..b6e9b6c2 100644 --- a/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.c +++ b/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.c @@ -5,10 +5,42 @@ #ifdef __MMI_ZHSX_SUPPORT__ +bool mmi_active_screen_is_prohibit_interrupted(void) +{ + if(MMI_MODEM_CALL_STATE_NULL != phone_get_call_state()) + { + return true; + } + + lv_obj_t * obj = lv_watch_get_activity_obj(ACT_ID_PHONE); + if(NULL != obj) + { + return true; + } + +#if USE_LV_WATCH_SOS != 0 + obj = lv_watch_get_activity_obj(ACT_ID_SOS); + if(NULL != obj) + { + return true; + } +#endif + +#if USE_LV_WATCH_UPGRADE != 0 + obj = lv_watch_get_activity_obj(ACT_ID_UPGRADE); + if(NULL != obj) + { + return true; + } +#endif + + return false; +} -static TIMER_ID s_watch_search_timer_id = NULL; +static TIMER_ID s_watch_search_timer_id = NULL; + void mmi_watch_search_timer_stop(void) { if(NULL != s_watch_search_timer_id) @@ -80,6 +112,11 @@ lv_obj_t * mmi_watch_server_search_screen_create(lv_obj_t * activity_obj) { SUNDRY_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + if(true == mmi_active_screen_is_prohibit_interrupted()) + { + return NULL; + } + if(NULL == activity_obj) { lv_watch_activity_ext_t activity_ext = {0}; @@ -88,7 +125,8 @@ lv_obj_t * mmi_watch_server_search_screen_create(lv_obj_t * activity_obj) activity_ext.create = (lv_watch_activity_create_f_t)mmi_watch_server_search_screen_create; activity_ext.prepare_destory = mmi_watch_search_screen_destroy; 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); 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 43970a78..a8f9a64a 100644 --- a/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.h +++ b/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.h @@ -27,6 +27,10 @@ extern "C" #endif +bool mmi_active_screen_is_prohibit_interrupted(void); + + + #define MMI_WATCH_SEARCH_DURATION (1000 * 60) // ms typedef struct @@ -40,8 +44,6 @@ lv_obj_t * mmi_watch_server_search_screen_create(lv_obj_t * activity_obj); - - #ifdef __cplusplus } /* extern "C" */ #endif //__cplusplus diff --git a/2.sdk/gui/lv_watch/modem/mmi_modem_adaptor_sms.c b/2.sdk/gui/lv_watch/modem/mmi_modem_adaptor_sms.c index 04379198..ed9b21db 100644 --- a/2.sdk/gui/lv_watch/modem/mmi_modem_adaptor_sms.c +++ b/2.sdk/gui/lv_watch/modem/mmi_modem_adaptor_sms.c @@ -1136,6 +1136,8 @@ VOID MMI_ModemAdp_Ril_Sms_Rsp_New_Sms_Handler(UI_Inter_Msg_t * Msg) data_len = DecodeSmsPdu(pNewSms->pNewSms, number, time, data, g_ModemSmsMng.decode_type, &udhi, &dcs); if(0 == udhi) { + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + pSmsInfo = (app_adp_new_sms_info_ind_t *)Hal_Mem_Alloc(sizeof(app_adp_new_sms_info_ind_t)); Hal_Mem_Set(pSmsInfo, 0, sizeof(app_adp_new_sms_info_ind_t)); @@ -1175,6 +1177,8 @@ VOID MMI_ModemAdp_Ril_Sms_Rsp_New_Sms_Handler(UI_Inter_Msg_t * Msg) } } else { if((0 < data_len) && (4 != dcs)) { + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + pSmsInfo = (app_adp_new_sms_info_ind_t *)Hal_Mem_Alloc(sizeof(app_adp_new_sms_info_ind_t)); Hal_Mem_Set(pSmsInfo, 0, sizeof(app_adp_new_sms_info_ind_t)); @@ -2364,6 +2368,8 @@ uint16_t DecodeSmsPdu(char * pSrcInfoIn, char * number, char * time, char * data if(0 == *udhi) { if(0 == tmp_dcs) { // 7-bit + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + Decode7BitPdu(pSrcInfo, buf7bit, (uint16_t)tmp, data, decode_type); if(APP_SMS_CODE_TYPE_UTF_8 == decode_type) { return_len = tmp; @@ -2372,12 +2378,18 @@ uint16_t DecodeSmsPdu(char * pSrcInfoIn, char * number, char * time, char * data } } else if(8 == tmp_dcs) { // UCS2 + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return_len = DecodeUcs2Pdu(pSrcInfo, bufucs2, (uint16_t)tmp, data, decode_type); } else { return_len = tmp; + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + String2Bytes((uint8_t *)pSrcInfo, (uint8_t *)data, (tmp * 2)); } } else { + printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return_len = StoreSegPdu(pSrcInfo, tmp, decode_type, tmp_dcs); } diff --git a/2.sdk/gui/lvgl/hal/hal.c b/2.sdk/gui/lvgl/hal/hal.c index 165da9a1..1bffd8eb 100644 --- a/2.sdk/gui/lvgl/hal/hal.c +++ b/2.sdk/gui/lvgl/hal/hal.c @@ -1799,8 +1799,17 @@ VOID Hal_Power_Off(HAL_POWER_OFF_TYPE type) } board_power_off((int)type); +#ifdef __MMI_ZHSX_SUPPORT__ +#ifdef __MMI_WECHAT_SUPPORT__ + wechat_msg_info_nv_write(); +#endif + asl_pedometer_steps_save(true); + +#else //save steps to nv when power off asl_pedometer_steps_save(); +#endif + } watch_ambient_type_t ambient_flag = AMBIENT_OFF; diff --git a/2.sdk/product/craneg_modem/config/watch/lv_watch_conf.h b/2.sdk/product/craneg_modem/config/watch/lv_watch_conf.h index d77d3eaf..202e3df6 100644 --- a/2.sdk/product/craneg_modem/config/watch/lv_watch_conf.h +++ b/2.sdk/product/craneg_modem/config/watch/lv_watch_conf.h @@ -77,7 +77,7 @@ #define USE_LV_WATCH_VOLTE_SWTICH 0 // 1 #define USE_LV_WATCH_VIDEOCALL 1 #define USE_LV_WATCH_CALENDAR 1 -#define USE_LV_WATCH_AUDIO_PLAYER 1 +#define USE_LV_WATCH_AUDIO_PLAYER 0 // 1 #define USE_LV_WATCH_IMGVIEWER 1 #define USE_LV_WATCH_DUAL_SIM 0 #define USE_LV_WATCH_DIAL_AMBIENT 0