From b8ae33beb89ae2fd15bf710c4e99ce6d05babed5 Mon Sep 17 00:00:00 2001 From: CCC <2393524978@qq.com> Date: Fri, 21 Apr 2023 16:29:12 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../lv_apps/health_measure/health_measure.c | 19 ++- .../gui/lv_watch/mmi_location/mmi_location.c | 38 ++++-- .../lv_watch/mmi_protocol/mmi_protocol_api.c | 84 +++++++++--- .../lv_watch/mmi_protocol/mmi_protocol_api.h | 12 +- .../lv_watch/mmi_protocol/mmi_protocol_fzd.c | 126 +++++++++++++----- .../lv_watch/mmi_protocol/mmi_protocol_fzd.h | 16 +-- 2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.c | 1 + .../mmi_modem_tcp/mmi_modem_tcp_manage.c | 2 +- .../modem/mmi_modem_tcp/mmi_modem_tcp_net.c | 8 ++ 9 files changed, 231 insertions(+), 75 deletions(-) diff --git a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c index 2fddeeeb..b33ded90 100644 --- a/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c +++ b/2.sdk/gui/lv_watch/lv_apps/health_measure/health_measure.c @@ -9,11 +9,13 @@ static nv_watch_health_measure_timed_t s_health_measure_timed_data = {0}; static lv_ll_t s_health_measure_timed_ll = {0}; static lv_health_measure_run_t s_health_measure_run_data = {0}; -static TIMER_ID s_process_timer_id = NULL; +static void * s_health_measure_process_timer_id = NULL; static uint8_t s_measure_time_total = 0, s_measure_time_count = 0; static uint32_t s_health_measure_heart_timed_time_stamp = 0, s_health_measure_temperature_timed_time_stamp = 0, s_health_measure_blood_timed_time_stamp = 0, s_health_measure_spo2_timed_time_stamp = 0; +static void mmi_health_measure_process_timer_handle(uint32_t para); + void mmi_hsensor_close(void) { @@ -539,10 +541,11 @@ void mmi_health_measure_send_spo2(void) void mmi_health_measure_process_timer_stop(void) { - if(NULL != s_process_timer_id) + if(NULL != s_health_measure_process_timer_id) { - Hal_Timer_Stop(s_process_timer_id); - s_process_timer_id = NULL; + uos_timer_stop(s_health_measure_process_timer_id); + uos_timer_delete(s_health_measure_process_timer_id); + s_health_measure_process_timer_id = NULL; } } @@ -584,7 +587,7 @@ void mmi_health_measure_process_finish(void) s_health_measure_run_data.measure_type = MMI_HEALTH_MEASURE_NONE; } -void mmi_health_measure_process_timer_handle(void *para) +static void mmi_health_measure_process_timer_handle(uint32_t para) { if(false == mmi_health_measure_wear_state_get()) { @@ -623,6 +626,8 @@ void mmi_health_measure_process_timer_handle(void *para) default: break; } + + uos_timer_start(s_health_measure_process_timer_id, MMI_HEALTH_MEASURE_CYCLE_DURATION, 0, mmi_health_measure_process_timer_handle, NULL); } } @@ -693,7 +698,9 @@ void mmi_health_measure_start(MMI_HEALTH_MEASURE_TYPE_E measure_type, uint32_t t s_health_measure_run_data.measure_type = measure_type; s_measure_time_count = 0; - s_process_timer_id = Hal_Timer_Start(MMI_HEALTH_MEASURE_CYCLE_DURATION, mmi_health_measure_process_timer_handle, NULL, true); + + uos_timer_create(&s_health_measure_process_timer_id); + uos_timer_start(s_health_measure_process_timer_id, MMI_HEALTH_MEASURE_CYCLE_DURATION, 0, mmi_health_measure_process_timer_handle, NULL); } void mmi_health_measure_timed_measure_start(MMI_HEALTH_MEASURE_TYPE_E measure_type) diff --git a/2.sdk/gui/lv_watch/mmi_location/mmi_location.c b/2.sdk/gui/lv_watch/mmi_location/mmi_location.c index 99993ab2..83b0fbc3 100644 --- a/2.sdk/gui/lv_watch/mmi_location/mmi_location.c +++ b/2.sdk/gui/lv_watch/mmi_location/mmi_location.c @@ -6,19 +6,20 @@ #ifdef __MMI_ZHSX_SUPPORT__ #if USE_GPS -//#include "../../../../product/craneg_modem/hal/gps_device/inc/gpsnmeaapi.h" #include "../../../product/craneg_modem/hal/gps_device/inc/gpsnmeaapi.h" #endif #include "../modem/mmi_modem_tcp/wifi_scan_task.h" -static uint8_t s_watch_location_state = 0; // 0-init; 1-locating +static uint8_t s_watch_location_state = 0; // 0-default; 1-locating static MMI_WATCH_LOCATION_STATE_E s_watch_location_gps_state = 0, s_watch_location_cell_state = 0, s_watch_location_wifi_state = 0; static MMI_WATCH_LOCATION_DATA_T s_watch_location_data = {0}; static lv_ll_t s_watch_location_mission_ll = {0}; -static TIMER_ID s_watch_location_timer_id = NULL; +static void * s_watch_location_timer_id = NULL; static uint8_t s_watch_location_times_check_count = 0; +static void mmi_watch_location_mission_timer_cb(uint32_t para); + void mmi_watch_location_mission_list_init(void) { @@ -77,6 +78,16 @@ void mmi_watch_location_mission_list_data_send(void) MMI_WATCH_LOCATION_TYPE_E * node = _lv_ll_get_tail(&s_watch_location_mission_ll); LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %d,%d,%d,%d,%d,%d,%d,%d,%u\n", __LINE__, + s_watch_location_data.gps_data.state, + s_watch_location_data.gps_data.latitude * 1000000, + s_watch_location_data.gps_data.ns, + s_watch_location_data.gps_data.longitude * 1000000, + s_watch_location_data.gps_data.ew, + s_watch_location_data.gps_data.speed * 100, + s_watch_location_data.gps_data.degree * 10, + s_watch_location_data.gps_data.altitude * 10, + s_watch_location_data.gps_data.satellite_num); while(NULL != node) { @@ -116,6 +127,8 @@ void mmi_watch_location_mission_list_data_send(void) void mmi_watch_location_gps_finsh_cb(void *param) { + LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + if(NULL != param) { LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); @@ -125,6 +138,8 @@ void mmi_watch_location_gps_finsh_cb(void *param) if('A' == gpsNmeaData->NmeaRmcData.Status) { + LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + gps2wgs84(gpsNmeaData->NmeaRmcData.Latitude, gpsNmeaData->NmeaRmcData.Longitude, &gpsLat, &gpsLon); s_watch_location_data.gps_data.state = 'A'; @@ -286,7 +301,8 @@ void mmi_watch_location_mission_stop(void) s_watch_location_state = 0; if(NULL != s_watch_location_timer_id) { - Hal_Timer_Stop(s_watch_location_timer_id); + uos_timer_stop(s_watch_location_timer_id); + uos_timer_delete(s_watch_location_timer_id); s_watch_location_timer_id = NULL; } @@ -295,7 +311,7 @@ void mmi_watch_location_mission_stop(void) mmi_watch_location_wifi_stop(); } -void mmi_watch_location_mission_timer_cb(void * para) +static void mmi_watch_location_mission_timer_cb(uint32_t para) { LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: total=%d,count=%d\n", __FUNCTION__, __LINE__, MMI_WATCH_LOCATION_CHECK_TIMES_COUNT_MAX, s_watch_location_times_check_count); @@ -309,8 +325,6 @@ void mmi_watch_location_mission_timer_cb(void * para) } else { - LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); - if(MMI_WATCH_LOCATION_STATE_SUCCESS == s_watch_location_cell_state && MMI_WATCH_LOCATION_STATE_SUCCESS == s_watch_location_gps_state ) @@ -320,6 +334,12 @@ void mmi_watch_location_mission_timer_cb(void * para) mmi_watch_location_mission_list_data_send(); mmi_watch_location_mission_stop(); } + else + { + LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + + uos_timer_start(s_watch_location_timer_id, MMI_WATCH_LOCATION_PROCESS_DURATION, 0, mmi_watch_location_mission_timer_cb, NULL); + } } } @@ -334,7 +354,9 @@ void mmi_watch_location_mission_start(void) s_watch_location_state = 1; _lv_memset_00(&s_watch_location_data, sizeof(MMI_WATCH_LOCATION_DATA_T)); s_watch_location_times_check_count = 0; - s_watch_location_timer_id = Hal_Timer_Start(MMI_WATCH_LOCATION_PROCESS_DURATION, mmi_watch_location_mission_timer_cb, NULL, true); + + uos_timer_create(&s_watch_location_timer_id); + uos_timer_start(s_watch_location_timer_id, MMI_WATCH_LOCATION_PROCESS_DURATION, 0, mmi_watch_location_mission_timer_cb, NULL); mmi_watch_location_gps_start(); mmi_watch_location_cell_start(); 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 070e40b3..dbde8905 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 @@ -12,8 +12,14 @@ static nv_watch_protocol_data_t s_watch_protocol_data = {0}; static bool s_watch_bind_state = false; -static TIMER_ID s_watch_timed_mission_timer_id = NULL; +static void * s_watch_timed_mission_timer_id = NULL; static uint32_t s_watch_timed_location_time_stamp = 0, s_watch_timed_weather_time_stamp = 0; +static void * s_watch_heartbeat_action_timer_id = NULL; +static uint32_t s_watch_heartbeat_action_time_stamp = 0; + +static void mmi_protocol_watch_timed_mission_timer_cb(uint32_t para); +static void mmi_protocol_watch_heartbeat_timer_cb(uint32_t para); + bool mmi_watch_tcp_connect_state_get(void) { @@ -35,6 +41,26 @@ void mmi_protocol_receive_data_process(char * recv_str, int recv_len) mmi_protocol_fzd_receive_data_process(recv_str, recv_len); } +void * mmi_protocol_send_space_ptr_get(int cmd) +{ + mmi_protocol_fzd_send_space_ptr_get(cmd); +} + +int mmi_protocol_send_space_size_get(int cmd) +{ + return mmi_protocol_fzd_send_space_size_get(cmd); +} + +void mmi_protocol_send_space_free(int cmd) +{ + mmi_protocol_fzd_send_space_deinit(cmd); +} + +bool mmi_protocol_send_cmd_check(int cmd) +{ + return mmi_protocol_fzd_send_cmd_check(cmd); +} + void mmi_watch_protocol_data_nv_write(void) { uint32_t nv_data_length = sizeof(nv_watch_protocol_data_t); @@ -45,19 +71,25 @@ void mmi_watch_protocol_data_nv_write(void) } } -void mmi_watch_protocol_data_init(void) +void mmi_watch_protocol_data_nv_read(void) { uint32_t nv_data_length = sizeof(nv_watch_protocol_data_t); if(nv_data_length != UI_NV_Read_Req(NV_SECTION_UI_PROTOCOL_DATA, 0, nv_data_length, (uint8_t *)&s_watch_protocol_data)) { PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: nv read fail\n", __FUNCTION__, __LINE__); - s_watch_protocol_data.heartbeat_action_interval = MMI_PROTOCOL_HEARTBEAT_ACTION_INTERVAL; - s_watch_protocol_data.location_upload_interval = MMI_PROTOCOL_LOCATION_UPLOAD_INTERVAL; - s_watch_protocol_data.weather_update_interval = MMI_PROTOCOL_WEATHER_UPDATE_INTERVAL; } } +void mmi_watch_protocol_data_nv_default(nv_watch_protocol_data_t * data) +{ + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: nv default\n", __FUNCTION__, __LINE__); + + data->heartbeat_action_interval = MMI_PROTOCOL_HEARTBEAT_ACTION_INTERVAL; + data->location_upload_interval = MMI_PROTOCOL_LOCATION_UPLOAD_INTERVAL; + data->weather_update_interval = MMI_PROTOCOL_WEATHER_UPDATE_INTERVAL; +} + uint32_t mmi_protocol_watch_heartbeat_action_interval_get(void) { return (s_watch_protocol_data.heartbeat_action_interval); @@ -91,7 +123,7 @@ void mmi_protocol_watch_weather_update_interval_set(uint32_t value) mmi_watch_protocol_data_nv_write(); } -static void mmi_protocol_watch_timed_mission_timer_cb(void * para) +static void mmi_protocol_watch_timed_mission_timer_cb(uint32_t para) { uint32_t cur_time_stamp = 0; @@ -116,6 +148,8 @@ static void mmi_protocol_watch_timed_mission_timer_cb(void * para) mmi_health_measure_temperature_timed_action(false, cur_time_stamp); mmi_health_measure_blood_timed_action(false, cur_time_stamp); mmi_health_measure_spo2_timed_action(false, cur_time_stamp); + + uos_timer_start(s_watch_timed_mission_timer_id, 1000 * 20, 0, mmi_protocol_watch_timed_mission_timer_cb, NULL); } void mmi_protocol_watch_timed_mission_action(void) @@ -139,44 +173,51 @@ void mmi_protocol_watch_timed_mission_action(void) mmi_health_measure_blood_timed_action(true, cur_time_stamp); mmi_health_measure_spo2_timed_action(true, cur_time_stamp); - s_watch_timed_mission_timer_id = Hal_Timer_Start(1000 * 20, mmi_protocol_watch_timed_mission_timer_cb, NULL, TRUE); + uos_timer_create(&s_watch_timed_mission_timer_id); + uos_timer_start(s_watch_timed_mission_timer_id, 1000 * 20, 0, mmi_protocol_watch_timed_mission_timer_cb, NULL); } } -static TIMER_ID s_watch_heartbeat_action_timer_id = NULL; -static uint32_t s_watch_heartbeat_action_time_stamp = 0; - void mmi_protocol_watch_heartbeat_stop(void) { if(NULL != s_watch_heartbeat_action_timer_id) { - Hal_Timer_Stop(s_watch_heartbeat_action_timer_id); + uos_timer_stop(s_watch_heartbeat_action_timer_id); + uos_timer_delete(s_watch_heartbeat_action_timer_id); s_watch_heartbeat_action_timer_id = NULL; } } -static void mmi_protocol_watch_heartbeat_timer_cb(void * para) +static void mmi_protocol_watch_heartbeat_timer_cb(uint32_t para) { uint32_t cur_time_stamp = 0; Hal_Rtc_Gettime_Count(&cur_time_stamp); if(mmi_protocol_watch_heartbeat_action_interval_get() <= (cur_time_stamp - s_watch_heartbeat_action_time_stamp)) { + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: cur=%d, stamp=%d\n", __FUNCTION__, __LINE__, cur_time_stamp, s_watch_heartbeat_action_time_stamp); + mmi_protocol_action_link(); s_watch_heartbeat_action_time_stamp = cur_time_stamp; } + + uos_timer_start(s_watch_heartbeat_action_timer_id, 1000 * 20, 0, mmi_protocol_watch_heartbeat_timer_cb, NULL); } void mmi_protocol_watch_heartbeat_action(void) { if(NULL == s_watch_heartbeat_action_timer_id) { - mmi_watch_protocol_data_init(); + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + + mmi_watch_protocol_data_nv_read(); mmi_protocol_action_link(); Hal_Rtc_Gettime_Count(&s_watch_heartbeat_action_time_stamp); - s_watch_heartbeat_action_timer_id = Hal_Timer_Start(1000 * 20, mmi_protocol_watch_heartbeat_timer_cb, NULL, TRUE); + + uos_timer_create(&s_watch_heartbeat_action_timer_id); + uos_timer_start(s_watch_heartbeat_action_timer_id, 1000 * 20, 0, mmi_protocol_watch_heartbeat_timer_cb, NULL); } } @@ -187,10 +228,17 @@ bool mmi_protocol_action_link(void) bool mmi_protocol_check_state_before_send_action(void) { - if((false == watch_modem_sim_present_check_req()) - || (false == mmi_watch_tcp_connect_state_get()) - || (false == mmi_protocol_watch_bind_state_get()) - ) + if(false == watch_modem_sim_present_check_req()) + { + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return false; + } + if(false == mmi_watch_tcp_connect_state_get()) + { + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + return false; + } + if(false == mmi_protocol_watch_bind_state_get()) { PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); return false; 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 65a19cd0..c4b1c146 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 @@ -12,7 +12,7 @@ extern "C" #endif //__cplusplus -#define __MMI_PROTOCOL_DEBUG__ +//#define __MMI_PROTOCOL_DEBUG__ #ifdef __MMI_PROTOCOL_DEBUG__ #define PROTOCOL_DEBUG_PRINTF(fmt, ...) printf("[PROTOCOL]"fmt, ##__VA_ARGS__) #else @@ -41,6 +41,16 @@ void mmi_protocol_watch_bind_state_set(bool state); void mmi_protocol_receive_data_process(char * recv_str, int recv_len); +void * mmi_protocol_send_space_ptr_get(int cmd); + +int mmi_protocol_send_space_size_get(int cmd); + +void mmi_protocol_send_space_free(int cmd); + +bool mmi_protocol_send_cmd_check(int cmd); + +void mmi_watch_protocol_data_nv_default(nv_watch_protocol_data_t * data); + void mmi_protocol_watch_timed_mission_action(void); void mmi_protocol_watch_heartbeat_stop(void); 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 77e7e85c..d45ef9a8 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,7 +22,7 @@ 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); -signed char km_char_toupper(signed char c) +static signed char mmi_char_to_upper(signed char c) { if ( c >= 'a' && c <= 'z' ) { @@ -32,13 +32,38 @@ signed char km_char_toupper(signed char c) return c; } +static void mmi_float_to_str(double float_num, uint8_t int_num, char * data_str) +{ + uint8_t i = 0; + uint32_t high_part = 0; + double low_part = 0.0; + char high_part_str[16] = {0}, low_part_str[16] = {0}; + + high_part = (int)float_num; + sprintf(high_part_str, "%d", high_part); + + low_part = float_num - high_part; + for(i = 0; i < int_num; i++) + { + uint32_t temp_high = 0; + + low_part = low_part * 10; + temp_high = (int)low_part; + low_part -= temp_high; + low_part_str[i] = '0' + temp_high; + } + low_part_str[i] = '\0'; + + sprintf(data_str, "%s.%s", high_part_str, low_part_str); +} + void km_str_toupper(signed char *str, signed int len) { signed int i = 0; for(i=0;i= 'A')?upper - 'A' + 10:upper - '0'; number = number*16 + temp_num; } @@ -275,33 +300,34 @@ void * mmi_protocol_fzd_send_space_init(MMI_PROTOCOL_FZD_ACTION_ENUM action, int void mmi_protocol_fzd_send_space_deinit(MMI_PROTOCOL_FZD_ACTION_ENUM action) { - PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: action=%d\n", __FUNCTION__, __LINE__, action); - if (NULL != s_send_space_struct[action].ptr) { - PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: ptr=0x%x\n", __FUNCTION__, __LINE__, s_send_space_struct[action].ptr); + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: action=%d,ptr=0x%x\n", __FUNCTION__, __LINE__, action, s_send_space_struct[action].ptr); lv_mem_free(s_send_space_struct[action].ptr); s_send_space_struct[action].ptr = NULL; s_send_space_struct[action].size = 0; } } -void mmi_protocol_fzd_send_action_do(MMI_PROTOCOL_FZD_ACTION_ENUM action) +bool mmi_protocol_fzd_send_cmd_check(MMI_PROTOCOL_FZD_ACTION_ENUM action) { - unsigned char * send_space_ptr = (unsigned char *)mmi_protocol_fzd_send_space_ptr_get(action); - int send_space_size = mmi_protocol_fzd_send_space_size_get(action); - - PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: size=%d, content=%s\n", __FUNCTION__, __LINE__, send_space_size, send_space_ptr); - - if(send_space_size > 0) + if(MMI_FZD_ACTION_NONE >= action || MMI_FZD_ACTION_MAX <= action) { PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: action=%d\n", __FUNCTION__, __LINE__, action); - - //send_tcp_cmdmsg(int cmd_type, void* cmd_param) - send_tcp_cmdmsg(send_space_size, send_space_ptr); + return false; } - mmi_protocol_fzd_send_space_deinit(action); + return true; +} + +void mmi_protocol_fzd_send_action_do(MMI_PROTOCOL_FZD_ACTION_ENUM action) +{ + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: action=%d\n", __FUNCTION__, __LINE__, action); + + send_tcp_cmdmsg(action, NULL); + + //mmi_modem_tcp_send(send_space_ptr, send_space_size); + //mmi_protocol_fzd_send_space_deinit(action); } // [MD5_DATADEVICE_NAME*DEVICE_ID*CONTENT_LEN*ACTION_STRING,ACTION_CONTENT] @@ -421,8 +447,6 @@ bool mmi_protocol_fzd_receive_buff_store(unsigned char * recv_buffer, int recv_l } else if(NULL != s_receive_space_struct.incomplete_ptr && 0 != s_receive_space_struct.incomplete_len) { - //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: incomplete buffer is not null\n", __FUNCTION__, __LINE__); - temp_ptr = lv_mem_alloc(recv_len + s_receive_space_struct.incomplete_len); if (NULL != temp_ptr) { @@ -446,8 +470,6 @@ bool mmi_protocol_fzd_receive_buff_store(unsigned char * recv_buffer, int recv_l } else { - //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: incomplete buffer is null\n", __FUNCTION__, __LINE__); - temp_ptr = lv_mem_alloc(recv_len); if (NULL != temp_ptr) { @@ -551,7 +573,7 @@ bool mmi_protocol_fzd_receive_data_parse(void) //tail offset_tail_bracket = offset_third_sep + MMI_PROTOCOL_FZD_SEPARATOR_LEN + content_len; - PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: offset_tail_bracket=%d\n", __FUNCTION__, __LINE__, offset_tail_bracket); + //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: offset_tail_bracket=%d\n", __FUNCTION__, __LINE__, offset_tail_bracket); if(0 != strncmp(recv_buffer + i + offset_tail_bracket, MMI_PROTOCOL_FZD_TAIL_BRACKET, MMI_PROTOCOL_FZD_BRACKET_LEN)) // ] { PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: tail check error\n", __FUNCTION__, __LINE__); @@ -1192,8 +1214,10 @@ bool mmi_protocol_fzd_action_send_temperature(float temp_value) MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_ACTION_SEND_TEMPERATURE; unsigned char content_buff[8] = {0}; unsigned int content_lenth = 0; + char data_str[8] = {0}; - sprintf(content_buff, ",%.1f", temp_value); + mmi_float_to_str(temp_value, 1, data_str); + sprintf(content_buff, ",%s", data_str); content_lenth = strlen(content_buff); result = mmi_protocol_fzd_send_content_construct(action, content_buff, content_lenth); @@ -1548,6 +1572,49 @@ bool mmi_protocol_fzd_parse_ACTION_TALK(unsigned char * next_buff, unsigned int } #endif +static void mmi_location_gps_data_process(MMI_WATCH_GPS_DATA_T * gps_data, char * data_str) +{ + char state_str[2] = {0}; + char latitude_str[16] = {0}, longitude_str[16] = {0}; + char ns_str[2] = {0}, ew_str[2] = {0}; + char speed_str[8] = {0}, degree_str[8] = {0}, altitude_str[8] = {0}; + + if('A' == gps_data->state) + state_str[0] = 'A'; + else + state_str[0] = 'V'; + + mmi_float_to_str(gps_data->latitude, 6, latitude_str); + + if('N' == gps_data->ns) + ns_str[0] = 'N'; + else if('S' == gps_data->ns) + ns_str[0] = 'S'; + else + ns_str[0] = '0'; + + mmi_float_to_str(gps_data->longitude, 6, longitude_str); + + if('E' == gps_data->ew) + ew_str[0] = 'E'; + else if('W' == gps_data->ew) + ew_str[0] = 'W'; + else + ew_str[0] = '0'; + + mmi_float_to_str(gps_data->speed, 2, speed_str); + + mmi_float_to_str(gps_data->degree, 1, degree_str); + + mmi_float_to_str(gps_data->altitude, 1, altitude_str); + + sprintf(data_str, "%s,%s,%s,%s,%s,%s,%s,%s,%u", + state_str, + latitude_str, ns_str, longitude_str, ew_str, + speed_str, degree_str, altitude_str, + gps_data->satellite_num); +} + static unsigned int mmi_protocol_fzd_action_send_content_fill_location_data(unsigned char * content_buff, unsigned int content_lenth, MMI_WATCH_LOCATION_DATA_T * location_data, @@ -1561,6 +1628,7 @@ static unsigned int mmi_protocol_fzd_action_send_content_fill_location_data(unsi unsigned int sleep_roll_value = 0; unsigned int step_value = 0; uint8_t i = 0; + char data_str[128] = {0}; t_ptr = content_buff; @@ -1572,16 +1640,8 @@ static unsigned int mmi_protocol_fzd_action_send_content_fill_location_data(unsi //gps t_ptr += t_count; - sprintf(t_ptr, ",%c,%02.06f,%c,%03.06f,%c,%01.02f,%03.01f,%03.01f,%u", - location_data->gps_data.state, - location_data->gps_data.latitude, - location_data->gps_data.ns, - location_data->gps_data.longitude, - location_data->gps_data.ew, - location_data->gps_data.speed, - location_data->gps_data.degree, - location_data->gps_data.altitude, - location_data->gps_data.satellite_num); + mmi_location_gps_data_process(&(location_data->gps_data), data_str); + sprintf(t_ptr, ",%s", data_str); t_count = strlen(t_ptr); // 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 0dbf0c86..d82caaa2 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 @@ -16,14 +16,6 @@ extern "C" -//#define __MMI_PROTOCOL_DEBUG__ -//#ifdef __MMI_PROTOCOL_DEBUG__ -//#define PROTOCOL_DEBUG_PRINTF(fmt, ...) printf("[FZD]"fmt, ##__VA_ARGS__) -//#else -//#define PROTOCOL_DEBUG_PRINTF(fmt, ...) -//#endif - - //Server address and port //#define HOST_NAME "api.xcloudtech.com" //#define HOST_PORT (9000) @@ -144,6 +136,14 @@ signed int km_str_hex_string_to_number(signed char* hex_str, unsigned char hex_s 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); + +int mmi_protocol_fzd_send_space_size_get(MMI_PROTOCOL_FZD_ACTION_ENUM action); + +void mmi_protocol_fzd_send_space_deinit(MMI_PROTOCOL_FZD_ACTION_ENUM action); + +bool mmi_protocol_fzd_send_cmd_check(MMI_PROTOCOL_FZD_ACTION_ENUM action); + bool mmi_protocol_fzd_action_link(void); bool mmi_protocol_fzd_parse_ACTION_LINK(unsigned char * next_buff, unsigned int next_buff_len); 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 4d9c523b..9c2ab7be 100644 --- a/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.c +++ b/2.sdk/gui/lv_watch/mmi_sundry/mmi_sundry.c @@ -55,6 +55,7 @@ void mmi_watch_search_screen_destroy(void) //{ // Hal_Tone_Play_End(); //} + Hal_NFFS_File_Play_End(); Hal_Audio_Manage_End_Ind(AUDIO_CTRL_PRIORITY_SEARCH); Hal_Vibrator_Play_End(); diff --git a/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_manage.c b/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_manage.c index 06316fc4..fddc2349 100644 --- a/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_manage.c +++ b/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_manage.c @@ -314,7 +314,7 @@ int mmi_modem_tcp_send(char *pkg_data, int pkg_len) if(tcp_manage_instance.sock_fd > 0) { ret = ValSend(tcp_manage_instance.sock_fd, DT_SOCKE_REV_TIMEOUT, pkg_data, pkg_len); - printf("fun = %s, line = %d, ret = %d\n",__FUNCTION__,__LINE__,ret); + printf("[@CHENG_DEBUG][%s][%d]: ret=%d\n", __FUNCTION__, __LINE__, ret); if(ret < 0){ send_task_msg_tcp_reconnect(NULL); } diff --git a/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_net.c b/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_net.c index 517e41d8..aa6ab60b 100644 --- a/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_net.c +++ b/2.sdk/gui/lv_watch/modem/mmi_modem_tcp/mmi_modem_tcp_net.c @@ -23,6 +23,13 @@ void tcp_connect_cb(int t) void mmi_modem_tcp_task_init(void) { mmi_modem_tcp_task_interface_init(); + +#ifdef __MMI_ZHSX_SUPPORT__ + printf("[@CHENG_DEBUG][%s][%d]: \n",__FUNCTION__,__LINE__); + + launcher_tcp_connect(NULL); + +#else launcher_tcp_connect(tcp_connect_cb); //while(1) // { @@ -30,6 +37,7 @@ void mmi_modem_tcp_task_init(void) // uos_sleep(3); // } uart_printf("mmi_modem_tcp_task_init!!!!!!!\n"); +#endif } tcp_manage_instance_t * get_manage_instance(void) -- 2.17.1