1.修改集中发送问题
This commit is contained in:
parent
36e74f636e
commit
77eee70b14
|
@ -40,6 +40,7 @@ void sf_set_del_flag(BOOL flag);
|
||||||
BOOL sf_get_del_flag(void);
|
BOOL sf_get_del_flag(void);
|
||||||
UINT32 sf_get_file_size(UINT8 * fname);
|
UINT32 sf_get_file_size(UINT8 * fname);
|
||||||
UINT8 sf_get_send_file_list(char *sendfileList, UINT8 *fileTotal);
|
UINT8 sf_get_send_file_list(char *sendfileList, UINT8 *fileTotal);
|
||||||
|
UINT8 sf_get_send_file_list_emmc(char *sendfileList, UINT8 *fileTotal);
|
||||||
BOOL sf_check_auto_thumb_file(VOID);
|
BOOL sf_check_auto_thumb_file(VOID);
|
||||||
UINT8 sf_get_send_file_total(void);
|
UINT8 sf_get_send_file_total(void);
|
||||||
SINT32 sf_mem_upload_file_to_module(UINT32 MemPhotoAddr, UINT32 MemPhotosize);
|
SINT32 sf_mem_upload_file_to_module(UINT32 MemPhotoAddr, UINT32 MemPhotosize);
|
||||||
|
|
|
@ -1520,7 +1520,6 @@ BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname)
|
||||||
printf("no update file\n");
|
printf("no update file\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
Function: sf_get_send_file_list
|
Function: sf_get_send_file_list
|
||||||
Description: get send file list
|
Description: get send file list
|
||||||
|
@ -1543,20 +1542,134 @@ UINT8 sf_get_send_file_list(char *sendfileList, UINT8 *fileTotal)
|
||||||
char *pFileHasSend = NULL;
|
char *pFileHasSend = NULL;
|
||||||
UINT32 fileOffset = 0;
|
UINT32 fileOffset = 0;
|
||||||
|
|
||||||
char *strg_path = sf_get_root_path();
|
|
||||||
if(strg_path == NULL)
|
|
||||||
{
|
|
||||||
free(strg_path);
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(0 == pPara->SendType){
|
if(0 == pPara->SendType){
|
||||||
snprintf(sendListName, sizeof(sendListName), "%s%s", strg_path, SF_THUMB_SEND_AUTO);
|
snprintf(sendListName, sizeof(sendListName), "%s%s", SF_SD_ROOT, SF_THUMB_SEND_AUTO);
|
||||||
|
if((access(sendListName, F_OK) != 0))
|
||||||
|
{
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
snprintf(sendListName, sizeof(sendListName), "%s%s", strg_path, SF_THUMB_SEND_LIST);
|
snprintf(sendListName, sizeof(sendListName), "%s%s", SF_SD_ROOT, SF_THUMB_SEND_LIST);
|
||||||
|
if((access(sendListName, F_OK) != 0))
|
||||||
|
{
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sf_file_size_get(sendListName, &fsize);
|
||||||
|
fd = fopen(sendListName,"r");
|
||||||
|
if(fd == 0)
|
||||||
|
{
|
||||||
|
printf("%s:%d [ERROR] %s open filed\n", __FUNCTION__, __LINE__, sendListName);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(pPara->SendMaxNum == 0) //unlimited
|
||||||
|
{
|
||||||
|
MaxFileNum = (sf_battery_value_get(0) >= 50 ? 200 : 100);// the last 100/200 files
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MaxFileNum = pPara->SendMaxNum - pSifarPara->picSendMax;
|
||||||
|
}
|
||||||
|
printf("%s:%d Get %s MaxFileNum:%d\n", __FUNCTION__, __LINE__, sendListName, MaxFileNum);
|
||||||
|
|
||||||
|
//fsize = sp5kFsFileSizeGet(fd);
|
||||||
|
if(fsize == 0)
|
||||||
|
{
|
||||||
|
fclose(fd);
|
||||||
|
sf_file_remove(sendListName);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
else if(fsize%SF_SEND_LIST_ITEM_LENGTH) //format error delete file list
|
||||||
|
{
|
||||||
|
//SLOGE((SINT8 *)"FTP ERROR: 303\n");
|
||||||
|
printf("%s:%d FTP ERROR: 303\n", __FUNCTION__, __LINE__);
|
||||||
|
fclose(fd);
|
||||||
|
sf_file_remove(sendListName);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
else if(fsize > MaxFileNum*SF_SEND_LIST_ITEM_LENGTH) // the last 100/200 files
|
||||||
|
{
|
||||||
|
fseek(fd, fsize-MaxFileNum*SF_SEND_LIST_ITEM_LENGTH, SEEK_SET);
|
||||||
|
fsize = MaxFileNum*SF_SEND_LIST_ITEM_LENGTH;
|
||||||
|
}
|
||||||
|
*fileTotal = fsize/SF_SEND_LIST_ITEM_LENGTH;
|
||||||
|
printf("fileTotal=%d, fsize=%d\n", *fileTotal, fsize);
|
||||||
|
fread(sendfileList, fsize, 1, fd);
|
||||||
|
fclose(fd);
|
||||||
|
system("sync");
|
||||||
|
oldFileKey = pPara->FileKey;
|
||||||
|
printf("last send key:%d\n", oldFileKey);
|
||||||
|
//oldFileKey = 1000003; //for debug
|
||||||
|
if((oldFileKey >= 1000001) && (oldFileKey <= 9999999)) //W1000001.JPG W9999999.JPG
|
||||||
|
{
|
||||||
|
snprintf(oldFileName, sizeof(oldFileName), "W%ld.JPG", oldFileKey);
|
||||||
|
printf("last send file:%s\n", oldFileName);
|
||||||
|
pFileHasSend = strstr(sendfileList, oldFileName); //MAX spend time <= 310ms
|
||||||
|
if(pFileHasSend != NULL)
|
||||||
|
{
|
||||||
|
pFileHasSend -= 1;
|
||||||
|
fileOffset = abs(pFileHasSend - sendfileList) + SF_SEND_LIST_ITEM_LENGTH;
|
||||||
|
fsize -= fileOffset;
|
||||||
|
printf("fileOffset=%d\n", fileOffset);
|
||||||
|
memmove(sendfileList, pFileHasSend + SF_SEND_LIST_ITEM_LENGTH, fsize);
|
||||||
|
*(sendfileList+fsize) = '\0';
|
||||||
|
*fileTotal = fsize/SF_SEND_LIST_ITEM_LENGTH;
|
||||||
|
printf("fileTotal=%d, fsize=%d\n", *fileTotal, fsize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=1; i <= *fileTotal; i++) // remove \r
|
||||||
|
{
|
||||||
|
*(sendfileList+i*SF_SEND_LIST_ITEM_LENGTH-2) = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
//memdump(sendfileList, fsize);
|
||||||
|
//printf("get Success\n");
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************
|
||||||
|
Function: sf_get_send_file_list_emmc
|
||||||
|
Description: get send file list emmc
|
||||||
|
Input: sendfname
|
||||||
|
Output: N/A
|
||||||
|
Return: N/A
|
||||||
|
Others: N/A
|
||||||
|
*************************************************/
|
||||||
|
UINT8 sf_get_send_file_list_emmc(char *sendfileList, UINT8 *fileTotal)
|
||||||
|
{
|
||||||
|
UIMenuStoreInfo *pPara = sf_app_ui_para_get();
|
||||||
|
SF_PDT_PARAM_STATISTICS_S *pSifarPara = sf_statistics_param_get();
|
||||||
|
char sendListName[64] = {0};
|
||||||
|
FILE *fd = NULL;
|
||||||
|
UINT32 fsize = 0;
|
||||||
|
UINT8 i = 0;
|
||||||
|
UINT8 MaxFileNum = 200;
|
||||||
|
UINT32 oldFileKey = 0;
|
||||||
|
char oldFileName[SF_SEND_LIST_ITEM_LENGTH+1] = {0};
|
||||||
|
char *pFileHasSend = NULL;
|
||||||
|
UINT32 fileOffset = 0;
|
||||||
|
|
||||||
|
if(0 == pPara->SendType){
|
||||||
|
|
||||||
|
snprintf(sendListName, sizeof(sendListName), "%s%s", SF_EMMC_ROOT, SF_THUMB_SEND_AUTO);
|
||||||
|
if((access(sendListName, F_OK) != 0))
|
||||||
|
{
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf(sendListName, sizeof(sendListName), "%s%s", SF_EMMC_ROOT, SF_THUMB_SEND_LIST);
|
||||||
|
if((access(sendListName, F_OK) != 0))
|
||||||
|
{
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sf_file_size_get(sendListName, &fsize);
|
sf_file_size_get(sendListName, &fsize);
|
||||||
free(strg_path);
|
|
||||||
fd = fopen(sendListName,"r");
|
fd = fopen(sendListName,"r");
|
||||||
if(fd == 0)
|
if(fd == 0)
|
||||||
{
|
{
|
||||||
|
@ -1637,47 +1750,88 @@ BOOL sf_check_auto_thumb_file(VOID)
|
||||||
|
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
UINT8 fileIndex = 0;
|
UINT8 fileIndex = 0;
|
||||||
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
char sendListName[64] = {0};
|
||||||
printf("%s:%d s\n", __FUNCTION__, __LINE__);
|
UINT8 SDSendFalg = 0;
|
||||||
|
UINT8 EmmcSendFalg = 0;
|
||||||
char tmp[64] = {'\0'};
|
|
||||||
|
|
||||||
char *strg_path = sf_get_root_path();
|
printf("%s:%d s\n", __FUNCTION__, __LINE__);
|
||||||
if(strg_path == NULL)
|
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||||
{
|
|
||||||
free(strg_path);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
SF_SRCFILE_ATTR_S* fileCfg = sf_file_thumb_cfg_get();
|
SF_SRCFILE_ATTR_S* fileCfg = sf_file_thumb_cfg_get();
|
||||||
if(0 == puiPara->SendType){
|
if(0 == puiPara->SendType){
|
||||||
snprintf(tmp, sizeof(tmp), "%s", SF_THUMB_SEND_AUTO);
|
snprintf(sendListName, sizeof(sendListName), "%s%s", SF_EMMC_ROOT, SF_THUMB_SEND_AUTO);
|
||||||
|
if((access(sendListName, F_OK) == 0))
|
||||||
|
{
|
||||||
|
EmmcSendFalg = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(sendListName, sizeof(sendListName), "%s%s", SF_SD_ROOT, SF_THUMB_SEND_AUTO);
|
||||||
|
if((access(sendListName, F_OK) == 0))
|
||||||
|
{
|
||||||
|
SDSendFalg = 1;
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
snprintf(tmp, sizeof(tmp), "%s", SF_THUMB_SEND_LIST);
|
snprintf(sendListName, sizeof(sendListName), "%s%s", SF_EMMC_ROOT, SF_THUMB_SEND_LIST);
|
||||||
|
if((access(sendListName, F_OK) == 0))
|
||||||
|
{
|
||||||
|
EmmcSendFalg = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(sendListName, sizeof(sendListName), "%s%s", SF_SD_ROOT, SF_THUMB_SEND_LIST);
|
||||||
|
if((access(sendListName, F_OK) == 0))
|
||||||
|
{
|
||||||
|
SDSendFalg = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SUCCESS == sf_get_send_file_list(&SendFileList[0][0], &SendFileTotal)){
|
if(1 == SDSendFalg)
|
||||||
if (fileCfg) {
|
{
|
||||||
ret = TRUE;
|
if(SUCCESS == sf_get_send_file_list(&SendFileList[0][0], &SendFileTotal)){
|
||||||
fileCfg->filecnt = SendFileTotal;
|
if (fileCfg) {
|
||||||
for(fileIndex = 0; fileIndex < SendFileTotal; fileIndex++)
|
ret = TRUE;
|
||||||
{
|
fileCfg->filecnt = SendFileTotal;
|
||||||
if((SF_CAM_MODE_PHOTO_VIDEO == (SendFileList[fileIndex][0] - '0')) || (SF_CAM_MODE_VIDEO2 == (SendFileList[fileIndex][0] - '0'))){
|
for(fileIndex = 0; fileIndex < SendFileTotal; fileIndex++)
|
||||||
fileCfg->stfileattr[fileIndex].enFileTye = SF_FILE_TYPE_PIC_VIDEO;
|
{
|
||||||
}else if(SF_CAM_MODE_PHOTO == (SendFileList[fileIndex][0] - '0')){
|
if((SF_CAM_MODE_PHOTO_VIDEO == (SendFileList[fileIndex][0] - '0')) || (SF_CAM_MODE_VIDEO2 == (SendFileList[fileIndex][0] - '0'))){
|
||||||
fileCfg->stfileattr[fileIndex].enFileTye = SF_FILE_TYPE_PIC_SMALL;
|
fileCfg->stfileattr[fileIndex].enFileTye = SF_FILE_TYPE_PIC_VIDEO;
|
||||||
}
|
}else if(SF_CAM_MODE_PHOTO == (SendFileList[fileIndex][0] - '0')){
|
||||||
snprintf(fileCfg->stfileattr[fileIndex].thumbfileName, sizeof(fileCfg->stfileattr[fileIndex].thumbfileName), "%s", &SendFileList[fileIndex][1]);
|
fileCfg->stfileattr[fileIndex].enFileTye = SF_FILE_TYPE_PIC_SMALL;
|
||||||
snprintf(fileCfg->stfileattr[fileIndex].thumbfilePath, sizeof(fileCfg->stfileattr[fileIndex].thumbfilePath), "%s%s%s", strg_path, SF_SEND_LIST_DIR,
|
}
|
||||||
&SendFileList[fileIndex][1]);
|
snprintf(fileCfg->stfileattr[fileIndex].thumbfileName, sizeof(fileCfg->stfileattr[fileIndex].thumbfileName), "%s", &SendFileList[fileIndex][1]);
|
||||||
printf("%s:%d thumbfileSize:%d thumbfileName:%s thumbfilePath:%s\n", __FUNCTION__, __LINE__,
|
snprintf(fileCfg->stfileattr[fileIndex].thumbfilePath, sizeof(fileCfg->stfileattr[fileIndex].thumbfilePath), "%s%s%s", SF_SD_ROOT, SF_SEND_LIST_DIR,
|
||||||
fileCfg->stfileattr[fileIndex].thumbfileSize,fileCfg->stfileattr[fileIndex].thumbfileName,fileCfg->stfileattr[fileIndex].thumbfilePath);
|
&SendFileList[fileIndex][1]);
|
||||||
}
|
printf("%s:%d thumbfileSize:%d thumbfileName:%s thumbfilePath:%s\n", __FUNCTION__, __LINE__,
|
||||||
}
|
fileCfg->stfileattr[fileIndex].thumbfileSize,fileCfg->stfileattr[fileIndex].thumbfileName,fileCfg->stfileattr[fileIndex].thumbfilePath);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UINT8 EmmcfileIndex = 0;
|
||||||
|
if(1 == EmmcSendFalg)
|
||||||
|
{
|
||||||
|
if(SUCCESS == sf_get_send_file_list_emmc(&SendFileList[0][0], &EmmcfileIndex)){
|
||||||
|
if (fileCfg) {
|
||||||
|
ret = TRUE;
|
||||||
|
SendFileTotal = (fileCfg->filecnt + EmmcfileIndex) >= 200 ? 200: (fileCfg->filecnt + EmmcfileIndex);
|
||||||
|
fileCfg->filecnt = SendFileTotal;
|
||||||
|
for(fileIndex = 0; fileIndex < SendFileTotal; fileIndex++)
|
||||||
|
{
|
||||||
|
EmmcfileIndex--;
|
||||||
|
if((SF_CAM_MODE_PHOTO_VIDEO == (SendFileList[EmmcfileIndex][0] - '0')) || (SF_CAM_MODE_VIDEO2 == (SendFileList[EmmcfileIndex][0] - '0'))){
|
||||||
|
fileCfg->stfileattr[fileIndex].enFileTye = SF_FILE_TYPE_PIC_VIDEO;
|
||||||
|
}else if(SF_CAM_MODE_PHOTO == (SendFileList[EmmcfileIndex][0] - '0')){
|
||||||
|
fileCfg->stfileattr[fileIndex].enFileTye = SF_FILE_TYPE_PIC_SMALL;
|
||||||
|
}
|
||||||
|
snprintf(fileCfg->stfileattr[fileIndex].thumbfileName, sizeof(fileCfg->stfileattr[fileIndex].thumbfileName), "%s", &SendFileList[EmmcfileIndex][1]);
|
||||||
|
snprintf(fileCfg->stfileattr[fileIndex].thumbfilePath, sizeof(fileCfg->stfileattr[fileIndex].thumbfilePath), "%s%s%s", SF_EMMC_ROOT, SF_SEND_LIST_DIR,
|
||||||
|
&SendFileList[EmmcfileIndex][1]);
|
||||||
|
printf("%s:%d thumbfileSize:%d thumbfileName:%s thumbfilePath:%s\n", __FUNCTION__, __LINE__,
|
||||||
|
fileCfg->stfileattr[fileIndex].thumbfileSize,fileCfg->stfileattr[fileIndex].thumbfileName,fileCfg->stfileattr[fileIndex].thumbfilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
printf("%s:%d e \n", __FUNCTION__, __LINE__);
|
printf("%s:%d e \n", __FUNCTION__, __LINE__);
|
||||||
free(strg_path);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -493,25 +493,28 @@ UINT32 sf_delete_send_flie_list(void)
|
||||||
{
|
{
|
||||||
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||||
char tmp[64] = {'\0'};
|
char tmp[64] = {'\0'};
|
||||||
char *strg_path = sf_get_root_path();
|
|
||||||
if(strg_path == NULL)
|
|
||||||
{
|
|
||||||
free(strg_path);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(0 == puiPara->SendType){
|
if(0 == puiPara->SendType){
|
||||||
snprintf(tmp, sizeof(tmp), "%s%s", strg_path, SF_THUMB_SEND_AUTO);
|
snprintf(tmp, sizeof(tmp), "%s%s", SF_EMMC_ROOT, SF_THUMB_SEND_AUTO);
|
||||||
|
if(sf_file_IsExsit(tmp) == SF_TRUE)
|
||||||
|
sf_file_remove(tmp);
|
||||||
|
|
||||||
|
snprintf(tmp, sizeof(tmp), "%s%s", SF_SD_ROOT, SF_THUMB_SEND_AUTO);
|
||||||
if(sf_file_IsExsit(tmp) == SF_TRUE)
|
if(sf_file_IsExsit(tmp) == SF_TRUE)
|
||||||
sf_file_remove(tmp);
|
sf_file_remove(tmp);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
snprintf(tmp, sizeof(tmp), "%s%s", strg_path, SF_THUMB_SEND_LIST);
|
snprintf(tmp, sizeof(tmp), "%s%s", SF_EMMC_ROOT, SF_THUMB_SEND_LIST);
|
||||||
|
printf("delete %s\n", SF_SEND_LIST_DIR);
|
||||||
|
if(sf_file_IsExsit(tmp) == SF_TRUE)
|
||||||
|
sf_file_remove(tmp);
|
||||||
|
|
||||||
|
snprintf(tmp, sizeof(tmp), "%s%s", SF_SD_ROOT, SF_THUMB_SEND_LIST);
|
||||||
printf("delete %s\n", SF_SEND_LIST_DIR);
|
printf("delete %s\n", SF_SEND_LIST_DIR);
|
||||||
if(sf_file_IsExsit(tmp) == SF_TRUE)
|
if(sf_file_IsExsit(tmp) == SF_TRUE)
|
||||||
sf_file_remove(tmp);
|
sf_file_remove(tmp);
|
||||||
}
|
}
|
||||||
free(strg_path);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user