#endif
#ifdef __MMI_CUSTOM_HENGAI_TCMS__
-bool mmi_protocol_fzd_action_hengai_tcms_data(char * file_buf, uint32_t file_size)
+bool mmi_protocol_fzd_action_hengai_tcms_data(HENGAI_TCMS_DATA_T * data_ptr, uint8_t data_num)
{
bool result = false;
MMI_PROTOCOL_FZD_ACTION_ENUM action = MMI_FZD_ACTION_HENGAI_TCMS_DATA;
unsigned char * content_buff = NULL;
unsigned int content_lenth = 0;
+ unsigned char * temp_ptr = NULL;
+ unsigned int temp_lenth = 0;
+ uint32_t data_len = data_num * 100 + 64;
+ uint32_t cur_time_stamp = 0;
+ uint8_t i = 0;
-#if 0
- content_buff = (unsigned char *)lv_mem_alloc(file_size + 2);
+ content_buff = (unsigned char *)lv_mem_alloc(data_len);
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;
+ _lv_memset_00(content_buff, data_len);
+
+ Hal_Rtc_Gettime_Count(&cur_time_stamp);
+ temp_lenth = 0;
+ temp_ptr = content_buff + temp_lenth;
+ sprintf(temp_ptr, ",%d,%d", data_num, cur_time_stamp);
+
+ temp_lenth = strlen(temp_ptr);
+ temp_ptr += temp_lenth;
+
+ for(i = 0; i < data_num; i++)
+ {
+ sprintf(temp_ptr, ",%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
+ data_ptr[i].time,
+ data_ptr[i].timestamp,
+ data_ptr[i].areaUP,
+ data_ptr[i].areaUPBase,
+ data_ptr[i].areaUPHeight,
+ data_ptr[i].areaDOWN,
+ data_ptr[i].areaDOWNBase,
+ data_ptr[i].areaDOWNHeight,
+ data_ptr[i].RRI,
+ data_ptr[i].motion);
+
+ temp_lenth = strlen(temp_ptr);
+ temp_ptr += temp_lenth;
+ }
+
+ content_lenth = strlen(content_buff);
+
+ PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%s][%d]: %d\n", __FUNCTION__, __LINE__, content_lenth);
+ PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %s\n", __LINE__, content_buff);
+ PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %s\n", __LINE__, content_buff + 90);
+ PROTOCOL_DEBUG_PRINTF("[@CHENG_DEBUG][%d]: %s\n", __LINE__, content_buff + 180);
result = mmi_protocol_fzd_send_with_data(action, content_buff, content_lenth);
- lv_mem_free(content_buff);
-#endif
+
+ if(NULL != content_buff)
+ {
+ lv_mem_free(content_buff);
+ content_buff = NULL;
+ }
- return result;
+ return true;
}
#endif