gengxin dachuixiugai
author@CHENG <2393524978@qq.com>
Mon, 14 Oct 2024 04:11:44 +0000 (12:11 +0800)
committer@CHENG <2393524978@qq.com>
Mon, 14 Oct 2024 04:11:44 +0000 (12:11 +0800)
2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_sleep_k18.c
2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.c
2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd.h
2.sdk/sdk/gui/lv_watch/mmi_protocol/mmi_protocol_fzd_content.c

index 5dbffe5..b541a44 100644 (file)
@@ -36,10 +36,11 @@ static bool mmi_hengai_sleep_data_send(void)
        }
        _lv_memset_00(temp_buff, buff_size + 1);
 
+       temp_ptr = temp_buff;
        temp_count = 0;
-       temp_ptr = temp_buff + temp_count;
-       sprintf(temp_ptr, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
-                                               s_hengai_sdata.total_sleep_time,
+
+       temp_ptr += temp_count;
+       sprintf(temp_ptr, "%d-%d-%d %d:%d,%d-%d-%d %d:%d,%d,%d",
                                                s_hengai_sdata.begin_sleep_time.year,
                                                s_hengai_sdata.begin_sleep_time.month,
                                                s_hengai_sdata.begin_sleep_time.day,
@@ -49,21 +50,19 @@ static bool mmi_hengai_sleep_data_send(void)
                                                s_hengai_sdata.end_sleep_time.month,
                                                s_hengai_sdata.end_sleep_time.day,
                                                s_hengai_sdata.end_sleep_time.hour,
-                                               s_hengai_sdata.end_sleep_time.minute);
-       temp_count = strlen(temp_ptr);
-
-       temp_ptr += temp_count;
-       sprintf(temp_ptr, ",%d", s_hengai_sdata.state_count);
+                                               s_hengai_sdata.end_sleep_time.minute,
+                                               s_hengai_sdata.total_sleep_time,
+                                               s_hengai_sdata.state_count);
        temp_count = strlen(temp_ptr);
        
        for(i = 0; i < s_hengai_sdata.state_count; i++)
        {
                temp_ptr += temp_count;
-               sprintf(temp_ptr, ",%d,%d", s_hengai_sdata.data[i].duration, s_hengai_sdata.data[i].state);
+               sprintf(temp_ptr, ",%d,%d", s_hengai_sdata.data[i].state, s_hengai_sdata.data[i].duration);
                temp_count = strlen(temp_ptr);
        }
        
-       mmi_protocol_fzd_action_hengai_sleep_data(temp_buff, strlen(temp_buff));
+       mmi_protocol_fzd_action_sleep_data(temp_buff, strlen(temp_buff));
 
        if(NULL != temp_buff)
        {
@@ -93,6 +92,10 @@ static void mmi_hengai_sleep_data_get(void)
                mmi_hengai_sleep_data_send();           
                mmi_hengai_sleep_data_set(&s_hengai_sdata);
        }
+       else if(-1 == result)
+       {
+               mmi_hengai_health_sleep_lib_active();
+       }
 
        _lv_memset_00(s_hengai_sleep_gsensor_data, sizeof(s_hengai_sleep_gsensor_data));
        mmi_hengai_gsensor_data_get(0);
index 7936bf7..eb137f9 100644 (file)
@@ -3688,7 +3688,7 @@ bool mmi_protocol_fzd_action_hengai_activation_feedback(void)
 }
 #endif
 
-#if defined(__MMI_CUSTOM_HENGAI_SLEEP__) || defined(__MMI_CUSTOM_HENGAI_SLEEP_K18__)
+#if defined(__MMI_CUSTOM_HENGAI_SLEEP__)
 bool mmi_protocol_fzd_action_hengai_sleep_data(char * file_buf, uint32_t file_size)
 {
        bool result = false;
@@ -3990,6 +3990,31 @@ bool mmi_protocol_fzd_action_send_iccid(void)
        return result;
 }
 
+bool mmi_protocol_fzd_action_sleep_data(char * data_ptr, uint32_t data_len)
+{
+       bool result = false;
+       MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_ACTION_SLEEP_DATA;
+       unsigned char * content_buff = NULL;
+       unsigned int content_lenth = 0;
+
+       content_buff = (unsigned char *)lv_mem_alloc(data_len + 2);
+       if(NULL == content_buff)
+       {
+               PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+               return false;
+       }
+       _lv_memset_00(content_buff, data_len + 2);
+       sprintf(content_buff, ",");
+       _lv_memcpy(content_buff + 1, data_ptr, data_len);
+       content_lenth = data_len;
+       
+       result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth);
+       lv_mem_free(content_buff);
+       
+       return result;
+}
+
+
 
 #endif
 
index 63b6e3a..41f9f9f 100644 (file)
@@ -194,7 +194,7 @@ typedef enum
        MMI_FZD_ACTION_HENGAI_ACTIVATION,
        MMI_FZD_ACTION_HENGAI_ACTIVATION_FEEDBACK,
 #endif
-#if defined(__MMI_CUSTOM_HENGAI_SLEEP__) || defined(__MMI_CUSTOM_HENGAI_SLEEP_K18__)
+#if defined(__MMI_CUSTOM_HENGAI_SLEEP__)
        MMI_FZD_ACTION_HENGAI_SLEEP_DATA,
 #if 0
 MMI_FZD_ACTION_GSENSOR_DATA_UPLOAD,
@@ -209,6 +209,7 @@ MMI_FZD_ACTION_HENGAI_SLEEP_DATA_TEST,
 #endif
        MMI_FZD_ACTION_TCP_HTTP,
        MMI_FZD_ACTION_SEND_ICCID,
+       MMI_FZD_ACTION_SLEEP_DATA,
 
        MMI_FZD_SERVER_SET_BOOTOFF,
        MMI_FZD_SEND_UP_REMIND,
@@ -368,7 +369,7 @@ bool mmi_protocol_fzd_action_hengai_activation(char * req_code);
 bool mmi_protocol_fzd_parse_ACTION_HENGAI_ACTIVATION(unsigned char * next_buff, unsigned int next_buff_len);
 bool mmi_protocol_fzd_action_hengai_activation_feedback(void);
 #endif
-#if defined(__MMI_CUSTOM_HENGAI_SLEEP__) || defined(__MMI_CUSTOM_HENGAI_SLEEP_K18__)
+#if defined(__MMI_CUSTOM_HENGAI_SLEEP__)
 bool mmi_protocol_fzd_action_hengai_sleep_data(char * file_buf, uint32_t file_size);
 #endif
 #ifdef __MMI_CUSTOM_HENGAI_TCMS__
@@ -380,7 +381,7 @@ bool mmi_protocol_fzd_action_tcp_http(char * data_ptr, uint32_t data_len);
 bool mmi_protocol_fzd_parse_ACTION_TCP_HTTP(unsigned char * next_buff, unsigned int next_buff_len);
 
 bool mmi_protocol_fzd_action_send_iccid(void);
-
+bool mmi_protocol_fzd_action_sleep_data(char * data_ptr, uint32_t data_len);
 
 #endif
 
index 1fedb8f..4339d90 100644 (file)
@@ -126,7 +126,7 @@ static unsigned char * mmi_protocol_fzd_action_string_get(MMI_PROTOCOL_FZD_ACTIO
                        {MMI_FZD_ACTION_HENGAI_ACTIVATION, "HENGAI_ACTIVATION"},
                        {MMI_FZD_ACTION_HENGAI_ACTIVATION_FEEDBACK, "HENGAI_ACTIVATION_FEEDBACK"},
                #endif
-               #if defined(__MMI_CUSTOM_HENGAI_SLEEP__) || defined(__MMI_CUSTOM_HENGAI_SLEEP_K18__)
+               #if defined(__MMI_CUSTOM_HENGAI_SLEEP__)
                        {MMI_FZD_ACTION_HENGAI_SLEEP_DATA, "HENGAI_SLEEP_DATA"},
 
                        #if 0
@@ -142,6 +142,7 @@ static unsigned char * mmi_protocol_fzd_action_string_get(MMI_PROTOCOL_FZD_ACTIO
                #endif
                        {MMI_FZD_ACTION_TCP_HTTP, "TCP_HTTP"},
                        {MMI_FZD_ACTION_SEND_ICCID, "ICCID"},
+                       {MMI_FZD_ACTION_SLEEP_DATA, "SLEEP_DATA"},
                        {MMI_FZD_SERVER_SET_BOOTOFF, "BOOTOFF"},
                        {MMI_FZD_SEND_UP_REMIND, "UP_REMIND"},
                
@@ -449,7 +450,7 @@ static bool mmi_protocol_fzd_content_parse(unsigned char * content_ptr, unsigned
                case MMI_FZD_ACTION_HENGAI_ACTIVATION_FEEDBACK:
                        break;
        #endif
-       #if defined(__MMI_CUSTOM_HENGAI_SLEEP__) || defined(__MMI_CUSTOM_HENGAI_SLEEP_K18__)
+       #if defined(__MMI_CUSTOM_HENGAI_SLEEP__)
                case MMI_FZD_ACTION_HENGAI_SLEEP_DATA:
                        break;
 
@@ -482,6 +483,9 @@ static bool mmi_protocol_fzd_content_parse(unsigned char * content_ptr, unsigned
 
                case MMI_FZD_ACTION_SEND_ICCID:
                        break;
+
+               case MMI_FZD_ACTION_SLEEP_DATA:
+                       break;
                        
                case MMI_FZD_SERVER_SET_BOOTOFF:
                        mmi_protocol_fzd_parse_SERVER_SET_BOOTOFF(next_buff, next_buff_len);