From: CCC <2393524978@qq.com> Date: Tue, 23 May 2023 08:05:22 +0000 (+0800) Subject: xiugai X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=ded63e961ab767aafc3702a813a84f41f75b4414;p=mirrors%2FASR3603_Z5.git xiugai --- 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 93366058..4d8ab085 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,6 +249,10 @@ void mmi_watch_reset(lv_obj_t * activity_obj) { printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + mmi_protocol_action_unbind(); + + uos_sleep(10); + //app_adaptor_wake_up_short_time(); if(0 == Hal_Pm_Get_State()) { 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 265f8462..77a51a93 100644 --- a/2.sdk/gui/lv_watch/lv_apps/wechat/wechat.h +++ b/2.sdk/gui/lv_watch/lv_apps/wechat/wechat.h @@ -32,7 +32,7 @@ extern "C" { //#define WECHAT_MSG_DATA_FILE_PATH "C:/wechat/" #define WECHAT_MSG_DATA_AMR_HEAD_SIZE (6) -#define WECHAT_MSG_DATA_RECORD_DURATION_MAX (16) // seconds +#define WECHAT_MSG_DATA_RECORD_DURATION_MAX (15) // seconds #define WECHAT_MSG_DATA_RECORD_SIZE_MAX (WECHAT_MSG_DATA_RECORD_DURATION_MAX * HAL_AMR_BUFSIZE_PER_SECOND + WECHAT_MSG_DATA_AMR_HEAD_SIZE) #define WECHAT_MSG_CHAT_TIME_INTERVAL (3 * 60) /*display the time of current chat msg if more than 3 mins from the previous chat msgs*/ 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 d94e7bda..1a2e60b1 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 @@ -1324,6 +1324,10 @@ lv_obj_t * wechat_chat_list_msg_item_add(lv_obj_t * list_page, nv_watch_wechat_m else { char len_str[8] = {0}; + + if(WECHAT_MSG_DATA_RECORD_DURATION_MAX < duration) + duration = WECHAT_MSG_DATA_RECORD_DURATION_MAX; + sprintf(len_str, "%d S", duration); lv_label_set_text(len_label, len_str); } 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 17acf874..de3f300e 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 @@ -354,8 +354,25 @@ bool mmi_protocol_action_get_weather(void) return true; } +bool mmi_protocol_action_send_warning_info(MMI_WATCH_LOCATION_DATA_T * location_data) +{ + if(false == mmi_protocol_check_state_before_send_action()) + return false; + + return mmi_protocol_fzd_action_send_warning_info(location_data); +} +bool mmi_protocol_action_sos(void) +{ + mmi_protocol_fzd_set_warning_info(MMI_FZD_WARNING_TYPE_SOS, true); + return true; +} +bool mmi_protocol_action_unbind(void) +{ + mmi_protocol_fzd_action_unbind(); + return true; +} 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 8ffb2301..26876fb8 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 @@ -80,7 +80,13 @@ bool mmi_protocol_action_send_cur_location(MMI_WATCH_LOCATION_DATA_T * location_ bool mmi_protocol_action_send_get_weather(MMI_WATCH_LOCATION_DATA_T * location_data); +bool mmi_protocol_action_get_weather(void); +bool mmi_protocol_action_send_warning_info(MMI_WATCH_LOCATION_DATA_T * location_data); + +bool mmi_protocol_action_sos(void); + +bool mmi_protocol_action_unbind(void); #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 10bc23bc..a8331990 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 @@ -16,8 +16,8 @@ static MMI_PROTOCOL_FZD_SEND_SPACE_STRUCT s_send_space_struct[MMI_FZD_ACTION_MAX static MMI_PROTOCOL_FZD_RECEIVE_SPACE_STRUCT s_receive_space_struct = {0}; -static bool mmi_protocol_fzd_request_without_data(MMI_PROTOCOL_FZD_ACTION_ENUM action); -static bool mmi_protocol_fzd_respond_without_data(MMI_PROTOCOL_FZD_ACTION_ENUM action); +static bool mmi_protocol_fzd_send_without_data(MMI_PROTOCOL_FZD_ACTION_ENUM action); +static bool mmi_protocol_fzd_send_with_data(MMI_PROTOCOL_FZD_ACTION_ENUM action, unsigned char * content_buff, int content_lenth); static unsigned char * mmi_protocol_fzd_action_string_get(MMI_PROTOCOL_FZD_ACTION_ENUM action); static bool mmi_protocol_fzd_content_parse(unsigned char * content_ptr, unsigned int content_length); @@ -175,7 +175,7 @@ void mmi_protocol_fzd_send_action_do(MMI_PROTOCOL_FZD_ACTION_ENUM action) } // [MD5_DATADEVICE_NAME*DEVICE_ID*CONTENT_LEN*ACTION_STRING,ACTION_CONTENT] -bool mmi_protocol_fzd_send_content_construct(MMI_PROTOCOL_FZD_ACTION_ENUM action, unsigned char * content_ptr, int content_len) +static bool mmi_protocol_fzd_send_content_construct(MMI_PROTOCOL_FZD_ACTION_ENUM action, unsigned char * content_ptr, int content_len) { unsigned char * send_space_ptr = NULL; int send_space_size = 0, curr_offset = 0; @@ -451,7 +451,7 @@ void mmi_protocol_fzd_receive_data_process(char * recv_str, int recv_len) } } -static bool mmi_protocol_fzd_request_without_data(MMI_PROTOCOL_FZD_ACTION_ENUM action) +static bool mmi_protocol_fzd_send_without_data(MMI_PROTOCOL_FZD_ACTION_ENUM action) { bool result = false; unsigned char content_buff = NULL; @@ -462,11 +462,9 @@ static bool mmi_protocol_fzd_request_without_data(MMI_PROTOCOL_FZD_ACTION_ENUM a return result; } -static bool mmi_protocol_fzd_respond_without_data(MMI_PROTOCOL_FZD_ACTION_ENUM action) +static bool mmi_protocol_fzd_send_with_data(MMI_PROTOCOL_FZD_ACTION_ENUM action, unsigned char * content_buff, int content_lenth) { bool result = false; - unsigned char * content_buff = NULL; - unsigned int content_lenth = 0; result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); @@ -517,7 +515,7 @@ static unsigned char * mmi_protocol_fzd_action_string_get(MMI_PROTOCOL_FZD_ACTIO {MMI_FZD_ACTION_GET_WEATHER, "WT"}, // {MMI_FZD_SERVER_SET_SOS_NUMBER, "SOS"}, // {MMI_FZD_SERVER_SET_CENTER_NUMBER, "CENTER"}, // - + {MMI_FZD_ACTION_UNBIND, "DLT"}, /*******add before this line*******/ @@ -671,6 +669,8 @@ static bool mmi_protocol_fzd_content_parse(unsigned char * content_ptr, unsigned mmi_protocol_fzd_parse_SERVER_SET_CENTER_NUMBER(next_buff, next_buff_len); break; + case MMI_FZD_ACTION_UNBIND: + break; default: @@ -688,7 +688,7 @@ bool mmi_protocol_fzd_action_link(void) unsigned char * content_buff = NULL; unsigned int content_lenth = 0; hal_rtc_t cur_time = {0}; - int step_num = 0; + int step_num = asl_pedometer_steps_get(); int roll_num = 0; int battery_percent = Hal_Battery_Get_Status(); @@ -705,7 +705,7 @@ bool mmi_protocol_fzd_action_link(void) sprintf(content_buff, ",%02d%02d%02d,%u,%u,%u", cur_time.tm_year%2000, cur_time.tm_mon, cur_time.tm_mday, step_num, roll_num, battery_percent); content_lenth = strlen(content_buff); - result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); + result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth); lv_mem_free(content_buff); return result; @@ -727,7 +727,7 @@ bool mmi_protocol_fzd_parse_ACTION_LINK(unsigned char * next_buff, unsigned int bool mmi_protocol_fzd_action_bind(void) { - return mmi_protocol_fzd_request_without_data(MMI_FZD_ACTION_BIND); + return mmi_protocol_fzd_send_without_data(MMI_FZD_ACTION_BIND); } bool mmi_protocol_fzd_parse_ACTION_BIND(unsigned char * next_buff, unsigned int next_buff_len) @@ -765,7 +765,7 @@ bool mmi_protocol_fzd_parse_ACTION_BIND(unsigned char * next_buff, unsigned int bool mmi_protocol_fzd_action_get_time(void) { - return mmi_protocol_fzd_request_without_data(MMI_FZD_ACTION_GET_TIME); + return mmi_protocol_fzd_send_without_data(MMI_FZD_ACTION_GET_TIME); } //[XX*YYYY*001D*LGZONE,+8,08:00:00,2016-01-12] @@ -819,7 +819,7 @@ bool mmi_protocol_fzd_parse_SERVER_GET_CUR_LOCATION(unsigned char * next_buff, u MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_GET_CUR_LOCATION; result = true; - mmi_protocol_fzd_respond_without_data(action); + mmi_protocol_fzd_send_without_data(action); mmi_watch_location_mission_current_location_action(); @@ -838,7 +838,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_UD_INTERVAL(unsigned char * next_buff, un } result = true; - mmi_protocol_fzd_respond_without_data(action); + mmi_protocol_fzd_send_without_data(action); uint32_t value = atoi(next_buff); @@ -853,8 +853,8 @@ bool mmi_protocol_fzd_parse_SERVER_SET_FACTORY(unsigned char * next_buff, unsign MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_FACTORY; result = true; - mmi_protocol_fzd_respond_without_data(action); - uos_sleep(10); + mmi_protocol_fzd_send_without_data(action); + //uos_sleep(10); mmi_watch_reset(NULL); return result; @@ -866,7 +866,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_POWEROFF(unsigned char * next_buff, unsig MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_POWEROFF; result = true; - mmi_protocol_fzd_respond_without_data(action); + mmi_protocol_fzd_send_without_data(action); uos_sleep(10); mmi_watch_power_off(); @@ -879,7 +879,7 @@ bool mmi_protocol_fzd_parse_SERVER_FIND_WATCH(unsigned char * next_buff, unsigne MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_FIND_WATCH; result = true; - mmi_protocol_fzd_respond_without_data(action); + mmi_protocol_fzd_send_without_data(action); mmi_watch_server_search_screen_create(NULL); @@ -904,7 +904,7 @@ bool mmi_protocol_fzd_parse_SERVER_GET_VERSION(unsigned char * next_buff, unsign //sprintf(content_buff, ",%s", temp_value); content_lenth = strlen(content_buff); - result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); + result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth); return result; } @@ -921,7 +921,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_PHONEBOOK(unsigned char * next_buff, unsi } result = true; - mmi_protocol_fzd_respond_without_data(action); + mmi_protocol_fzd_send_without_data(action); app_adaptor_contact_t server_set_contact[NV_WATCH_MAX_CONTACT_NUM] = {0}; char * temp_ptr = NULL; @@ -978,7 +978,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_CALL(unsigned char * next_buff, unsigned } result = true; - mmi_protocol_fzd_respond_without_data(action); + mmi_protocol_fzd_send_without_data(action); uos_sleep(10); char * number = (char *)lv_mem_alloc(next_buff_len + 1); @@ -1007,7 +1007,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_REMIND(unsigned char * next_buff, unsigne } result = true; - mmi_protocol_fzd_respond_without_data(action); + mmi_protocol_fzd_send_without_data(action); app_adaptor_alarm_t server_set_alarm[NV_ALARM_MAX_ALARM_NUM] = {0}; char * group_str = NULL; @@ -1080,7 +1080,7 @@ bool mmi_protocol_fzd_action_send_temperature(float temp_value) sprintf(content_buff, ",%s", data_str); content_lenth = strlen(content_buff); - result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); + result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth); return result; } @@ -1095,7 +1095,7 @@ bool mmi_protocol_fzd_action_send_heart(uint16_t heart_value) sprintf(content_buff, ",%d", heart_value); content_lenth = strlen(content_buff); - result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); + result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth); return result; } @@ -1110,7 +1110,7 @@ bool mmi_protocol_fzd_action_send_blood(uint16_t blood_high_value, uint16_t bloo sprintf(content_buff, ",%d,%d", blood_high_value, blood_low_value); content_lenth = strlen(content_buff); - result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); + result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth); return result; } @@ -1125,7 +1125,7 @@ bool mmi_protocol_fzd_action_send_spo2(uint16_t spo2_value) sprintf(content_buff, ",%d", spo2_value); content_lenth = strlen(content_buff); - result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); + result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth); return result; } @@ -1142,7 +1142,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_HEART_INTERVAL(unsigned char * next_buff, } result = true; - mmi_protocol_fzd_respond_without_data(action); + mmi_protocol_fzd_send_without_data(action); int value_interval = atoi(next_buff); @@ -1174,7 +1174,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_TEMPERATURE_INTERVAL(unsigned char * next } result = true; - mmi_protocol_fzd_respond_without_data(action); + mmi_protocol_fzd_send_without_data(action); int value_interval = atoi(next_buff); @@ -1207,7 +1207,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_BLOOD_INTERVAL(unsigned char * next_buff, } result = true; - mmi_protocol_fzd_respond_without_data(action); + mmi_protocol_fzd_send_without_data(action); int value_interval = atoi(next_buff); @@ -1240,7 +1240,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_SPO2_INTERVAL(unsigned char * next_buff, } result = true; - mmi_protocol_fzd_respond_without_data(action); + mmi_protocol_fzd_send_without_data(action); int value_interval = atoi(next_buff); @@ -1396,7 +1396,7 @@ bool mmi_protocol_fzd_ACTION_TALK(char * data_buff, int data_buff_len) 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); + result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth); lv_mem_free(content_buff); return result; @@ -1427,7 +1427,7 @@ bool mmi_protocol_fzd_parse_ACTION_TALK(unsigned char * next_buff, unsigned int sprintf(content_buff, ",1"); content_lenth = strlen(content_buff); - result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); + result = mmi_protocol_fzd_send_with_data(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, WECHAT_MSG_TYPE_VOICE); @@ -1447,7 +1447,7 @@ bool mmi_protocol_fzd_parse_ACTION_TALK_MESSAGE(unsigned char * next_buff, unsig return false; } - result = mmi_protocol_fzd_respond_without_data(action); + result = mmi_protocol_fzd_send_without_data(action); unsigned char t_buff[WECHAT_MSG_TEXT_LEN_MAX + 1] = {0}; uint8_t t_len = 0; @@ -1513,7 +1513,7 @@ static unsigned int mmi_protocol_fzd_action_send_content_fill_location_data(unsi hal_rtc_t cur_time = {0}; unsigned int battery_value = Hal_Battery_Get_Status(); unsigned int sleep_roll_value = 0; - unsigned int step_value = 0; + unsigned int step_value = asl_pedometer_steps_get(); uint8_t i = 0; char data_str[128] = {0}; @@ -1608,7 +1608,7 @@ bool mmi_protocol_fzd_action_send_location(MMI_WATCH_LOCATION_DATA_T * location_ content_lenth = mmi_protocol_fzd_action_send_content_fill_location_data(content_buff, content_lenth, location_data, action, NULL); - result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); + result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth); lv_mem_free(content_buff); return result; @@ -1632,7 +1632,7 @@ bool mmi_protocol_fzd_action_send_cur_location(MMI_WATCH_LOCATION_DATA_T * locat content_lenth = mmi_protocol_fzd_action_send_content_fill_location_data(content_buff, content_lenth, location_data, action, NULL); - result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); + result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth); lv_mem_free(content_buff); return result; @@ -1656,7 +1656,7 @@ bool mmi_protocol_fzd_action_send_get_weather(MMI_WATCH_LOCATION_DATA_T * locati content_lenth = mmi_protocol_fzd_action_send_content_fill_location_data(content_buff, content_lenth, location_data, action, NULL); - result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); + result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth); lv_mem_free(content_buff); return result; @@ -1742,7 +1742,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_SOS_NUMBER(unsigned char * next_buff, uns } result = true; - mmi_protocol_fzd_respond_without_data(action); + mmi_protocol_fzd_send_without_data(action); uint8_t i = 0; unsigned char * temp_ptr = NULL; @@ -1782,7 +1782,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_CENTER_NUMBER(unsigned char * next_buff, } result = true; - mmi_protocol_fzd_respond_without_data(action); + mmi_protocol_fzd_send_without_data(action); ////////// ////////// @@ -1796,7 +1796,123 @@ bool mmi_protocol_fzd_parse_SERVER_SET_CENTER_NUMBER(unsigned char * next_buff, } +static MMI_PROTOCOL_FZD_WARNING_INFO_STRUCT s_fzd_warning_info = {0}; + +void mmi_protocol_fzd_set_warning_info(MMI_PROTOCOL_FZD_WARNING_TYPE_ENUM warning_type, bool value) +{ + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: type=%d,value=%d\n", __FUNCTION__, __LINE__, warning_type, value); + + if(MMI_FZD_WARNING_TYPE_NONE >= warning_type || MMI_FZD_WARNING_TYPE_MAX <= warning_type) + { + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return; + } + + switch(warning_type) + { + case MMI_FZD_WARNING_TYPE_SOS: + s_fzd_warning_info.sos = value; + break; + + case MMI_FZD_WARNING_TYPE_LOW_BATTERY: + s_fzd_warning_info.low_battery = value; + break; + + case MMI_FZD_WARNING_TYPE_TAKE_OFF: + s_fzd_warning_info.take_off = value; + break; + + case MMI_FZD_WARNING_TYPE_TAKE_ON: + s_fzd_warning_info.take_on = value; + break; + + case MMI_FZD_WARNING_TYPE_FALL_DOWN: + s_fzd_warning_info.fall_down = value; + break; + + default: + break; + } + + if(true == value) + { + mmi_watch_location_mission_warning_action(); + } +} + +bool mmi_protocol_fzd_action_send_warning_info(MMI_WATCH_LOCATION_DATA_T * location_data) +{ + bool result = false; + MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_ACTION_ALERT; + unsigned char * content_buff = NULL; + unsigned int content_lenth = 0; + + while(1) + { + unsigned int warning_value = 0; + unsigned char warning_buff[16] = {0}; + if(true == s_fzd_warning_info.sos) + { + warning_value |= (1 << 16); + s_fzd_warning_info.sos = false; + } + else if(true == s_fzd_warning_info.low_battery) + { + warning_value |= 1; + warning_value |= (1 << 17); + s_fzd_warning_info.low_battery = false; + } + else if(true == s_fzd_warning_info.take_off) + { + warning_value |= (1 << 3); + warning_value |= (1 << 20); + s_fzd_warning_info.take_off = false; + } + else if(true == s_fzd_warning_info.take_on) + { + warning_value |= (1 << 20); + s_fzd_warning_info.take_on = false; + } + else if(true == s_fzd_warning_info.fall_down) + { + warning_value |= (1 << 4); + warning_value |= (1 << 21); + s_fzd_warning_info.fall_down = false; + } + else + { + break; + } + + sprintf(warning_buff, "%02x%02x%02x%02x", + (unsigned char)(warning_value >> 24), (unsigned char)(warning_value >> 16), + (unsigned char)(warning_value >> 8), (unsigned char)warning_value); + + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: value=%d,buff=%s\n", __FUNCTION__, __LINE__, warning_value, warning_buff); + + content_lenth = MMI_PROTOCOL_FZD_FILL_LOCATION_DATA_BUFF_LEN; + content_buff = (unsigned char *)lv_mem_alloc(content_lenth); + if(NULL == content_buff) + { + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return false; + } + _lv_memset_00(content_buff, content_lenth); + + content_lenth = mmi_protocol_fzd_action_send_content_fill_location_data(content_buff, content_lenth, location_data, action, warning_buff); + + result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth); + lv_mem_free(content_buff); + } + + return result; +} + +bool mmi_protocol_fzd_action_unbind(void) +{ + return mmi_protocol_fzd_send_without_data(MMI_FZD_ACTION_UNBIND); +} 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 5e44d092..3d15f780 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 @@ -119,6 +119,7 @@ typedef enum MMI_FZD_SERVER_SET_SOS_NUMBER, // 26 MMI_FZD_SERVER_SET_CENTER_NUMBER, + MMI_FZD_ACTION_UNBIND, @@ -126,6 +127,27 @@ typedef enum MMI_FZD_ACTION_MAX } MMI_PROTOCOL_FZD_ACTION_ENUM; +typedef enum +{ + MMI_FZD_WARNING_TYPE_NONE, + MMI_FZD_WARNING_TYPE_SOS, + MMI_FZD_WARNING_TYPE_LOW_BATTERY, + MMI_FZD_WARNING_TYPE_TAKE_OFF, + MMI_FZD_WARNING_TYPE_TAKE_ON, + MMI_FZD_WARNING_TYPE_FALL_DOWN, + + MMI_FZD_WARNING_TYPE_MAX +}MMI_PROTOCOL_FZD_WARNING_TYPE_ENUM; + +typedef struct +{ + bool sos; + bool low_battery; + bool take_off; + bool take_on; + bool fall_down; +}MMI_PROTOCOL_FZD_WARNING_INFO_STRUCT; + void mmi_protocol_fzd_receive_data_process(char * recv_str, int recv_len); @@ -200,6 +222,10 @@ bool mmi_protocol_fzd_parse_SERVER_SET_SOS_NUMBER(unsigned char * next_buff, uns bool mmi_protocol_fzd_parse_SERVER_SET_CENTER_NUMBER(unsigned char * next_buff, unsigned int next_buff_len); +void mmi_protocol_fzd_set_warning_info(MMI_PROTOCOL_FZD_WARNING_TYPE_ENUM warning_type, bool value); +bool mmi_protocol_fzd_action_send_warning_info(MMI_WATCH_LOCATION_DATA_T * location_data); + +bool mmi_protocol_fzd_action_unbind(void); 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 c5baca80..4e43f95c 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 @@ -14,12 +14,61 @@ static MMI_PROTOCOL_SMS_PARSE_STRUCT s_sms_parse_info[] = {"SETFACTORY", 10, mmi_protocol_sms_parse_set_factory}, {"SETREBOOT", 9, mmi_protocol_sms_parse_set_reboot}, {"GETIMEI", 7, mmi_protocol_sms_parse_get_imei}, + {"UNBIND", 6, mmi_protocol_sms_parse_unbind}, /*******add before this line*******/ {"", 0, NULL} }; +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 <= num_len) + num_len = NV_CONTACTS_MAX_NUMBER_LEN - 1; + _lv_memcpy(number, sms_send_number, num_len); + + i = 0; + while(0 != s_sms_parse_info[i].fixed_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].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(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; + } + } + i++; + } + } + + return result; +} static void mmi_protocol_sms_parse_sms_reply(char * content_str, char * fixed_str, char * number, app_adaptor_sms_send_result_ind cb) { @@ -245,57 +294,40 @@ bool mmi_protocol_sms_parse_get_imei(char * fixed_str, char * data, char * numbe return true; } - - -bool mmi_protocol_sms_content_parse(char * sms_content, char * sms_send_number) +// +static void mmi_protocol_sms_unbind_cb(watch_app_adp_sms_send_result_type_t result) { - 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); + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, result); - if(NULL != sms_content) + if(APP_SMS_SEND_SUCCESS == result) { - 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); + mmi_protocol_action_unbind(); + } + else if(APP_SMS_SEND_FAIL == result) + { + // + } +} - num_len = strlen(sms_send_number); - if(NV_CONTACTS_MAX_NUMBER_LEN <= num_len) - num_len = NV_CONTACTS_MAX_NUMBER_LEN - 1; - _lv_memcpy(number, sms_send_number, num_len); - - i = 0; - while(0 != s_sms_parse_info[i].fixed_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].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(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; - } - } - i++; - } +bool mmi_protocol_sms_parse_unbind(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_unbind_cb); - return result; + return true; } + + + #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 index 7308dcc3..7da4a176 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 @@ -46,6 +46,7 @@ bool mmi_protocol_sms_parse_power_off(char * fixed_str, char * data, char * numb 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); +bool mmi_protocol_sms_parse_unbind(char * fixed_str, char * data, char * number);