gengxin
authorCCC <2393524978@qq.com>
Wed, 29 Nov 2023 09:57:49 +0000 (17:57 +0800)
committerCCC <2393524978@qq.com>
Wed, 29 Nov 2023 09:57:49 +0000 (17:57 +0800)
2.sdk/sdk/gui/lv_watch/lv_apps/custom_function/heng_ai_sleep_activation.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 064f61a..31a1af3 100644 (file)
@@ -84,6 +84,25 @@ void mmi_hengai_sleep_activation_check_action(void)
        }
 }
 
+
+#if 1
+static uint8_t s_gsensor_upload_switch = 0; // 0-off; 1-on
+
+void mmi_heng_ai_gsensor_upload_action(void)
+{
+       if(0 == s_gsensor_upload_switch)
+               return;
+
+       mmi_protocol_fzd_action_hengai_sleep_data(s_hengai_sleep_gsensor_data, sizeof(s_hengai_sleep_gsensor_data));
+}
+
+void mmi_heng_ai_gsensor_upload_switch_set(uint8_t value)
+{
+       s_gsensor_upload_switch = value;
+}
+#endif
+
+
 bool mmi_hengai_sleep_data_send(void)
 {
        char * temp_buff = NULL;
@@ -180,6 +199,7 @@ static void mmi_hengai_gsensor_data_get(uint32_t para)
        {
                uos_timer_stop(s_hengai_sleep_gsensor_timer_id);
                s_hengai_sleep_gsensor_counter = 0;
+               mmi_heng_ai_gsensor_upload_action();
                mmi_hengai_sleep_data_get();
        }
        else
index 3d012f7..f2ef5d7 100644 (file)
@@ -3011,6 +3011,57 @@ bool mmi_protocol_fzd_action_hengai_sleep_data(char * file_buf, uint32_t file_si
        
        return result;
 }
+
+#if 1
+bool mmi_protocol_fzd_action_hengai_sleep_data(char * file_buf, uint32_t file_size)
+{
+       bool result = false;
+       MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_ACTION_GSENSOR_DATA_UPLOAD;
+       unsigned char * content_buff = NULL;
+       unsigned int content_lenth = 0;
+
+       content_buff = (unsigned char *)lv_mem_alloc(file_size + 2);
+       if(NULL == content_buff)
+       {
+               PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+               return false;
+       }
+       _lv_memset_00(content_buff, file_size + 2);
+       sprintf(content_buff, ",");
+       _lv_memcpy(content_buff + 1, file_buf, file_size);
+       content_lenth = file_size;
+       
+       result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth);
+       lv_mem_free(content_buff);
+       
+       return result;
+}
+
+bool mmi_protocol_fzd_parse_SERVER_SET_GSENSOR_UPLOAD_SWITCH(unsigned char * next_buff, unsigned int next_buff_len)
+{
+       bool result = false;
+       MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_SERVER_SET_GSENSOR_UPLOAD_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);
+
+       state_value = atoi(next_buff);
+       
+       PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+       
+       mmi_heng_ai_gsensor_upload_switch_set(state_value);
+       
+       return result;
+}
+
+#endif
+
 #endif
 
 
index b0d0092..25b3467 100644 (file)
@@ -163,6 +163,10 @@ typedef enum
        MMI_FZD_ACTION_HENGAI_ACTIVATION,
        MMI_FZD_ACTION_HENGAI_ACTIVATION_FEEDBACK,
        MMI_FZD_ACTION_HENGAI_SLEEP_DATA,
+#if 1
+MMI_FZD_ACTION_GSENSOR_DATA_UPLOAD,
+MMI_FZD_SERVER_SET_GSENSOR_UPLOAD_SWITCH,
+#endif
 #endif
 
 
index e9f2561..161b35a 100644 (file)
@@ -94,6 +94,9 @@ 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"},
                        {MMI_FZD_ACTION_HENGAI_SLEEP_DATA, "HENGAI_SLEEP_DATA"},
+
+                       {MMI_FZD_ACTION_GSENSOR_DATA_UPLOAD, "TEST_SLEEP_UPLOAD"},
+                       {MMI_FZD_SERVER_SET_GSENSOR_UPLOAD_SWITCH, "TEST_SLEEP_CONTROL"},
                #endif
 
                
@@ -338,6 +341,12 @@ static bool mmi_protocol_fzd_content_parse(unsigned char * content_ptr, unsigned
                        break;
                case MMI_FZD_ACTION_HENGAI_SLEEP_DATA:
                        break;
+
+               case MMI_FZD_ACTION_GSENSOR_DATA_UPLOAD:
+                       break;
+               case MMI_FZD_SERVER_SET_GSENSOR_UPLOAD_SWITCH:
+                       mmi_protocol_fzd_parse_SERVER_SET_GSENSOR_UPLOAD_SWITCH(next_buff, next_buff_len);
+                       break;
        #endif