Merge branch 'Branch_S550_Fast_Emmc' of 192.168.6.216:linux-em-group/s530-ntk into Branch_S550_Emmc

This commit is contained in:
xiehongyan 2024-01-11 20:59:25 +08:00
commit 339b0ef94f
18 changed files with 532 additions and 150 deletions

View File

@ -26,6 +26,7 @@
#if HUNTING_CAMERA_MCU == ENABLE #if HUNTING_CAMERA_MCU == ENABLE
#include <sf_message_queue.h> #include <sf_message_queue.h>
#include "sf_sd_common.h"
#endif #endif
typedef struct typedef struct
@ -131,7 +132,10 @@ static UINT32 SF_StrgSpaceCheckFull(MMC_DEV_TYPE mmc_dev)
/*check disk free size*/ /*check disk free size*/
if(mmc_dev == MMC_DEV_SD) if(mmc_dev == MMC_DEV_SD)
{ {
diskFree = FileSys_GetDiskInfoEx('A', FST_INFO_FREE_SPACE); if(sf_in_card_exist())
{
diskFree = FileSys_GetDiskInfoEx('A', FST_INFO_FREE_SPACE);
}
} }
else else
{ {

View File

@ -777,7 +777,7 @@ DCF_HANDLE System_Get_DCF_Handle(void)
DBG_ERR("dcf_handle err!\n"); DBG_ERR("dcf_handle err!\n");
return -1; return -1;
} }
DBG_WRN("DCF_GET_HANDLE, %d\n", mmc_dev->dcf_handle); //DBG_WRN("DCF_GET_HANDLE, %d\n", mmc_dev->dcf_handle);
return mmc_dev->dcf_handle; return mmc_dev->dcf_handle;
#else #else
return 0; return 0;
@ -799,7 +799,7 @@ CHAR System_Get_DCF_Disk_Drive(DCF_HANDLE handle)
if(drive == '\0'){ if(drive == '\0'){
DBG_ERR("invalid act handle(%d)\n", handle); DBG_ERR("invalid act handle(%d)\n", handle);
} }
DBG_WRN("get disk driver, %c\n", drive); //DBG_WRN("get disk driver, %c\n", drive);
return drive; return drive;
} }

View File

@ -1273,7 +1273,7 @@ static void MovieExe_FileNamingCB(MOVIE_CFG_REC_ID id, char *pFileName)
DBG_DUMP("MovieExe %s added to DCF Path%lu\r\n", pFileName, dcf_handle); DBG_DUMP("MovieExe %s added to DCF Path%lu\r\n", pFileName, dcf_handle);
#if HUNTING_CAMERA_MCU == ENABLE #if HUNTING_CAMERA_MCU == ENABLE
char tmp[NMC_TOTALFILEPATH_MAX_LEN] = {'\0'}; char tmp[NMC_TOTALFILEPATH_MAX_LEN] = {'\0'};
sprintf(tmp, "S%c%03d%04d.JPG", font, nextFolderID, nextFileID); sprintf(tmp, "S%c%02d%04d.JPG", font, nextFolderID%100, nextFileID);
if(id == _CFG_REC_ID_1){ if(id == _CFG_REC_ID_1){
snprintf(thumb_current_path_main, sizeof(thumb_current_path_main), "%s", tmp); snprintf(thumb_current_path_main, sizeof(thumb_current_path_main), "%s", tmp);
} }

View File

@ -718,12 +718,15 @@ UINT32 PhotoExe_GetFreePicNum(void)
#if (FILESIZE_ALIGN_FUNC) #if (FILESIZE_ALIGN_FUNC)
reserveSize += FS_ALIGN_RESERVED_SIZE; reserveSize += FS_ALIGN_RESERVED_SIZE;
#endif #endif
uiFreeSpace = FileSys_GetDiskInfo(FST_INFO_FREE_SPACE); //uiFreeSpace = FileSys_GetDiskInfo(FST_INFO_FREE_SPACE);
#if USE_MMC_DEV_CHECK #if USE_MMC_DEV_CHECK
if(mmc_dev->dev_type == MMC_DEV_SD) if(mmc_dev->dev_type == MMC_DEV_SD)
{ {
uiFreeSpace = FileSys_GetDiskInfoEx('A', FST_INFO_FREE_SPACE); if(sf_in_card_exist() == TRUE)
{
uiFreeSpace = FileSys_GetDiskInfoEx('A', FST_INFO_FREE_SPACE);
}
} }
else if(mmc_dev->dev_type == MMC_DEV_EMMC) else if(mmc_dev->dev_type == MMC_DEV_EMMC)
{ {
@ -791,7 +794,10 @@ UINT32 PhotoExe_GetTotalPicNum(void)
if(mmc_dev->dev_type == MMC_DEV_SD) if(mmc_dev->dev_type == MMC_DEV_SD)
{ {
uiSpace = FileSys_GetDiskInfoEx('A', FST_INFO_DISK_SIZE); if(sf_in_card_exist() == TRUE)
{
uiSpace = FileSys_GetDiskInfoEx('A', FST_INFO_DISK_SIZE);
}
} }
else if(mmc_dev->dev_type == MMC_DEV_EMMC) else if(mmc_dev->dev_type == MMC_DEV_EMMC)
{ {
@ -6888,7 +6894,7 @@ INT32 PhotoExe_Preview_SliceEncode_CB3(void* user_data)
#if HUNTING_CAMERA_MCU == ENABLE #if HUNTING_CAMERA_MCU == ENABLE
char folder[4], number[5]; char folder[4], number[5];
strncpy(folder, file_path + length - 22, 2); strncpy(folder, file_path + length - 20, 2);
folder[2] = '\0'; folder[2] = '\0';
strncpy(number, file_path + length - 8, 4); strncpy(number, file_path + length - 8, 4);

View File

@ -5,7 +5,7 @@
#include "UIFlowPhotoParams.h" #include "UIFlowPhotoParams.h"
#include "UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgAPI.h" #include "UIFlowLVGL/UIFlowWrnMsg/UIFlowWrnMsgAPI.h"
#include "ImageApp/ImageApp_Photo.h" #include "ImageApp/ImageApp_Photo.h"
#include "sf_sd_common.h"
#include "DCF.h" #include "DCF.h"
#define THIS_DBGLVL 2 // 0=FATAL, 1=ERR, 2=WRN, 3=UNIT, 4=FUNC, 5=IND, 6=MSG, 7=VALUE, 8=USER #define THIS_DBGLVL 2 // 0=FATAL, 1=ERR, 2=WRN, 3=UNIT, 4=FUNC, 5=IND, 6=MSG, 7=VALUE, 8=USER
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -48,7 +48,16 @@ CHAR *Get_FreePicNumString(UINT32 uiValue)
#if USE_MMC_DEV_CHECK #if USE_MMC_DEV_CHECK
if(mmc_dev->dev_type != MMC_DEV_NO) if(mmc_dev->dev_type != MMC_DEV_NO)
{ {
fileCount = DCF_GetDBInfoEx(mmc_dev->dcf_handle, DCF_INFO_TOL_FILE_COUNT); if(MMC_DEV_SD == mmc_dev->dev_type)
{
if(sf_in_card_exist())
{
fileCount = DCF_GetDBInfoEx(mmc_dev->dcf_handle, DCF_INFO_TOL_FILE_COUNT);
}
}
else {
fileCount = DCF_GetDBInfoEx(mmc_dev->dcf_handle, DCF_INFO_TOL_FILE_COUNT);
}
} }
#else #else
fileCount = DCF_GetDBInfo(DCF_INFO_TOL_FILE_COUNT); fileCount = DCF_GetDBInfo(DCF_INFO_TOL_FILE_COUNT);

View File

@ -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);

View File

@ -213,6 +213,7 @@ typedef enum
WIFI_CONTROL_CAMERA_Debug = 0x3a, //debug模式 WIFI_CONTROL_CAMERA_Debug = 0x3a, //debug模式
WIFI_CONTROL_CAMERA_Network_Scan = 0x3b, //Network scan WIFI_CONTROL_CAMERA_Network_Scan = 0x3b, //Network scan
WIFI_CONTROL_CAMERA_Network_Select = 0x3c,//Network select WIFI_CONTROL_CAMERA_Network_Select = 0x3c,//Network select
WIFI_CONTROL_CAMERA_FormatEmmcCard = 0x3d,//格式化emmc
WIFI_CMD_MAX = 0x40, WIFI_CMD_MAX = 0x40,
} CAMERA_CFG_CMD; } CAMERA_CFG_CMD;
@ -330,6 +331,7 @@ typedef struct devPara_t
typedef struct typedef struct
{ {
UINT8 fileName[32]; /*最后一个文件名取增量,为空取全部*/ UINT8 fileName[32]; /*最后一个文件名取增量,为空取全部*/
UINT8 diskType; /* 磁盘类型0默认1eMMC 2SD初次进入预览界面时如不清楚当前工作磁盘请发默认类型 */
UINT16 suffix; /* 0xFFEE */ UINT16 suffix; /* 0xFFEE */
} __attribute__((packed)) MSG_DEV_THUMB_LIST_Get_T; } __attribute__((packed)) MSG_DEV_THUMB_LIST_Get_T;
@ -339,6 +341,7 @@ typedef struct
UINT8 cmdRet; /*0 成功,否则返回错误码*/ UINT8 cmdRet; /*0 成功,否则返回错误码*/
UINT32 fileNums; /*缩略图文件总数量*/ UINT32 fileNums; /*缩略图文件总数量*/
UINT32 packageSize; /*数据包大小*/ UINT32 packageSize; /*数据包大小*/
UINT8 diskType; /* 磁盘类型0默认1eMMC 2SD初次进入预览界面时如不清楚当前工作磁盘请发默认类型 */
UINT16 suffix; /* 0xFFEE */ UINT16 suffix; /* 0xFFEE */
} __attribute__((packed)) MSG_DEV_THUMB_LIST_Get_Rsp_T; } __attribute__((packed)) MSG_DEV_THUMB_LIST_Get_Rsp_T;
@ -569,6 +572,18 @@ typedef struct
UINT16 suffix; /* 0xFFEE */ UINT16 suffix; /* 0xFFEE */
} __attribute__((packed)) MSG_DEV_FormatSDCard_Ctrl_RSP_T; } __attribute__((packed)) MSG_DEV_FormatSDCard_Ctrl_RSP_T;
typedef struct
{
UINT8 format; /* 1format immediately */
UINT16 sufix; /* 0xFFEE */
} __attribute__((packed)) MSG_DEV_FormatEmmcCard_Ctrl_T;
typedef struct
{
UINT8 cmdRet; /* 0: mean cmd OK othermean cmd error */
UINT16 suffix; /* 0xFFEE */
} __attribute__((packed)) MSG_DEV_FormatEmmcCard_Ctrl_RSP_T;
typedef struct typedef struct
{ {
UINT8 reboot; /* 1: Reboot */ UINT8 reboot; /* 1: Reboot */
@ -883,6 +898,10 @@ typedef struct
MSG_DEV_NetworkSelect_Ctrl_T ctrlNetworkSelect; MSG_DEV_NetworkSelect_Ctrl_T ctrlNetworkSelect;
MSG_DEV_NetworkSelect_Ctrl_Rsp_T rctrlNetworkSelect; MSG_DEV_NetworkSelect_Ctrl_Rsp_T rctrlNetworkSelect;
/*格式化Emmc*/
MSG_DEV_FormatEmmcCard_Ctrl_T ctrlFormatEmmc;
MSG_DEV_FormatEmmcCard_Ctrl_RSP_T rctrlFormatEmmc;
}; };
} __attribute__((packed)) APP_MSG_T; } __attribute__((packed)) APP_MSG_T;

View File

@ -229,7 +229,7 @@ UINT8 sf_message_data_processing(UINT8 strValue[30][32], UINT16 mm, UINT8 *sms_s
} }
else if(strValue[i][0] - '0' == 2) else if(strValue[i][0] - '0' == 2)
{ {
pPara_sms_saved->ImgSize = PHOTO_SIZE_12M; //pPara_sms_saved->ImgSize = PHOTO_SIZE_12M;
} }
else if(strValue[i][0] - '0' == 3) else if(strValue[i][0] - '0' == 3)
{ {
@ -592,7 +592,7 @@ UINT8 sf_message_data_processing(UINT8 strValue[30][32], UINT16 mm, UINT8 *sms_s
//ftp forbidden set //ftp forbidden set
i++; i++;
if(SF_STRNCMP(strValue[i], "ON", 2)== 0) /*if(SF_STRNCMP(strValue[i], "ON", 2)== 0)
{ {
pPara_sms_saved->FtpSwitch = 2; pPara_sms_saved->FtpSwitch = 2;
} }
@ -604,7 +604,7 @@ UINT8 sf_message_data_processing(UINT8 strValue[30][32], UINT16 mm, UINT8 *sms_s
{ {
printf("Error Format line:%d i=%d\n", __LINE__, i); printf("Error Format line:%d i=%d\n", __LINE__, i);
Readmmsok = SMS_STATUS_FORMAT_ERR; Readmmsok = SMS_STATUS_FORMAT_ERR;
} }*/
//sms ctrl //sms ctrl
i++; i++;
@ -841,7 +841,7 @@ UINT8 sf_message_data_processing(UINT8 strValue[30][32], UINT16 mm, UINT8 *sms_s
{ {
if((strValue[i][0] - '0') == 0 ) if((strValue[i][0] - '0') == 0 )
{ {
pPara_sms_saved->GpsNumber = GPS_NUMBER_OFF; //pPara_sms_saved->GpsNumber = GPS_NUMBER_OFF;
} }
else if((strValue[i][0] - '0') == 1) else if((strValue[i][0] - '0') == 1)
{ {
@ -1114,16 +1114,21 @@ UINT8 sf_message_data_processing(UINT8 strValue[30][32], UINT16 mm, UINT8 *sms_s
{ {
if(SF_STRLEN(strValue[i]) == 5) if(SF_STRLEN(strValue[i]) == 5)
{ {
if((strValue[i][4] - '0') == 1) if((strValue[i][4] - '0') == 1)
{ {
CameraCmd.formatSD = 1; CameraCmd.formatSD = 1;
Readmmsok = SMS_STATUS_RECIEV; Readmmsok = SMS_STATUS_RECIEV;
} }
else else if((strValue[i][4] - '0') == 2)
{ {
printf("Error Parameter line:%d i=%d\n", __LINE__, i); CameraCmd.formatSD = 2;
Readmmsok = SMS_STATUS_PARA_ERR; Readmmsok = SMS_STATUS_RECIEV;
} }
else
{
printf("Error Parameter line:%d i=%d\n", __LINE__, i);
Readmmsok = SMS_STATUS_PARA_ERR;
}
} }
else else
{ {
@ -1979,8 +1984,8 @@ void sf_hd_pic_add_to_list(UINT8 *fileName)
char fname[50] = {0}; char fname[50] = {0};
printf("[%s:%d] add to list:%s\n", __FUNCTION__, __LINE__, fileName); printf("[%s:%d] add to list:%s\n", __FUNCTION__, __LINE__, fileName);
SF_STRNCPY(tempStr, fileName+1, 3); SF_STRNCPY(tempStr, fileName+2, 2);
dirKey = atoi((const char *)tempStr); dirKey = atoi((const char *)tempStr) + 100;
fileKey = atoi((const char *)fileName+4); fileKey = atoi((const char *)fileName+4);
if(strstr((char*)fileName, "E")) if(strstr((char*)fileName, "E"))
{ {
@ -2128,8 +2133,8 @@ void sf_video_add_to_list(UINT8 *fileName)
printf("add to list:%s\n", fileName); printf("add to list:%s\n", fileName);
SF_STRNCPY(tempStr, fileName+1, 3); SF_STRNCPY(tempStr, fileName+2, 2);
dirKey = atoi((const char *)tempStr); dirKey = atoi((const char *)tempStr) + 100;
fileKey = atoi((const char *)fileName+4); fileKey = atoi((const char *)fileName+4);
fileIndex = dirKey * 10000 + fileKey + 1; fileIndex = dirKey * 10000 + fileKey + 1;
@ -2478,15 +2483,23 @@ SINT32 sf_power_off_check_format_sd(void)
{ {
SF_MESSAGE_BUF_S stMessageBuf = {0}; SF_MESSAGE_BUF_S stMessageBuf = {0};
if(CameraCmd.formatSD) if(CameraCmd.formatSD == 1)
{ {
if((sf_in_card_exist()) && (sf_is_card())) if((sf_in_card_exist()) && (sf_is_card()))
{ {
stMessageBuf.arg2 = CameraCmd.formatSD;
stMessageBuf.arg1 = CMD_SD_FORMAT; stMessageBuf.arg1 = CMD_SD_FORMAT;
stMessageBuf.cmdId = CMD_SD; stMessageBuf.cmdId = CMD_SD;
sf_com_message_send_to_cardv(&stMessageBuf); sf_com_message_send_to_cardv(&stMessageBuf);
} }
} }
else if(CameraCmd.formatSD == 2)
{
stMessageBuf.arg2 = CameraCmd.formatSD;
stMessageBuf.arg1 = CMD_SD_FORMAT;
stMessageBuf.cmdId = CMD_SD;
sf_com_message_send_to_cardv(&stMessageBuf);
}
return 0; return 0;
} }

View File

@ -90,7 +90,7 @@ SINT32 app_ttyusb_IsOpen(void) {
MLOGD("ttyUSB has not been init, will init ttyUSB!\n"); MLOGD("ttyUSB has not been init, will init ttyUSB!\n");
UINT8 i = 0; UINT8 i = 0;
RETRY:
for (i = 0; i < 150; i++) { for (i = 0; i < 150; i++) {
if (access("/dev/ttyUSB2", F_OK) == SF_SUCCESS) { if (access("/dev/ttyUSB2", F_OK) == SF_SUCCESS) {
printf("tty usb ko exist!\r\n"); printf("tty usb ko exist!\r\n");
@ -111,9 +111,12 @@ SINT32 app_ttyusb_IsOpen(void) {
if ((0 == retryFlag) && (retryTime >= 100) && if ((0 == retryFlag) && (retryTime >= 100) &&
(retryTime % 100 == 0)) // 200ms*100 = 20s (retryTime % 100 == 0)) // 200ms*100 = 20s
{ {
MLOGE("-------ttyUSB init fail, clos usb mux.\n"); MLOGE("-------ttyUSB init fail, reset module.\n");
sf_ttyusb_restart(); sf_mcu_reg_set(SF_MCU_RESET_MODULE, 0);
sleep(5);
retryFlag = 1; retryFlag = 1;
retryTime = 0;
goto RETRY;
} else if ((1 == retryFlag) && (retryTime >= 50) && } else if ((1 == retryFlag) && (retryTime >= 50) &&
(retryTime % 50 == 0)) // 200ms*25 = 5s (retryTime % 50 == 0)) // 200ms*25 = 5s
{ {

View File

@ -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};
UINT8 SDSendFalg = 0;
UINT8 EmmcSendFalg = 0;
printf("%s:%d s\n", __FUNCTION__, __LINE__); printf("%s:%d s\n", __FUNCTION__, __LINE__);
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
char tmp[64] = {'\0'};
char *strg_path = sf_get_root_path();
if(strg_path == NULL)
{
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;
} }

View File

@ -515,7 +515,7 @@ static signed int sf_blue_command_request_process(U8 *val, unsigned int nval, U8
} }
else if(tmpValue == 1) else if(tmpValue == 1)
{ {
puiPara->ImgSize = PHOTO_SIZE_12M; //puiPara->ImgSize = PHOTO_SIZE_12M;
} }
else if(tmpValue == 2) else if(tmpValue == 2)
{ {
@ -654,7 +654,7 @@ static signed int sf_blue_command_request_process(U8 *val, unsigned int nval, U8
case BLE_SET_CAMERA_NightMode: //O case BLE_SET_CAMERA_NightMode: //O
{ {
BLU_SLOGI("[BLE_SET_CAMERA_NightMode],nightMode:%d\n",pMsgStruct->msgBuf.setNightMode.nightMode); BLU_SLOGI("[BLE_SET_CAMERA_NightMode],nightMode:%d\n",pMsgStruct->msgBuf.setNightMode.nightMode);
puiPara->NightMode = pMsgStruct->msgBuf.setNightMode.nightMode % 3; //puiPara->NightMode = pMsgStruct->msgBuf.setNightMode.nightMode % 3;
respFlag = 2; respFlag = 2;
paramSaveFlag = 1; paramSaveFlag = 1;
} }
@ -944,6 +944,36 @@ static signed int sf_blue_command_request_process(U8 *val, unsigned int nval, U8
sf_com_message_send_to_app(&stMessageBuf); sf_com_message_send_to_app(&stMessageBuf);
respFlag = 0; respFlag = 0;
break; break;
case BLE_CONTROL_CAMERA_FormatEmmcCard:
{
BLU_SLOGI("[BLE_CONTROL_CAMERA_FormatEmmcCard],format:%d\n",pMsgStruct->msgBuf.ctrlFormatEmmc.format);
if(pMsgStruct->msgBuf.ctrlFormatEmmc.format == 1)
{
stMessageBuf.arg2 = 1;
stMessageBuf.arg1 = CMD_SD_FORMAT;
stMessageBuf.cmdId = CMD_SD;
sf_com_message_send_to_cardv(&stMessageBuf);
sf_set_card_statu(CMD_FORMAT_SD_STA);
// while(CMD_FORMAT_SD_STA == sf_get_card_statu())
// {
// usleep(100*1000);
// }
ret = sf_get_card_statu();
if(ret == CMD_FORMAT_SD_OK)
{
ret = 0;
}
else
{
ret = 0x10;
}
}
msgParse.msgBuf.camreaSetRsp.cmdRet = ret;
msgParse.msgBuf.camreaSetRsp.suffix = htons(MSG_BLE_END_FIX);
msgParse.msglen = htons(sizeof(MSG_DEV_BLE_SET_Rsp_T) + 2*sizeof(UINT16));
respFlag = 1;
}
break;
default: default:
{ {
msgParse.msgBuf.camreaSetRsp.cmdRet = -1; msgParse.msgBuf.camreaSetRsp.cmdRet = -1;

View File

@ -74,6 +74,7 @@ typedef enum
BLE_CONTROL_CAMERA_Debug = 0x3a, //debug模式 BLE_CONTROL_CAMERA_Debug = 0x3a, //debug模式
BLE_CONTROL_CAMERA_Network_Scan = 0x3b, //Network scan BLE_CONTROL_CAMERA_Network_Scan = 0x3b, //Network scan
BLE_CONTROL_CAMERA_Network_Select = 0x3c,//Network select BLE_CONTROL_CAMERA_Network_Select = 0x3c,//Network select
BLE_CONTROL_CAMERA_FormatEmmcCard = 0x3d,//格式化emmc
BLE_CMD_MAX = 0x40, BLE_CMD_MAX = 0x40,
} BLE_CMD_E; } BLE_CMD_E;
@ -407,6 +408,18 @@ typedef struct
UINT16 suffix; /* 0xFFEE */ UINT16 suffix; /* 0xFFEE */
} __attribute__((packed)) MSG_DEV_BLE_FormatSDCard_Ctrl_RSP_T; } __attribute__((packed)) MSG_DEV_BLE_FormatSDCard_Ctrl_RSP_T;
typedef struct
{
UINT8 format; /* 1format immediately */
UINT16 sufix; /* 0xFFEE */
} __attribute__((packed)) MSG_DEV_BLE_FormatEmmcCard_Ctrl_T;
typedef struct
{
UINT8 cmdRet; /* 0: mean cmd OK othermean cmd error */
UINT16 suffix; /* 0xFFEE */
} __attribute__((packed)) MSG_DEV_BLE_FormatEmmcCard_Ctrl_RSP_T;
typedef struct typedef struct
{ {
UINT8 reboot; /* 1: Reboot */ UINT8 reboot; /* 1: Reboot */
@ -575,6 +588,10 @@ typedef struct
/*Network select*/ /*Network select*/
MSG_DEV_NetworkSelect_Ctrl_T ctrlNetworkSelect; MSG_DEV_NetworkSelect_Ctrl_T ctrlNetworkSelect;
MSG_DEV_NetworkSelect_Ctrl_Rsp_T rctrlNetworkSelect; MSG_DEV_NetworkSelect_Ctrl_Rsp_T rctrlNetworkSelect;
/*格式化Emmc卡*/
MSG_DEV_BLE_FormatEmmcCard_Ctrl_T ctrlFormatEmmc;
MSG_DEV_BLE_FormatEmmcCard_Ctrl_RSP_T rctrlFormatEmmc;
}; };
} __attribute__((packed)) BLE_APP_MSG_T; } __attribute__((packed)) BLE_APP_MSG_T;
typedef struct typedef struct

View File

@ -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;
} }

View File

@ -101,6 +101,10 @@ UINT8 sf_mcu_write_multi(UINT8 reg[], UINT8 data[], UINT32 num)
{ {
printf("W_addr[%d]=0x%02x\n", reg[i], data[i]); printf("W_addr[%d]=0x%02x\n", reg[i], data[i]);
} }
printf("\n");
fflush(NULL);
system("sync");
sf_sleep_ms(100);
if(0 <= sf_commu_set_mcu_many(reg, data, &pnum)) if(0 <= sf_commu_set_mcu_many(reg, data, &pnum))
{ {
// for(i = 0; i < num; i++) // for(i = 0; i < num; i++)

View File

@ -150,6 +150,12 @@ static clientContext_t* DeleteClientContext( clientContext_t **ppClientHead,
if (pClient == *ppClientHead) if (pClient == *ppClientHead)
{ {
pTemp = *ppClientHead; pTemp = *ppClientHead;
if(pTemp == NULL)
{
MLOGE(" pTemp NULL\n");
pthread_mutex_unlock(&gAppDataSvrMutex);
return NULL;
}
*ppClientHead = (*ppClientHead)->p_next ; *ppClientHead = (*ppClientHead)->p_next ;
close(pTemp->socket); close(pTemp->socket);
free(pTemp); free(pTemp);
@ -166,6 +172,12 @@ static clientContext_t* DeleteClientContext( clientContext_t **ppClientHead,
if (pCurr == pClient) if (pCurr == pClient)
{ {
pTemp = pCurr->p_next; pTemp = pCurr->p_next;
if(pTemp == NULL)
{
MLOGE(" pTemp NULL\n");
pthread_mutex_unlock(&gAppDataSvrMutex);
return NULL;
}
pPrev->p_next = pTemp; pPrev->p_next = pTemp;
close(pCurr->socket); close(pCurr->socket);
free(pCurr); free(pCurr);
@ -299,6 +311,11 @@ void sf_DataMapClear(clientContext_t *pClient)
{ {
//pClient->map.key = 0; //pClient->map.key = 0;
// printf("pClient.map:%d,socket:%d\n",pClient->map.fd,pClient->socket); // printf("pClient.map:%d,socket:%d\n",pClient->map.fd,pClient->socket);
if(pClient == NULL)
{
MLOGE(" pClient NULL\n");
return;
}
if(pClient->map.fd) if(pClient->map.fd)
close(pClient->map.fd); close(pClient->map.fd);
@ -354,10 +371,11 @@ U8 sf_DataMapSet(U32 key, U8 function, S8 *fileName, U32 FileSize)
pClient->map.function = function; pClient->map.function = function;
if(function) if(function)
{ {
memset((char *)&pClient->map.fileName[0],'\0', sizeof(pClient->map.fileName));
memcpy((char *)&pClient->map.fileName[0], (char *)fileName,strlen((char *)fileName)); memcpy((char *)&pClient->map.fileName[0], (char *)fileName,strlen((char *)fileName));
// pClient->map.fileName[strlen(fileName)+1]=0; // pClient->map.fileName[strlen(fileName)+1]=0;
pClient->map.fileSize = FileSize; pClient->map.fileSize = FileSize;
printf("pClient->map.function:%d map.fileName:%s,filename:%s,len:%d fileSize:%d\n",pClient->map.function, pClient->map.fileName,fileName,strlen((char *)fileName),pClient->map.fileSize); MLOGI("pClient->map.function:%d map.fileName:%s,filename:%s,len:%d fileSize:%d\n",pClient->map.function, pClient->map.fileName,fileName,strlen((char *)fileName),pClient->map.fileSize);
} }
else else
@ -377,6 +395,7 @@ U8 sf_DataMapSet(U32 key, U8 function, S8 *fileName, U32 FileSize)
} }
} }
pthread_mutex_unlock(&gAppDataSvrMutex); pthread_mutex_unlock(&gAppDataSvrMutex);
// MLOGI("SUCCESS\n");
return SUCCESS; return SUCCESS;
} }
pClient = pClient->p_next; pClient = pClient->p_next;
@ -568,13 +587,14 @@ void *sf_DataSvrTransferThread(void *addr)
else if(pClient->map.function == 2) //download else if(pClient->map.function == 2) //download
{ {
sf_set_auto_off_time(0);/*reset power off count time*/ sf_set_auto_off_time(0);/*reset power off count time*/
// printf("[read],fd:%x,pClient->map.fileName:%s,len:%d\n",pClient->map.fd,pClient->map.fileName,strlen((char*)(pClient->map.fileName))); // MLOGI("[read],fd:%x,pClient->map.fileName:%s,len:%d\n",pClient->map.fd,pClient->map.fileName,strlen((char*)(pClient->map.fileName)));
if(pClient->map.fd <= 0) if(pClient->map.fd <= 0)
{ {
if(pClient->map.fileName[0] != '\0') if(pClient->map.fileName[0] != '\0')
{ {
pClient->map.fd = open((char *)pClient->map.fileName, O_RDWR,0/*borbuild FS_OPEN_RDONLY*/); pClient->map.fd = open((char *)pClient->map.fileName, O_RDWR,0/*borbuild FS_OPEN_RDONLY*/);
// printf("pClient->map.fd = %d\n",pClient->map.fd); // printf("pClient->map.fd = %d\n",pClient->map.fd);
// MLOGI("pClient->map.fd = %d\n",pClient->map.fd);
if(pClient->map.fd == -1) if(pClient->map.fd == -1)
{ {
//open file failed. //open file failed.
@ -585,6 +605,7 @@ void *sf_DataSvrTransferThread(void *addr)
pClient->map.fileSize = sp5kFsFileSizeGet((char *)pClient->map.fileName); pClient->map.fileSize = sp5kFsFileSizeGet((char *)pClient->map.fileName);
pClient->map.transferSize = 0; pClient->map.transferSize = 0;
// printf("filesize=%d\n",pClient->map.fileSize); // printf("filesize=%d\n",pClient->map.fileSize);
// MLOGI("pClient->map.fileSize = %d\n",pClient->map.fileSize);
//i = 0; //i = 0;
} }
else else
@ -597,7 +618,7 @@ void *sf_DataSvrTransferThread(void *addr)
} }
readSize = read(pClient->map.fd, pClient->szBuffer, PACKET_MAX_LEN); readSize = read(pClient->map.fd, pClient->szBuffer, PACKET_MAX_LEN);
// printf("[read],fd:%x,readsize:%d,len:%x\n",pClient->map.fd,readSize,PACKET_MAX_LEN); // MLOGI("[read],fd:%x,readsize:%d,len:%d\n",pClient->map.fd,readSize,PACKET_MAX_LEN);
if(readSize > 0) if(readSize > 0)
{ {
//printf("data socket send->%d\n",pClient->socket); //printf("data socket send->%d\n",pClient->socket);
@ -641,7 +662,7 @@ void *sf_DataSvrTransferThread(void *addr)
if(pClient->map.transferSize >= pClient->map.fileSize) if(pClient->map.transferSize >= pClient->map.fileSize)
{ {
// printf("send success!\n"); // MLOGI("send success!\n");
sf_DataMapClear(pClient); sf_DataMapClear(pClient);
//dataTransErrCodeSet(pClient->map.key, CMD_SUCCESS);//remove,because APP not use //dataTransErrCodeSet(pClient->map.key, CMD_SUCCESS);//remove,because APP not use
} }

View File

@ -601,10 +601,12 @@ void appsvr_getFileList(UINT8 *dirPath, UINT8 *startFileKey)
//MLOGI("name:%s.\n", ptr->d_name); //MLOGI("name:%s.\n", ptr->d_name);
if(strstr((char *)ptr->d_name, SF_DCF_EXT_MOV) || strstr((char *)ptr->d_name, SF_DCF_EXT_PHOTO)) if(strstr((char *)ptr->d_name, SF_DCF_EXT_MOV) || strstr((char *)ptr->d_name, SF_DCF_EXT_PHOTO))
{ {
memset(gDevFileList[nFileNums + gDevFileListNums].fileNameString,'\0', sizeof(gDevFileList[nFileNums + gDevFileListNums].fileNameString));
snprintf((char *)gDevFileList[nFileNums + gDevFileListNums].fileNameString, sizeof(gDevFileList[nFileNums + gDevFileListNums].fileNameString), "%s", (char *)ptr->d_name); snprintf((char *)gDevFileList[nFileNums + gDevFileListNums].fileNameString, sizeof(gDevFileList[nFileNums + gDevFileListNums].fileNameString), "%s", (char *)ptr->d_name);
//strcpy((char *)gDevFileList[nFileNums + gDevFileListNums].fileNameString, (char *)ptr->d_name); //strcpy((char *)gDevFileList[nFileNums + gDevFileListNums].fileNameString, (char *)ptr->d_name);
gDevFileList[nFileNums + gDevFileListNums].srcFileType = (ptr->d_name[0] == 'W' ? 0 : (ptr->d_name[0] == 'S' ? 1 : 1));//ptr->d_name[3] - '0'; gDevFileList[nFileNums + gDevFileListNums].srcFileType = (ptr->d_name[0] == 'W' ? 0 : (ptr->d_name[0] == 'S' ? 1 : 1));//ptr->d_name[3] - '0';
//printf("%s\n", g3g75DevFileList[nFileNums - idx + gDevFileListNums].fileName); //printf("%s\n", g3g75DevFileList[nFileNums - idx + gDevFileListNums].fileName);
// MLOGI("fileNameString:%s. srcFileType:%d\n", gDevFileList[nFileNums + gDevFileListNums].fileNameString, gDevFileList[nFileNums + gDevFileListNums].srcFileType);
nFileNums ++ ; nFileNums ++ ;
// MLOGI("fileNameString:%s. srcFileType:%d\n", gDevFileList[nFileNums + gDevFileListNums].fileNameString, gDevFileList[nFileNums + gDevFileListNums].srcFileType); // MLOGI("fileNameString:%s. srcFileType:%d\n", gDevFileList[nFileNums + gDevFileListNums].fileNameString, gDevFileList[nFileNums + gDevFileListNums].srcFileType);
} }
@ -728,12 +730,13 @@ UINT8 appCmpFileList(void)
} }
void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG void appCreatThumbList(S8 *fileName,UINT8 diskType)//start file name example: 10010032.JPG
{ {
//UINT16 i = 0; //UINT16 i = 0;
UINT8 dirPath[50] = {0}; UINT8 dirPath[50] = {0};
UINT8 startDirKey[5] = {0}; UINT8 startDirKey[5] = {0};
UINT8 startFileKey[5] = {0}; UINT8 startFileKey[5] = {0};
//UINT16 dirKey = 0;
//UINT8 temp[5] = {0}; //UINT8 temp[5] = {0};
MLOGI("fileName:%s\n",fileName); MLOGI("fileName:%s\n",fileName);
@ -747,9 +750,14 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG
if(fileName != NULL && fileName[0] != '\0' && fileName[0] != '0' && (strstr((char *)fileName, SF_DCF_EXT_MOV) || strstr((char *)fileName, SF_DCF_EXT_PHOTO))) if(fileName != NULL && fileName[0] != '\0' && fileName[0] != '0' && (strstr((char *)fileName, SF_DCF_EXT_MOV) || strstr((char *)fileName, SF_DCF_EXT_PHOTO)))
{ {
MLOGI("fileName2:%s\n",fileName); //MLOGI("fileName2:%s\n",fileName);
//strncpy((char *)startDirKey, (char *)fileName+1, 2);
//dirKey = atoi((const char *)startDirKey) + 100;
//snprintf((char *)startDirKey, sizeof(startDirKey), "%03d", dirKey);
//strncpy((char *)startFileKey, (char *)fileName+4, 4);
strncpy((char *)startDirKey, (char *)fileName, 3); strncpy((char *)startDirKey, (char *)fileName, 3);
strncpy((char *)startFileKey, (char *)fileName+4, 4); strncpy((char *)startFileKey, (char *)fileName+4, 4);
//MLOGI("startDirKey:%s startFileKey:%s\n", startDirKey, startFileKey);
} }
else else
{ {
@ -764,8 +772,18 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG
gDevFileListNums = 0; gDevFileListNums = 0;
//printf("get dir s\n"); //printf("get dir s\n");
//sprintf((char *)dirPath, "%s/", THUMB_PATH); //sprintf((char *)dirPath, "%s/", THUMB_PATH);
snprintf((char *)dirPath, sizeof(dirPath), "%s%s", strg_path, (char *)THUMB_PATH); if(diskType == 2)
free(strg_path); {
snprintf((char *)dirPath, sizeof(dirPath), "%s%s", SF_SD_ROOT, (char *)THUMB_PATH);
}
else if(diskType == 1)
{
snprintf((char *)dirPath, sizeof(dirPath), "%s%s", SF_EMMC_ROOT, (char *)THUMB_PATH);
}
else {
snprintf((char *)dirPath, sizeof(dirPath), "%s%s", strg_path, (char *)THUMB_PATH);
}
free(strg_path);
appsvr_getFileList(dirPath, startFileKey); appsvr_getFileList(dirPath, startFileKey);
// appsvr_getDirList(dirPath, startDirKey); // appsvr_getDirList(dirPath, startDirKey);
@ -1126,9 +1144,10 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
SF_PARA_TIME_S time; SF_PARA_TIME_S time;
UINT32 curMode = 0; UINT32 curMode = 0;
CHAR fileName[SF_FILENAME_MAXLEN]; CHAR fileName[SF_FILENAME_MAXLEN];
UINT16 dirKey, fileKey, fileType; UINT16 dirKey;
UINT32 keyMap = 0; UINT32 keyMap = 0;
UINT8 function = 0; UINT8 function = 0;
static UINT32 Disk = 0; /* 1:emmc 2:sd */
static UINT32 zmFactor[] = {1000,2000,3018,4000}; static UINT32 zmFactor[] = {1000,2000,3018,4000};
UIMenuStoreInfo *puiPara = sf_ui_para_get(); UIMenuStoreInfo *puiPara = sf_ui_para_get();
@ -1136,6 +1155,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
UINT8 paramSaveFlag = 0; UINT8 paramSaveFlag = 0;
SF_MESSAGE_BUF_S stMessageBuf = {0}; SF_MESSAGE_BUF_S stMessageBuf = {0};
// HI_MESSAGE_S stMessage; // HI_MESSAGE_S stMessage;
MLOGI(" s\n");
char *strg_path = sf_get_root_path(); char *strg_path = sf_get_root_path();
if(strg_path == NULL) if(strg_path == NULL)
@ -1144,8 +1164,8 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
return SF_FAILURE; return SF_FAILURE;
} }
UINT32 dcf_handle = (UINT32)System_Get_DCF_Handle(); /* 0:emmc 1:sd */ UINT32 dcf_handle = 0; /* 0:emmc 1:sd */
char *dcf_file = System_Get_DCF_Disk_Drive(dcf_handle) == SF_EMMC_DCF_HANDLE ? SF_EMMC_DCF_FILE_NAME : SF_SD_DCF_FILE_NAME; //char *dcf_file = System_Get_DCF_Disk_Drive(dcf_handle) == SF_EMMC_DCF_HANDLE ? SF_EMMC_DCF_FILE_NAME : SF_SD_DCF_FILE_NAME;
//printf("[sf_svr_packet_proc]dataLen: %d\n",dataLen); //printf("[sf_svr_packet_proc]dataLen: %d\n",dataLen);
@ -1229,7 +1249,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
respFlag = -1; respFlag = -1;
if(msgParse.cmd != WIFI_GET_CAMERA_CONNECT) if(msgParse.cmd != WIFI_GET_CAMERA_CONNECT)
printf("cmd: %d\n",msgParse.cmd); printf("cmd: 0x%x\n",msgParse.cmd);
if(msgParse.cmd < WIFI_CMD_MAX) if(msgParse.cmd < WIFI_CMD_MAX)
{ {
@ -1288,10 +1308,14 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
case WIFI_GET_CAMERA_THUMB_LIST: //o case WIFI_GET_CAMERA_THUMB_LIST: //o
strcpy((char *)fileName, (char *)pMsgStruct->msgBuf.getThumbList.fileName); strcpy((char *)fileName, (char *)pMsgStruct->msgBuf.getThumbList.fileName);
MLOGI("[WIFI_GET_CAMERA_THUMB_LIST],fileName:%s\n",fileName); if((pMsgStruct->msgBuf.getThumbList.diskType) && (Disk != pMsgStruct->msgBuf.getThumbList.diskType))
appCreatThumbList(fileName); {
MLOGI("[WIFI_GET_CAMERA_THUMB_LIST],fileName:%s\n",fileName); Disk = pMsgStruct->msgBuf.getThumbList.diskType;
memset(fileName,'\0', sizeof(fileName));
}
MLOGI("[WIFI_GET_CAMERA_THUMB_LIST],fileName:%s diskType:%d\n",fileName,pMsgStruct->msgBuf.getThumbList.diskType);
appCreatThumbList(fileName,pMsgStruct->msgBuf.getThumbList.diskType);
//MLOGI("[WIFI_GET_CAMERA_THUMB_LIST],fileName:%s\n",fileName);
memset((void *)&msgParse, 0, sizeof(msgParse)); memset((void *)&msgParse, 0, sizeof(msgParse));
msgParse.magicNum = htons(MSG_PRE_FIX); msgParse.magicNum = htons(MSG_PRE_FIX);
msgParse.msglen = htons(sizeof(MSG_DEV_THUMB_LIST_Get_Rsp_T) + 2*sizeof(UINT16)); msgParse.msglen = htons(sizeof(MSG_DEV_THUMB_LIST_Get_Rsp_T) + 2*sizeof(UINT16));
@ -1300,7 +1324,11 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
msgParse.msgBuf.rgetThumbList.cmdRet = 0; msgParse.msgBuf.rgetThumbList.cmdRet = 0;
msgParse.msgBuf.rgetThumbList.fileNums = htonl(gDevFileListNums); msgParse.msgBuf.rgetThumbList.fileNums = htonl(gDevFileListNums);
msgParse.msgBuf.rgetThumbList.packageSize = htonl(gDevFileListNums*sizeof(MSG_DEV_THUMB_LIST_Get_Data_Rsp_T)); msgParse.msgBuf.rgetThumbList.packageSize = htonl(gDevFileListNums*sizeof(MSG_DEV_THUMB_LIST_Get_Data_Rsp_T));
//dcf_handle
dcf_handle = (UINT32)System_Get_DCF_Handle(); /* 0:emmc 1:sd */
msgParse.msgBuf.rgetThumbList.diskType = pMsgStruct->msgBuf.getThumbList.diskType == 0 ? (dcf_handle == 0 ? 1:1):pMsgStruct->msgBuf.getThumbList.diskType;
msgParse.msgBuf.rgetThumbList.suffix = htons(MSG_END_FIX); msgParse.msgBuf.rgetThumbList.suffix = htons(MSG_END_FIX);
MLOGI("msgParse.msgBuf.rgetThumbList.diskType:%d\n",msgParse.msgBuf.rgetThumbList.diskType);
/* add the magic + len total 2*2 bytes; */ /* add the magic + len total 2*2 bytes; */
temp = ntohs(msgParse.msglen); temp = ntohs(msgParse.msglen);
send(fd, (void *)(&msgParse), (temp + sizeof(UINT16)*2), 0); send(fd, (void *)(&msgParse), (temp + sizeof(UINT16)*2), 0);
@ -1352,21 +1380,30 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
if(pMsgStruct->msgBuf.getHdFile.type == 0) //thumbnail if(pMsgStruct->msgBuf.getHdFile.type == 0) //thumbnail
{ {
strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.getHdFile.dirName); strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.getHdFile.dirName);
strncpy((char *)tempbuf2, (char *)pMsgStruct->msgBuf.getHdFile.dirName, 3); if(strstr((char*)tempbuf, "E"))
sprintf((char *)gFileName, "%s%s%s/%s", strg_path, THUMB_PATH, tempbuf2, tempbuf); {
snprintf(gFileName, sizeof(gFileName), "%s%s%s", SF_SD_ROOT, THUMB_PATH, tempbuf);
}
else
{
snprintf(gFileName, sizeof(gFileName), "%s%s%s", SF_EMMC_ROOT, THUMB_PATH, tempbuf);
}
} }
else if(pMsgStruct->msgBuf.getHdFile.type == 1) //srouce file else if(pMsgStruct->msgBuf.getHdFile.type == 1) //srouce file
{ {
strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.getHdFile.dirName); strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName);
strncpy((char *)tempbuf2, (char *)tempbuf, 3); strncpy((char *)tempbuf2, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName +2, 2);
dirKey = atoi((const char *)tempbuf2) + 100;
tempbuf[8] = '\0'; tempbuf[8] = '\0';
sprintf((char *)gFileName, "%sDCIM/%s%s/%s%s%s", if(strstr((char*)tempbuf, "E"))
strg_path, {
tempbuf2, snprintf(fileName, sizeof(fileName), "%sDCIM/%03d%s/%s%s%s", SF_SD_ROOT, dirKey, DCF_DIR_NAME, SF_SD_DCF_FILE_NAME, tempbuf+4, (tempbuf[0] == 'W' ? ".JPG" : (tempbuf[0] == 'S' ? ".MP4" : ".MP4")));
DCF_DIR_NAME, }
dcf_file, else//
tempbuf+4, {
(tempbuf[3] == '0' ? ".JPG" : (tempbuf[3] == '1' ? ".MP4" : ".MP4"))); snprintf(fileName, sizeof(fileName), "%sDCIM/%03d%s/%s%s%s", SF_EMMC_ROOT, dirKey, DCF_DIR_NAME, SF_EMMC_DCF_FILE_NAME, tempbuf+4, (tempbuf[0] == 'W' ? ".JPG" : (tempbuf[0] == 'S' ? ".MP4" : ".MP4")));
}
} }
else else
{ {
@ -1484,7 +1521,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
} }
else if(tmpValue == 1) else if(tmpValue == 1)
{ {
puiPara->ImgSize = PHOTO_SIZE_12M; //puiPara->ImgSize = PHOTO_SIZE_12M;
} }
else if(tmpValue == 2) else if(tmpValue == 2)
{ {
@ -1626,7 +1663,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
case WIFI_SET_CAMERA_NightMode: //O case WIFI_SET_CAMERA_NightMode: //O
MLOGI("[WIFI_SET_CAMERA_NightMode],nightMode:%d\n",pMsgStruct->msgBuf.setNightMode.nightMode); MLOGI("[WIFI_SET_CAMERA_NightMode],nightMode:%d\n",pMsgStruct->msgBuf.setNightMode.nightMode);
puiPara->NightMode = pMsgStruct->msgBuf.setNightMode.nightMode % 3; //puiPara->NightMode = pMsgStruct->msgBuf.setNightMode.nightMode % 3;
//sf_set_img_size(puiPara->ImgSize); //sf_set_img_size(puiPara->ImgSize);
respFlag = 2; respFlag = 2;
paramSaveFlag = 1; paramSaveFlag = 1;
@ -1887,27 +1924,38 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
if(function) if(function)
{ {
memset(tempbuf,'\0', sizeof(tempbuf));
memset(tempbuf2,'\0', sizeof(tempbuf2));
memset(fileName,'\0', sizeof(fileName));
if(pMsgStruct->msgBuf.ctrlFileTransfer.type == 0) //thumbnail if(pMsgStruct->msgBuf.ctrlFileTransfer.type == 0) //thumbnail
{ {
//strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName); //strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName);
memcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName,strlen((char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName)); snprintf((char *)tempbuf, sizeof(tempbuf), "%s", pMsgStruct->msgBuf.ctrlFileTransfer.fileName);
//memcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName,strlen((char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName));
sprintf((char *)fileName, "%s%s%s", strg_path, THUMB_PATH, tempbuf); if(strstr((char*)tempbuf, "E"))
{
snprintf(fileName, sizeof(fileName), "%s%s%s", SF_SD_ROOT, THUMB_PATH, tempbuf);
}
else
{
snprintf(fileName, sizeof(fileName), "%s%s%s", SF_EMMC_ROOT, THUMB_PATH, tempbuf);
}
} }
else if(pMsgStruct->msgBuf.ctrlFileTransfer.type == 1) //srouce file else if(pMsgStruct->msgBuf.ctrlFileTransfer.type == 1) //srouce file
{ {
strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName); strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName);
strncpy((char *)tempbuf2, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName +1, 3); strncpy((char *)tempbuf2, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName +2, 2);
dirKey = atoi((const char *)tempbuf2) + 100;
tempbuf[8] = '\0'; tempbuf[8] = '\0';
sprintf((char *)fileName, "%sDCIM/%s%s/%s%s%s", if(strstr((char*)tempbuf, "E"))
strg_path, {
tempbuf2, snprintf(fileName, sizeof(fileName), "%sDCIM/%03d%s/%s%s%s", SF_SD_ROOT, dirKey, DCF_DIR_NAME, SF_SD_DCF_FILE_NAME, tempbuf+4, (tempbuf[0] == 'W' ? ".JPG" : (tempbuf[0] == 'S' ? ".MP4" : ".MP4")));
DCF_DIR_NAME, }
dcf_file, else//
tempbuf+4, {
(tempbuf[0] == 'W' ? ".JPG" : (tempbuf[0] == 'S' ? ".MP4" : ".MP4"))); snprintf(fileName, sizeof(fileName), "%sDCIM/%03d%s/%s%s%s", SF_EMMC_ROOT, dirKey, DCF_DIR_NAME, SF_EMMC_DCF_FILE_NAME, tempbuf+4, (tempbuf[0] == 'W' ? ".JPG" : (tempbuf[0] == 'S' ? ".MP4" : ".MP4")));
}
} }
else else
{ {
@ -1937,7 +1985,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
// msgParse.msgBuf.rctrlFileTransferInfo.filePath[13]=0; // msgParse.msgBuf.rctrlFileTransferInfo.filePath[13]=0;
msgParse.msgBuf.rctrlFileTransferInfo.type = (tempbuf[0] == 'W' ? 0 : (tempbuf[0] == 'S' ? 1 : 1)); msgParse.msgBuf.rctrlFileTransferInfo.type = (tempbuf[0] == 'W' ? 0 : (tempbuf[0] == 'S' ? 1 : 1));
fileFd = open((char *)fileName, O_RDONLY); fileFd = open((char *)fileName, O_RDONLY);
//printf("fileFd = %d rctrlFileTransferInfo.type:%d\n", fileFd,msgParse.msgBuf.rctrlFileTransferInfo.type); //MLOGI("fileFd = %d rctrlFileTransferInfo.type:%d fileName:%s filePath:%s\n", fileFd,msgParse.msgBuf.rctrlFileTransferInfo.type, msgParse.msgBuf.rctrlFileTransferInfo.fileName, msgParse.msgBuf.rctrlFileTransferInfo.filePath);
if(fileFd > 0) if(fileFd > 0)
{ {
fSize = sp5kFsFileSizeGet((char *)fileName); fSize = sp5kFsFileSizeGet((char *)fileName);
@ -1961,6 +2009,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
else else
{ {
ret = DATA_CMD_OPEN_FILE_FAIL;/*fileOpen fail*/ ret = DATA_CMD_OPEN_FILE_FAIL;/*fileOpen fail*/
MLOGE("fileName:%s ret:0x%x\n", fileName, ret);
} }
} }
@ -2000,25 +2049,41 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
case WIFI_CONTROL_CAMERA_DeleteFile: //O case WIFI_CONTROL_CAMERA_DeleteFile: //O
MLOGI("[WIFI_SET_FILE_DeleteFile],fileName:%s\n",pMsgStruct->msgBuf.ctrlDelFile.fileName); MLOGI("[WIFI_SET_FILE_DeleteFile],fileName:%s\n",pMsgStruct->msgBuf.ctrlDelFile.fileName);
strcpy((char *)fileName, (char *)pMsgStruct->msgBuf.ctrlDelFile.fileName); memset(tempbuf,'\0', sizeof(tempbuf));
if(strlen((char *)fileName) == 12) // only file name memset(tempbuf2,'\0', sizeof(tempbuf2));
{ memset(fileName,'\0', sizeof(fileName));
appThumbNameToKey((thumbType_t *)&fileType, &dirKey, &fileKey, fileName);
appThumbKeyToName(THUMB_320x240, fileType, dirKey, fileKey, fileName);
ret = remove((char *)fileName);
MLOGI("delete thumb name=%s ret=%d\n",fileName,ret);
if(fileType == STILL_THUMB)
sprintf((char *)fileName,"./%3dMEDIA/%s%04d.JPG", dirKey, dcf_file, fileKey);
else
sprintf((char *)fileName,"./%3dMEDIA/%s%04d.MP4", dirKey, dcf_file, fileKey);
ret = remove((char *)fileName);
if(strlen((char *)pMsgStruct->msgBuf.ctrlDelFile.fileName) == 12) // only file name
{
strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.ctrlDelFile.fileName);
strncpy((char *)tempbuf2, (char *)pMsgStruct->msgBuf.ctrlDelFile.fileName +2, 2);
dirKey = atoi((const char *)tempbuf2) + 100;
if(strstr((char*)pMsgStruct->msgBuf.ctrlDelFile.fileName, "E"))
{
snprintf(fileName, sizeof(fileName), "%s%s%s", SF_SD_ROOT, THUMB_PATH, pMsgStruct->msgBuf.ctrlDelFile.fileName);
ret = remove((char *)fileName);
MLOGI("delete thumb name=%s ret=%d\n",fileName,ret);
snprintf(fileName, sizeof(fileName), "%sDCIM/%03d%s/%s%s%s", SF_SD_ROOT, dirKey, DCF_DIR_NAME, SF_SD_DCF_FILE_NAME, tempbuf+4, (tempbuf[0] == 'W' ? ".JPG" : (tempbuf[0] == 'S' ? ".MP4" : ".MP4")));
ret = remove((char *)fileName);
MLOGI("delete src name=%s ret=%d\n",fileName,ret);
}
else
{
snprintf(fileName, sizeof(fileName), "%s%s%s", SF_EMMC_ROOT, THUMB_PATH, pMsgStruct->msgBuf.ctrlDelFile.fileName);
ret = remove((char *)fileName);
MLOGI("delete thumb name=%s ret=%d\n",fileName,ret);
snprintf(fileName, sizeof(fileName), "%sDCIM/%03d%s/%s%s%s", SF_EMMC_ROOT, dirKey, DCF_DIR_NAME, SF_EMMC_DCF_FILE_NAME, tempbuf+4, (tempbuf[0] == 'W' ? ".JPG" : (tempbuf[0] == 'S' ? ".MP4" : ".MP4")));
ret = remove((char *)fileName);
MLOGI("delete src name=%s ret=%d\n",fileName,ret);
}
} }
else // path + file name else // path + file name
{ {
ret = remove((char *)fileName); ret = remove((char *)fileName);
} }
system("sync");
msgParse.msgBuf.rctrlDelFile.cmdRet = (ret ? 1 : 0); msgParse.msgBuf.rctrlDelFile.cmdRet = (ret ? 1 : 0);
msgParse.msgBuf.rctrlDelFile.suffix = htons(MSG_END_FIX); msgParse.msgBuf.rctrlDelFile.suffix = htons(MSG_END_FIX);
/* add the cmd + resp total 2*2 bytes */ /* add the cmd + resp total 2*2 bytes */
@ -2169,7 +2234,23 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen)
respFlag = 0; respFlag = 0;
break; break;
#endif #endif
case WIFI_CONTROL_CAMERA_FormatEmmcCard: //err
MLOGI("[WIFI_CONTROL_CAMERA_FormatSDCard],format:%d\n",pMsgStruct->msgBuf.ctrlFormatEmmc.format);
if(pMsgStruct->msgBuf.ctrlFormatEmmc.format == 1)
{
sf_set_card_statu(CMD_FORMAT_SD_STA);
BKG_PostEvent(NVTEVT_BKW_FORMAT_EMMC);
while(CMD_FORMAT_SD_STA == sf_get_card_statu())
{
usleep(10*1000);
}
ret = sf_get_card_statu();
}
msgParse.msgBuf.camreaSetRsp.cmdRet = ret;
msgParse.msgBuf.camreaSetRsp.suffix = htons(MSG_END_FIX);
msgParse.msglen = htons(sizeof(MSG_DEV_SET_Rsp_T) + 2*sizeof(UINT16) );
respFlag = 1;
break;
default: default:
WIFI_SLOGI("[WIFI_CMD_MAX] default\n"); WIFI_SLOGI("[WIFI_CMD_MAX] default\n");
msgParse.msgBuf.camreaSetRsp.cmdRet = -1; msgParse.msgBuf.camreaSetRsp.cmdRet = -1;
@ -2551,6 +2632,7 @@ void *sf_server_accept_thread(void *pData)
pClient->totalBytes = nbytes; pClient->totalBytes = nbytes;
ret = sf_svr_packet_proc(pClient->socket,pClient->szBuffer,nbytes); ret = sf_svr_packet_proc(pClient->socket,pClient->szBuffer,nbytes);
MLOGI(" sf_svr_packet_proc e ret:%x\n", ret);
/*forbuild if(gFwUpdate == 1) /*forbuild if(gFwUpdate == 1)
{ {

View File

@ -1942,7 +1942,15 @@ static SINT32 sf_cardv_proccess_cmd_sd(SF_MESSAGE_BUF_S *pMessageBuf)
{ {
case CMD_SD_FORMAT: case CMD_SD_FORMAT:
sf_set_card_statu(CMD_FORMAT_SD_STA); sf_set_card_statu(CMD_FORMAT_SD_STA);
BKG_PostEvent(NVTEVT_BKW_FORMAT_CARD); if(pMessageBuf->arg2 == 1)
{
BKG_PostEvent(NVTEVT_BKW_FORMAT_EMMC);
}
else
{
BKG_PostEvent(NVTEVT_BKW_FORMAT_CARD);
}
while(CMD_FORMAT_SD_STA == sf_get_card_statu()) while(CMD_FORMAT_SD_STA == sf_get_card_statu())
{ {
usleep(10*1000); usleep(10*1000);

View File

@ -1011,7 +1011,7 @@ static void MovieFast_FileNamingCB(MOVIE_CFG_REC_ID id, char *pFileName)
DBG_DUMP("%s added to DCF\r\n", pFileName); DBG_DUMP("%s added to DCF\r\n", pFileName);
#if HUNTING_CAMERA_MCU == ENABLE #if HUNTING_CAMERA_MCU == ENABLE
char tmp[NMC_TOTALFILEPATH_MAX_LEN] = {'\0'}; char tmp[NMC_TOTALFILEPATH_MAX_LEN] = {'\0'};
sprintf(tmp, "S%c%03ld%04ld.JPG", font, nextFolderID, nextFileID); sprintf(tmp, "S%c%02ld%04ld.JPG", font, nextFolderID%100, nextFileID);
if(id == _CFG_REC_ID_1){ if(id == _CFG_REC_ID_1){
snprintf(thumb_current_path_main, sizeof(thumb_current_path_main), "%s", tmp); snprintf(thumb_current_path_main, sizeof(thumb_current_path_main), "%s", tmp);
} }
@ -1797,6 +1797,9 @@ THREAD_RETTYPE MovieFast_InitMovieModeThread(void *arg)
HD_VIDEO_FRAME frame_capture = {0}; HD_VIDEO_FRAME frame_capture = {0};
VOS_TICK t1, t2;
vos_perf_mark(&t1);
{ {
HD_VIDEO_FRAME frame; HD_VIDEO_FRAME frame;
HD_PATH_ID alg_path; HD_PATH_ID alg_path;
@ -1872,6 +1875,13 @@ THREAD_RETTYPE MovieFast_InitMovieModeThread(void *arg)
hd_videoproc_release_out_buf(alg_path, &frame); hd_videoproc_release_out_buf(alg_path, &frame);
} }
vos_perf_mark(&t2);
if((vos_perf_duration(t1, t2) / 1000) > (20*1000))
{
fastboot_msg_en(ENABLE);
DBG_ERR("failed timeout\n");
goto EXIT;
}
} while(1); } while(1);
vos_perf_mark(&g_alg_end_time); vos_perf_mark(&g_alg_end_time);
@ -1898,8 +1908,6 @@ THREAD_RETTYPE MovieFast_InitMovieModeThread(void *arg)
vos_flag_set(MOVIEFAST_FLG_ID, FLGMOVIEFAST_RECSTART); vos_flag_set(MOVIEFAST_FLG_ID, FLGMOVIEFAST_RECSTART);
VOS_TICK t1, t2;
vos_perf_mark(&t1); vos_perf_mark(&t1);
#if 1 #if 1