From: CCC <2393524978@qq.com> Date: Thu, 21 Dec 2023 06:50:48 +0000 (+0800) Subject: gengxin X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=95f23238efd3e6be15ce884bc4d74f1a0325529e;p=mirrors%2FASR3603_Z5.git gengxin --- diff --git a/2.sdk/sdk/gui/lv_watch/mmi_location/mmi_location.c b/2.sdk/sdk/gui/lv_watch/mmi_location/mmi_location.c index 8bcbef9b..bc78793c 100644 --- a/2.sdk/sdk/gui/lv_watch/mmi_location/mmi_location.c +++ b/2.sdk/sdk/gui/lv_watch/mmi_location/mmi_location.c @@ -370,8 +370,14 @@ void mmi_watch_location_wifi_scan_cb(WIFI_SCAN_ID_DEF msgid, WifiInfoT *wifi_inf uint8_t j = 0; for(j = 0; j < APP_ADP_WIFI_MAC_LEN; j++) { - s_watch_location_data.wifi_data.item[i].mac[j] = mmi_hex_string_to_number(wifi_info->WifiHotspot[i].MacAddr[j * 2], 2); + s_watch_location_data.wifi_data.item[i].mac[j] = mmi_hex_string_to_number(wifi_info->WifiHotspot[i].MacAddr + (j * 2), 2); + //LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %d-%s\n", __LINE__, + // s_watch_location_data.wifi_data.item[i].mac[j], + // wifi_info->WifiHotspot[i].MacAddr + (j * 2)); } + LOCATION_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %d-%s\n", __LINE__, + wifi_info->WifiHotspot[i].Rssi, + wifi_info->WifiHotspot[i].MacAddr); } } else diff --git a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c index 6e36b5e4..199d727b 100644 --- a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c +++ b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.c @@ -458,6 +458,42 @@ bool mmi_protocol_action_sos(void) return true; } +bool mmi_protocol_action_low_battery(void) +{ + if(0 == mmi_low_battery_switch_get()) + return false; + + mmi_protocol_fzd_set_warning_info(MMI_FZD_WARNING_TYPE_LOW_BATTERY, true); + return true; +} + +bool mmi_protocol_action_take_off(void) +{ + if(0 == mmi_take_off_switch_get()) + return false; + + mmi_protocol_fzd_set_warning_info(MMI_FZD_WARNING_TYPE_TAKE_OFF, true); + return true; +} + +bool mmi_protocol_action_take_on(void) +{ + if(0 == mmi_take_off_switch_get()) + return false; + + mmi_protocol_fzd_set_warning_info(MMI_FZD_WARNING_TYPE_TAKE_ON, true); + return true; +} + +bool mmi_protocol_action_fall_down(void) +{ + if(0 == mmi_fall_down_switch_get()) + return false; + + mmi_protocol_fzd_set_warning_info(MMI_FZD_WARNING_TYPE_FALL_DOWN, true); + return true; +} + bool mmi_protocol_action_unbind(void) { mmi_protocol_fzd_action_unbind(); diff --git a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.h b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.h index 9e9e5e05..0bc7189e 100644 --- a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.h +++ b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_api.h @@ -87,6 +87,10 @@ 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_low_battery(void); +bool mmi_protocol_action_take_off(void); +bool mmi_protocol_action_take_on(void); +bool mmi_protocol_action_fall_down(void); bool mmi_protocol_action_unbind(void); diff --git a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c index 2ee96a9f..3eb07874 100644 --- a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c +++ b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c @@ -517,7 +517,7 @@ bool mmi_protocol_fzd_action_HEARTBEAT(void) unsigned int content_lenth = 0; hal_rtc_t cur_time = {0}; int step_num = asl_pedometer_steps_get(); - int roll_num = 0; + int roll_num = mmi_sleep_roll_number_get(); int battery_percent = Hal_Battery_Get_Status(); content_buff = (unsigned char *)lv_mem_alloc(128); @@ -2784,6 +2784,69 @@ bool mmi_protocol_fzd_parse_SERVER_SET_WHITE_LIST_SWITCH(unsigned char * next_bu return result; } +// 0-off; 1-on +bool mmi_protocol_fzd_parse_SERVER_SET_LOW_BATTERY_SWITCH(unsigned char * next_buff, unsigned int next_buff_len) +{ + bool result = false; + MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_LOW_BATTERY_SWITCH; + + 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_send_without_data(action); + + uint32_t value = atoi(next_buff); + mmi_low_battery_switch_set(value); + + return result; +} + +// 0-off; 1-on +bool mmi_protocol_fzd_parse_SERVER_SET_FALL_DOWN_SWITCH(unsigned char * next_buff, unsigned int next_buff_len) +{ + bool result = false; + MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_FALL_DOWN_SWITCH; + + 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_send_without_data(action); + + uint32_t value = atoi(next_buff); + mmi_fall_down_switch_set(value); + + return result; +} + +// 0-off; 1-on +bool mmi_protocol_fzd_parse_SERVER_SET_TAKE_OFF_SWITCH(unsigned char * next_buff, unsigned int next_buff_len) +{ + bool result = false; + MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_TAKE_OFF_SWITCH; + + 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_send_without_data(action); + + uint32_t value = atoi(next_buff); + mmi_take_off_switch_set(value); + + return result; +} + #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__ //[XX*YYYY*0018*REMIND,08:10-1-1,08:10-1-2, 08:10-1-3-0111110] //[SZKW*860132060004801*0034*REMIND,10:00-1-1,10:02-1-3-0111000,10:03-1-3-0111111] @@ -2801,7 +2864,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_WAKE_UP(unsigned char * next_buff, result = true; mmi_protocol_fzd_send_without_data(action); - nv_watch_remind_wake_up_t t_data = {0}; + nv_watch_remind_item_t t_data = {0}; char * group_str = NULL; char * group_last = NULL; char * temp_ptr = NULL; @@ -2813,8 +2876,6 @@ bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_WAKE_UP(unsigned char * next_buff, //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: temp_ptr1=%s,next_buff=%s\n", __FUNCTION__, __LINE__, group_str, next_buff); while(NULL != group_str) { - t_data.remind_info[i].valid = 1; - temp_ptr = km_strtok_r(group_str, ":", &last); t_data.remind_info[i].hour = atoi(temp_ptr); @@ -2822,7 +2883,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_WAKE_UP(unsigned char * next_buff, t_data.remind_info[i].min = atoi(temp_ptr); temp_ptr = km_strtok_r(NULL, "-", &last); - t_data.remind_info[i].on_off = atoi(temp_ptr); + t_data.remind_info[i].is_valid = atoi(temp_ptr); temp_ptr = km_strtok_r(NULL, "-", &last); //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: temp_ptr=%s,last=%s\n", __FUNCTION__, __LINE__, temp_ptr, last); @@ -2850,7 +2911,7 @@ bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_WAKE_UP(unsigned char * next_buff, } i++; - if(NV_REMIND_WAKE_UP_MAX_NUM <= i) + if(NV_REMIND_ITEM_MAX_NUM <= i) { break; } @@ -2864,6 +2925,330 @@ bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_WAKE_UP(unsigned char * next_buff, } #endif +#ifdef __MMI_REMIND_SLEEP_SUPPORT__ +// [SZKW*876226002021592*001B*REMIND_CH_SLEEP,11:00-1-2,,] +bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_SLEEP(unsigned char * next_buff, unsigned int next_buff_len) +{ + bool result = false; + MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_REMIND_SLEEP; + + 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_send_without_data(action); + + nv_watch_remind_item_t t_data = {0}; + char * group_str = NULL; + char * group_last = NULL; + char * temp_ptr = NULL; + char * last = NULL; + uint8_t i = 0; + + //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: next_buff=%s\n", __FUNCTION__, __LINE__, next_buff); + group_str = km_strtok_r(next_buff, ",", &group_last); + //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: temp_ptr1=%s,next_buff=%s\n", __FUNCTION__, __LINE__, group_str, next_buff); + while(NULL != group_str) + { + temp_ptr = km_strtok_r(group_str, ":", &last); + t_data.remind_info[i].hour = atoi(temp_ptr); + + temp_ptr = km_strtok_r(NULL, "-", &last); + t_data.remind_info[i].min = atoi(temp_ptr); + + temp_ptr = km_strtok_r(NULL, "-", &last); + t_data.remind_info[i].is_valid = atoi(temp_ptr); + + temp_ptr = km_strtok_r(NULL, "-", &last); + //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: temp_ptr=%s,last=%s\n", __FUNCTION__, __LINE__, temp_ptr, last); + if(1 == atoi(temp_ptr)) + { + t_data.remind_info[i].repeat_bitmap = 0; + } + else if(2 == atoi(temp_ptr)) + { + t_data.remind_info[i].repeat_bitmap = 0xff; + } + else + { + //server_set_alarm[i].repeat_bitmap = 0xff; + t_data.remind_info[i].repeat_bitmap = 0x80; + if(NULL != last) + { + uint8_t j = 0; + for(j = 0; j < 7; j++) + { + //server_set_alarm[i].repeat_bitmap &= ((('0' == *(last + j)) ? 0 : 1) << j); + t_data.remind_info[i].repeat_bitmap |= ((('0' == *(last + j)) ? 0 : 1) << j); + } + } + } + + i++; + if(NV_REMIND_ITEM_MAX_NUM <= i) + { + break; + } + + group_str = km_strtok_r(NULL, ",", &group_last); + } + + mmi_remind_sleep_data_set(&t_data); + + return result; +} +#endif + +// [*REMIND_CH_REST,01:00-00:03,22:00-23:00] +// [*REMIND_CH_REST,] +#ifdef __MMI_REMIND_REST_SUPPORT__ +bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_REST(unsigned char * next_buff, unsigned int next_buff_len) +{ + bool result = false; + MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_REMIND_REST; + + nv_watch_remind_rest_t t_data = {0}; + + if(NULL == next_buff || 0 == next_buff_len) + { + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + } + else + { + char * group_str = NULL; + char * group_last = NULL; + char * temp_ptr = NULL; + char * last = NULL; + uint8_t i = 0; + + t_data.is_valid = 1; + + //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: next_buff=%s\n", __FUNCTION__, __LINE__, next_buff); + group_str = km_strtok_r(next_buff, ",", &group_last); + //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: temp_ptr1=%s,next_buff=%s\n", __FUNCTION__, __LINE__, group_str, next_buff); + while(NULL != group_str) + { + temp_ptr = km_strtok_r(group_str, ":", &last); + t_data.remind_info[i].hour_begin = atoi(temp_ptr); + + temp_ptr = km_strtok_r(NULL, "-", &last); + t_data.remind_info[i].min_begin = atoi(temp_ptr); + + temp_ptr = km_strtok_r(NULL, ":", &last); + t_data.remind_info[i].hour_end = atoi(temp_ptr); + + temp_ptr = km_strtok_r(NULL, "-", &last); + t_data.remind_info[i].min_end = atoi(temp_ptr); + + i++; + if(NV_REMIND_REST_MAX_NUM <= i) + { + break; + } + + group_str = km_strtok_r(NULL, ",", &group_last); + } + } + + result = true; + mmi_protocol_fzd_send_without_data(action); + + mmi_remind_rest_data_set(&t_data); + + return result; +} +#endif + +// [*REMIND_CH_HOME,01:00] [*REMIND_CH_HOME,] +#ifdef __MMI_REMIND_HOME_SUPPORT__ +bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_HOME(unsigned char * next_buff, unsigned int next_buff_len) +{ + bool result = false; + MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_REMIND_HOME; + + nv_watch_remind_home_t t_data = {0}; + + if(NULL == next_buff || 0 == next_buff_len) + { + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + } + else + { + char * temp_ptr = NULL; + + t_data.is_valid = 1; + + temp_ptr = km_strtok_r(NULL, ":", &next_buff); + t_data.hour = atoi(temp_ptr); + + temp_ptr = next_buff; + t_data.min = atoi(temp_ptr); + } + + result = true; + mmi_protocol_fzd_send_without_data(action); + + mmi_remind_home_data_set(&t_data); + + return result; +} +#endif + +// [*REMIND_CH_MEDICINE,02:00,01:00,10:00] +// [*REMIND_CH_MEDICINE,01:00,00:00] +// [*REMIND_CH_MEDICINE,] +#ifdef __MMI_REMIND_MEDICINE_SUPPORT__ +bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_MEDICINE(unsigned char * next_buff, unsigned int next_buff_len) +{ + bool result = false; + MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_REMIND_MEDICINE; + + nv_watch_remind_medicine_t t_data = {0}; + + if(NULL == next_buff || 0 == next_buff_len) + { + PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__); + } + else + { + char * group_str = NULL; + char * group_last = NULL; + char * temp_ptr = NULL; + char * last = NULL; + uint8_t i = 0; + + //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: next_buff=%s\n", __FUNCTION__, __LINE__, next_buff); + group_str = km_strtok_r(next_buff, ",", &group_last); + //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: temp_ptr1=%s,next_buff=%s\n", __FUNCTION__, __LINE__, group_str, next_buff); + while(NULL != group_str) + { + t_data.remind_info[i].is_valid = 1; + + temp_ptr = km_strtok_r(group_str, ":", &last); + t_data.remind_info[i].hour = atoi(temp_ptr); + + temp_ptr = km_strtok_r(NULL, ":", &last); + t_data.remind_info[i].min = atoi(temp_ptr); + + i++; + if(NV_REMIND_MEDICINE_MAX_NUM <= i) + { + break; + } + + group_str = km_strtok_r(NULL, ",", &group_last); + } + } + + result = true; + mmi_protocol_fzd_send_without_data(action); + + mmi_remind_medicine_data_set(&t_data); + + return result; +} +#endif + +// [*REMIND_CH_MEDICINE2,10:00-1,14:00-0,18:00-0,1111111] +// [*REMIND_CH_MEDICINE2,09:00-1,14:00-0,18:00-1,1111111] +#ifdef __MMI_REMIND_CUSTOM_MEDICINE_SUPPORT__ +bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_CUSTOM_MEDICINE(unsigned char * next_buff, unsigned int next_buff_len) +{ + bool result = false; + MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_REMIND_CUSTOM_MEDICINE; + + 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_send_without_data(action); + + nv_watch_remind_custom_medicine_t t_data = {0}; + char * group_str = NULL; + char * group_last = NULL; + char * temp_ptr = NULL; + char * last = NULL; + uint8_t i = 0; + + //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: next_buff=%s\n", __FUNCTION__, __LINE__, next_buff); + group_str = km_strtok_r(next_buff, ",", &group_last); + //PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: temp_ptr1=%s,next_buff=%s\n", __FUNCTION__, __LINE__, group_str, next_buff); + while(NULL != group_str) + { + temp_ptr = km_strtok_r(group_str, ":", &last); + t_data.remind_info[i].hour = atoi(temp_ptr); + + temp_ptr = km_strtok_r(NULL, "-", &last); + t_data.remind_info[i].min = atoi(temp_ptr); + + temp_ptr = last; + t_data.remind_info[i].is_valid = atoi(temp_ptr); + + i++; + if(NV_REMIND_CUSTOM_MEDICINE_MAX_NUM <= i) + { + break; + } + + group_str = km_strtok_r(NULL, ",", &group_last); + } + + //server_set_alarm[i].repeat_bitmap = 0xff; + t_data.repeat_bitmap = 0x80; + if(NULL != group_last) + { + uint8_t j = 0; + for(j = 0; j < 7; j++) + { + //server_set_alarm[i].repeat_bitmap &= ((('0' == *(last + j)) ? 0 : 1) << j); + t_data.repeat_bitmap |= ((('0' == *(last + j)) ? 0 : 1) << j); + } + } + + mmi_remind_custom_medicine_data_set(&t_data); + + return result; +} +#endif + +// [*REMIND_CH_DRINK,4-1] +#ifdef __MMI_REMIND_DRINK_SUPPORT__ +bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_DRINK(unsigned char * next_buff, unsigned int next_buff_len) +{ + bool result = false; + MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_REMIND_DRINK; + + 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_send_without_data(action); + + nv_watch_remind_drink_t t_data = {0}; + char * temp_ptr = NULL; + + temp_ptr = km_strtok_r(NULL, "-", &next_buff); + t_data.hour_value = atoi(temp_ptr); + + temp_ptr = next_buff; + t_data.is_valid = atoi(temp_ptr); + + mmi_remind_drink_data_set(&t_data); + + return result; +} +#endif + + #ifdef __MMI_CUSTOM_HENG_AI__ bool mmi_protocol_fzd_parse_SERVER_SET_HENG_AI_WAKE_NOW(unsigned char * next_buff, unsigned int next_buff_len) { diff --git a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.h b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.h index 28f07bdc..096e1662 100644 --- a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.h +++ b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.h @@ -154,10 +154,30 @@ typedef enum #endif MMI_FZD_SERVER_SET_DIAL_PAD_SWITCH, MMI_FZD_SERVER_SET_WHITE_LIST_SWITCH, + MMI_FZD_SERVER_SET_LOW_BATTERY_SWITCH, + MMI_FZD_SERVER_SET_FALL_DOWN_SWITCH, + MMI_FZD_SERVER_SET_TAKE_OFF_SWITCH, #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__ MMI_FZD_SERVER_SET_REMIND_WAKE_UP, #endif - +#ifdef __MMI_REMIND_SLEEP_SUPPORT__ + MMI_FZD_SERVER_SET_REMIND_SLEEP, +#endif +#ifdef __MMI_REMIND_REST_SUPPORT__ + MMI_FZD_SERVER_SET_REMIND_REST, +#endif +#ifdef __MMI_REMIND_HOME_SUPPORT__ + MMI_FZD_SERVER_SET_REMIND_HOME, +#endif +#ifdef __MMI_REMIND_MEDICINE_SUPPORT__ + MMI_FZD_SERVER_SET_REMIND_MEDICINE, +#endif +#ifdef __MMI_REMIND_CUSTOM_MEDICINE_SUPPORT__ + MMI_FZD_SERVER_SET_REMIND_CUSTOM_MEDICINE, +#endif +#ifdef __MMI_REMIND_DRINK_SUPPORT__ + MMI_FZD_SERVER_SET_REMIND_DRINK, +#endif #ifdef __MMI_CUSTOM_HENG_AI__ MMI_FZD_SERVER_SET_HENG_AI_WAKE_NOW, MMI_FZD_SERVER_SET_HENG_AI_WAKE_RING_TYPE, @@ -286,9 +306,31 @@ bool mmi_protocol_fzd_parse_SERVER_SET_NOT_DISTURB(unsigned char * next_buff, un #endif bool mmi_protocol_fzd_parse_SERVER_SET_DIAL_PAD_SWITCH(unsigned char * next_buff, unsigned int next_buff_len); bool mmi_protocol_fzd_parse_SERVER_SET_WHITE_LIST_SWITCH(unsigned char * next_buff, unsigned int next_buff_len); +bool mmi_protocol_fzd_parse_SERVER_SET_LOW_BATTERY_SWITCH(unsigned char * next_buff, unsigned int next_buff_len); +bool mmi_protocol_fzd_parse_SERVER_SET_FALL_DOWN_SWITCH(unsigned char * next_buff, unsigned int next_buff_len); +bool mmi_protocol_fzd_parse_SERVER_SET_TAKE_OFF_SWITCH(unsigned char * next_buff, unsigned int next_buff_len); + #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__ bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_WAKE_UP(unsigned char * next_buff, unsigned int next_buff_len); #endif +#ifdef __MMI_REMIND_SLEEP_SUPPORT__ +bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_SLEEP(unsigned char * next_buff, unsigned int next_buff_len); +#endif +#ifdef __MMI_REMIND_REST_SUPPORT__ +bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_REST(unsigned char * next_buff, unsigned int next_buff_len); +#endif +#ifdef __MMI_REMIND_HOME_SUPPORT__ +bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_HOME(unsigned char * next_buff, unsigned int next_buff_len); +#endif +#ifdef __MMI_REMIND_MEDICINE_SUPPORT__ +bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_MEDICINE(unsigned char * next_buff, unsigned int next_buff_len); +#endif +#ifdef __MMI_REMIND_CUSTOM_MEDICINE_SUPPORT__ +bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_CUSTOM_MEDICINE(unsigned char * next_buff, unsigned int next_buff_len); +#endif +#ifdef __MMI_REMIND_DRINK_SUPPORT__ +bool mmi_protocol_fzd_parse_SERVER_SET_REMIND_DRINK(unsigned char * next_buff, unsigned int next_buff_len); +#endif #ifdef __MMI_CUSTOM_HENG_AI__ bool mmi_protocol_fzd_parse_SERVER_SET_HENG_AI_WAKE_NOW(unsigned char * next_buff, unsigned int next_buff_len); bool mmi_protocol_fzd_parse_SERVER_SET_HENG_AI_WAKE_RING_TYPE(unsigned char * next_buff, unsigned int next_buff_len); diff --git a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd_content.c b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd_content.c index 452a73f6..21203673 100644 --- a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd_content.c +++ b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd_content.c @@ -86,9 +86,30 @@ static unsigned char * mmi_protocol_fzd_action_string_get(MMI_PROTOCOL_FZD_ACTIO #endif {MMI_FZD_SERVER_SET_DIAL_PAD_SWITCH, "KEYBRD"}, {MMI_FZD_SERVER_SET_WHITE_LIST_SWITCH, "WLKEY"}, + {MMI_FZD_SERVER_SET_LOW_BATTERY_SWITCH, "LOWBAT"}, + {MMI_FZD_SERVER_SET_FALL_DOWN_SWITCH, "FALLDOWN"}, + {MMI_FZD_SERVER_SET_TAKE_OFF_SWITCH, "REMOVE"}, #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__ {MMI_FZD_SERVER_SET_REMIND_WAKE_UP, "REMIND_CH_WAKEUP"}, #endif + #ifdef __MMI_REMIND_SLEEP_SUPPORT__ + {MMI_FZD_SERVER_SET_REMIND_SLEEP, "REMIND_CH_SLEEP"}, + #endif + #ifdef __MMI_REMIND_REST_SUPPORT__ + {MMI_FZD_SERVER_SET_REMIND_REST, "REMIND_CH_REST"}, + #endif + #ifdef __MMI_REMIND_HOME_SUPPORT__ + {MMI_FZD_SERVER_SET_REMIND_HOME, "REMIND_CH_HOME"}, + #endif + #ifdef __MMI_REMIND_MEDICINE_SUPPORT__ + {MMI_FZD_SERVER_SET_REMIND_MEDICINE, "REMIND_CH_MEDICINE"}, + #endif + #ifdef __MMI_REMIND_CUSTOM_MEDICINE_SUPPORT__ + {MMI_FZD_SERVER_SET_REMIND_CUSTOM_MEDICINE, "REMIND_CH_MEDICINE2"}, + #endif + #ifdef __MMI_REMIND_DRINK_SUPPORT__ + {MMI_FZD_SERVER_SET_REMIND_DRINK, "REMIND_CH_DRINK"}, + #endif #ifdef __MMI_CUSTOM_HENG_AI__ {MMI_FZD_SERVER_SET_HENG_AI_WAKE_NOW, "HENG_AI_WAKE_NOW"}, {MMI_FZD_SERVER_SET_HENG_AI_WAKE_RING_TYPE, "HENG_AI_WAKE_RING_TYPE"}, @@ -321,12 +342,54 @@ static bool mmi_protocol_fzd_content_parse(unsigned char * content_ptr, unsigned case MMI_FZD_SERVER_SET_WHITE_LIST_SWITCH: mmi_protocol_fzd_parse_SERVER_SET_WHITE_LIST_SWITCH(next_buff, next_buff_len); break; + + case MMI_FZD_SERVER_SET_LOW_BATTERY_SWITCH: + mmi_protocol_fzd_parse_SERVER_SET_LOW_BATTERY_SWITCH(next_buff, next_buff_len); + break; + + case MMI_FZD_SERVER_SET_FALL_DOWN_SWITCH: + mmi_protocol_fzd_parse_SERVER_SET_FALL_DOWN_SWITCH(next_buff, next_buff_len); + break; + + case MMI_FZD_SERVER_SET_TAKE_OFF_SWITCH: + mmi_protocol_fzd_parse_SERVER_SET_TAKE_OFF_SWITCH(next_buff, next_buff_len); + break; #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__ case MMI_FZD_SERVER_SET_REMIND_WAKE_UP: mmi_protocol_fzd_parse_SERVER_SET_REMIND_WAKE_UP(next_buff, next_buff_len); break; #endif + #ifdef __MMI_REMIND_SLEEP_SUPPORT__ + case MMI_FZD_SERVER_SET_REMIND_SLEEP: + mmi_protocol_fzd_parse_SERVER_SET_REMIND_SLEEP(next_buff, next_buff_len); + break; + #endif + #ifdef __MMI_REMIND_REST_SUPPORT__ + case MMI_FZD_SERVER_SET_REMIND_REST: + mmi_protocol_fzd_parse_SERVER_SET_REMIND_REST(next_buff, next_buff_len); + break; + #endif + #ifdef __MMI_REMIND_HOME_SUPPORT__ + case MMI_FZD_SERVER_SET_REMIND_HOME: + mmi_protocol_fzd_parse_SERVER_SET_REMIND_HOME(next_buff, next_buff_len); + break; + #endif + #ifdef __MMI_REMIND_MEDICINE_SUPPORT__ + case MMI_FZD_SERVER_SET_REMIND_MEDICINE: + mmi_protocol_fzd_parse_SERVER_SET_REMIND_MEDICINE(next_buff, next_buff_len); + break; + #endif + #ifdef __MMI_REMIND_CUSTOM_MEDICINE_SUPPORT__ + case MMI_FZD_SERVER_SET_REMIND_CUSTOM_MEDICINE: + mmi_protocol_fzd_parse_SERVER_SET_REMIND_CUSTOM_MEDICINE(next_buff, next_buff_len); + break; + #endif + #ifdef __MMI_REMIND_DRINK_SUPPORT__ + case MMI_FZD_SERVER_SET_REMIND_DRINK: + mmi_protocol_fzd_parse_SERVER_SET_REMIND_DRINK(next_buff, next_buff_len); + break; + #endif #ifdef __MMI_CUSTOM_HENG_AI__ case MMI_FZD_SERVER_SET_HENG_AI_WAKE_NOW: diff --git a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.c b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.c index d1e6e4ec..c7b7b1cf 100644 --- a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.c +++ b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.c @@ -19,6 +19,8 @@ static MMI_PROTOCOL_SMS_PARSE_STRUCT s_sms_parse_info[] = {"GETIMEI", 7, mmi_protocol_sms_parse_get_imei}, {"UNBIND", 6, mmi_protocol_sms_parse_unbind}, /* Function not verified */ {"SETAPN:", 7, mmi_protocol_sms_parse_set_apn}, /* Function not verified */ + {"ts#", 3, mmi_protocol_sms_parse_get_info}, + {"TS#", 3, mmi_protocol_sms_parse_get_info}, /*******add before this line*******/ @@ -89,9 +91,18 @@ static void mmi_protocol_sms_parse_sms_reply(char * content_str, char * fixed_st 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) + { + if(MMI_REPLY_SMS_DATA_LEN_MAX <= strlen(content_str)) + { + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: content_str too large\n", __FUNCTION__, __LINE__); + _lv_memset_00(content_str + MMI_REPLY_SMS_DATA_LEN_MAX - 1, sizeof(content_str + MMI_REPLY_SMS_DATA_LEN_MAX - 1)); + } sprintf(sms_data, "%s", content_str); + } else + { sprintf(sms_data, "%s OK", fixed_str); + } uint8_t sms_data_len = strlen(sms_data); @@ -549,6 +560,47 @@ bool mmi_protocol_sms_parse_set_apn(char * fixed_str, char * data, char * number } +// get device info +bool mmi_protocol_sms_parse_get_info(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[MMI_REPLY_SMS_DATA_LEN_MAX] = {0}; + char imei_str[16] = {0}; + char * mode_str = app_adaptor_get_model_id(); + char * version_str = app_adaptor_get_version(); + char * host_name_str = mmi_watch_host_name_get(); + int host_port_value = mmi_watch_host_port_get(); + uint32_t heartbeat_value = mmi_protocol_watch_heartbeat_action_interval_get(); + uint32_t upload_value = mmi_protocol_watch_location_upload_interval_get(); + uint32_t battery_percent = Hal_Battery_Get_Status(); + + app_adp_get_imei_req(imei_str); + + sprintf(content_str, "Mode:%s\nVersion:%s\nServer:%s:%d\nIMEI:%s\nConnectTime:%d\nUpload:%d\nBattery:%d", + mode_str, + version_str, + host_name_str, + host_port_value, + imei_str, + heartbeat_value, + upload_value, + battery_percent); + SMS_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: len=%d\n", __FUNCTION__, __LINE__, strlen(content_str)); + + mmi_protocol_sms_parse_sms_reply(content_str, NULL, number, NULL); + + return true; +} + + #endif diff --git a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.h b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.h index 14ca504a..903c1cda 100644 --- a/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.h +++ b/2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_sms.h @@ -27,7 +27,7 @@ extern "C" #endif -#define MMI_REPLY_SMS_DATA_LEN_MAX (128) +#define MMI_REPLY_SMS_DATA_LEN_MAX (512) typedef bool (* SMS_PARSE_CB)(char *, char *, char *); @@ -51,6 +51,7 @@ bool mmi_protocol_sms_parse_set_reboot(char * fixed_str, char * data, char * num 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); bool mmi_protocol_sms_parse_set_apn(char * fixed_str, char * data, char * number); +bool mmi_protocol_sms_parse_get_info(char * fixed_str, char * data, char * number); #ifdef __cplusplus