1.修改低电警告发送
This commit is contained in:
parent
a02f22e2a5
commit
b3fc12b6bc
|
@ -2300,14 +2300,8 @@ SINT32 sf_low_power_warn_send_ftp(void)
|
||||||
}
|
}
|
||||||
MLOGD("start\n");
|
MLOGD("start\n");
|
||||||
|
|
||||||
char *file_path = sf_root_path_strcat(SF_LOW_POWER_WARN_FILENAME);
|
|
||||||
if(file_path == NULL)
|
|
||||||
{
|
|
||||||
free(file_path);
|
|
||||||
return SF_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf((char *)filePath, "%s", file_path);
|
sprintf((char *)filePath, "%s", SF_LOW_POWER_WARN_FILENAME);
|
||||||
|
|
||||||
sf_custom_str_get(customStr);
|
sf_custom_str_get(customStr);
|
||||||
sprintf((char *)uploadFname, "%s-%s-btalarm.txt",pPara->ModuleImei, customStr);
|
sprintf((char *)uploadFname, "%s-%s-btalarm.txt",pPara->ModuleImei, customStr);
|
||||||
|
@ -2325,7 +2319,6 @@ SINT32 sf_low_power_warn_send_ftp(void)
|
||||||
}
|
}
|
||||||
MLOGD(" end ret:[0x%08X]\n", ret);
|
MLOGD(" end ret:[0x%08X]\n", ret);
|
||||||
//printf("[%s:%d]ret:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret);
|
//printf("[%s:%d]ret:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret);
|
||||||
free(file_path);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1363,6 +1363,8 @@ UINT32 sf_create_low_power_warn_file(void)
|
||||||
UINT32 fd = 0, ret = FAIL;
|
UINT32 fd = 0, ret = FAIL;
|
||||||
UINT8 szTmp[50] = {0};
|
UINT8 szTmp[50] = {0};
|
||||||
UINT8 str[20]= {0};
|
UINT8 str[20]= {0};
|
||||||
|
char filePath[64] = { 0 };
|
||||||
|
|
||||||
UINT16 temp = 0;
|
UINT16 temp = 0;
|
||||||
UINT8 batVal = 0;
|
UINT8 batVal = 0;
|
||||||
UIMenuStoreInfo *pPara = sf_app_ui_para_get();
|
UIMenuStoreInfo *pPara = sf_app_ui_para_get();
|
||||||
|
@ -1376,43 +1378,13 @@ UINT32 sf_create_low_power_warn_file(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *thumb_dir = sf_root_path_strcat(SF_THUMB_DIR);
|
sprintf((char *)filePath, "%s", SF_LOW_POWER_WARN_FILENAME);
|
||||||
if(thumb_dir == NULL)
|
|
||||||
{
|
|
||||||
free(thumb_dir);
|
|
||||||
return SF_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Avoid New Card*/
|
fd = open(filePath, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||||
|
|
||||||
if (access(thumb_dir, F_OK) == -1) {
|
|
||||||
printf("%s directory does not exist. Creating...\n", thumb_dir);
|
|
||||||
|
|
||||||
if (mkdir(thumb_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) {
|
|
||||||
//perror("mkdir() error");
|
|
||||||
} else {
|
|
||||||
printf("%s directory created.\n", thumb_dir);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printf("%s directory exists.\n", thumb_dir);
|
|
||||||
}
|
|
||||||
free(thumb_dir);
|
|
||||||
|
|
||||||
char *lp_path = sf_root_path_strcat(SF_LOW_POWER_WARN_FILENAME);
|
|
||||||
if(lp_path == NULL)
|
|
||||||
{
|
|
||||||
free(lp_path);
|
|
||||||
return SF_FAILURE;
|
|
||||||
}
|
|
||||||
if(sf_file_IsExsit(lp_path) == SF_TRUE){
|
|
||||||
sf_file_remove(lp_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
fd = open(lp_path, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
|
||||||
|
|
||||||
if(!fd)
|
if(!fd)
|
||||||
{
|
{
|
||||||
fd = open(lp_path, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
fd = open(filePath, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fd)
|
if(fd)
|
||||||
|
@ -1442,7 +1414,7 @@ UINT32 sf_create_low_power_warn_file(void)
|
||||||
if(ret <0)
|
if(ret <0)
|
||||||
{
|
{
|
||||||
close(fd);
|
close(fd);
|
||||||
sf_file_remove(lp_path);
|
sf_file_remove(filePath);
|
||||||
printf("write low power warn file failed!,ret:%d\n",ret);
|
printf("write low power warn file failed!,ret:%d\n",ret);
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}
|
}
|
||||||
|
@ -1453,7 +1425,6 @@ UINT32 sf_create_low_power_warn_file(void)
|
||||||
ret = SUCCESS;
|
ret = SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(lp_path);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user