diff --git a/code/application/source/sf_app/code/source/wifi/sf_data_transfer.c b/code/application/source/sf_app/code/source/wifi/sf_data_transfer.c old mode 100644 new mode 100755 index d0d6975b7..bf7a87db5 --- a/code/application/source/sf_app/code/source/wifi/sf_data_transfer.c +++ b/code/application/source/sf_app/code/source/wifi/sf_data_transfer.c @@ -320,11 +320,14 @@ U8 sf_DataMapSet(U32 key, U8 function, S8 *fileName, U32 FileSize) MLOGI(" key:%d,fileName:%s\n",key,fileName); - if(fileName == NULL) + if(fileName == NULL){ + MLOGE("CMD_ERR error!\n"); return CMD_ERR; + } if(pClient == NULL) { + MLOGE("pClient == NULL error!\n"); return DATA_CMD_8855_NO_CONNECT; } @@ -352,9 +355,10 @@ U8 sf_DataMapSet(U32 key, U8 function, S8 *fileName, U32 FileSize) if(function) { memcpy((char *)&pClient->map.fileName[0], (char *)fileName,strlen((char *)fileName)); - // printf("map.fileName:%s,filename:%s,len:%d\n",pClient->map.fileName,fileName,strlen((char *)fileName)); // pClient->map.fileName[strlen(fileName)+1]=0; 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); + } else { @@ -459,7 +463,7 @@ void *sf_DataSvrTransferThread(void *addr) if(pClient->map.function != 3) { - MLOGI("function=%d,name=%s\n",pClient->map.function,pClient->map.fileName); + MLOGI("key:%d function=%d,name=%s\n",pClient->map.key, pClient->map.function,pClient->map.fileName); //printf("socket=%d,key=%d,C_port=%d\n",pClient->socket,pClient->map.key,ntohs(pClient->ClientAddr.sin_port)); } //pClient->map.fileName[47]=0; @@ -467,6 +471,7 @@ void *sf_DataSvrTransferThread(void *addr) //send(pClient->socket, tmpbuf, 100); if(pClient->map.function == 0 || poweroff_mode) //stop { + MLOGI("key:%d function=%d,name=%s\n",pClient->map.key, pClient->map.function,pClient->map.fileName); sf_DataMapClear(pClient); if(poweroff_mode) { diff --git a/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c b/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c old mode 100644 new mode 100755 index 9e8ef91b8..7261d4925 --- a/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c +++ b/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c @@ -25,6 +25,7 @@ //#include "sf_syslib.h" //#include "sf_para.h" +#include "sf_param_common.h" #include "sf_wifi_svr.h" #include "sf_data_transfer.h" #include "sf_svr_send.h" @@ -55,6 +56,7 @@ #include "Mode/UIModePhoto.h" #include "Mode/UIModeMovie.h" #include "sf_log.h" +#include "DCF.h" #if SF_LPA_SDK #include "lpasdk/api/lpasdk_api.h" #include "sf_4g_lpa.h" @@ -85,6 +87,8 @@ #define SF_WIFI_NETDEV_NAME "ap0" #define SF_WIFI_NETDEV_8189_NAME "wlan0" +#define FILE_LIST_NUM_MAX ((MAX_DCF_FILE_NUM+1)*32) /* 64:support 64GB; 64 * 1000: the number of files's infor;*/ + /************************************************************************** * D A T A T Y P E S * **************************************************************************/ @@ -123,8 +127,8 @@ SINT8 gApPasswd[MAX_PASSWORD_LEN]= {"abc.1234"}; pthread_mutex_t gAppSvrMutex; UINT32 gDevFileListNums = 0,gDevDirListNums = 0; -MSG_DEV_THUMB_LIST_Get_Data_Rsp_T gDevFileList[9999]; -MSG_DEV_THUMB_DIR_LIST_T gDevDirList[999]; +MSG_DEV_THUMB_LIST_Get_Data_Rsp_T gDevFileList[FILE_LIST_NUM_MAX]; +MSG_DEV_THUMB_DIR_LIST_T gDevDirList[MAX_DCF_DIR_NUM+1]; UINT16 CurrentWifiCmd = 0; @@ -547,10 +551,13 @@ void appsvr_getFileList(UINT8 *dirPath, UINT8 *startFileKey) // printf("[appsvr_getFileList]open \n",nFileNums,idx); //printf("[appsvr_getFileList]nFileNums:%d, idx:%d, %s %d\n",nFileNums,idx,fname,gDevFileListNums); // printf("[appsvr_getFileList]nFileNums:%d, %d\n",nFileNums,gDevFileListNums); - 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'; - //printf("%s\n", g3g75DevFileList[nFileNums - idx + gDevFileListNums].fileName); - nFileNums ++ ; + if(strstr((char *)ptr->d_name, SF_DCF_EXT_MOV) || strstr((char *)ptr->d_name, SF_DCF_EXT_PHOTO)) + { + 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'; + //printf("%s\n", g3g75DevFileList[nFileNums - idx + gDevFileListNums].fileName); + nFileNums ++ ; + } //printf("[appsvr_getFileList]%d,%s\n",nFileNums - idx, gDevFileList[nFileNums - idx].fileName); } #else @@ -611,6 +618,10 @@ void appsvr_getDirList(UINT8* dirPath, UINT8 *startDirKey) { continue; } + if(((nFileNums) > MAX_DCF_DIR_NUM)) + { + break; + } } gDevDirListNums = nFileNums; @@ -669,11 +680,11 @@ UINT8 appCmpFileList(void) void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG { - UINT16 i = 0; + //UINT16 i = 0; UINT8 dirPath[50] = {0}; UINT8 startDirKey[5] = {0}; UINT8 startFileKey[5] = {0}; - UINT8 temp[5] = {0}; + //UINT8 temp[5] = {0}; MLOGI("fileName:%s\n",fileName); @@ -684,10 +695,10 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG } else { - // startDirKey[0] = '\0'; - // startFileKey[0] = '\0'; - strncpy((char *)startDirKey, "100", 3); - strncpy((char *)startFileKey, "0001", 4); + startDirKey[0] = '\0'; + startFileKey[0] = '\0'; + //strncpy((char *)startDirKey, "100", 3); + //strncpy((char *)startFileKey, "0001", 4); } memset(gDevFileList, 0, sizeof(gDevFileList)); @@ -695,18 +706,20 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG //printf("get dir s\n"); sprintf((char *)dirPath, "%s/", THUMB_PATH); - + appsvr_getFileList(dirPath, startFileKey); // appsvr_getDirList(dirPath, startDirKey); // printf("get dir e\n"); // strcpy((char *)gDevDirList[0].dirName, dirPath); - + /* // while((gDevDirList[i].dirName[0] != '\0') && (i <= DCF_DIR_NUM_MAX)) { MLOGI("i=%d,dir:%s\n", i, gDevDirList[i].dirName); // printf("get file s\n"); sprintf((char *)dirPath, "%s/%s", THUMB_PATH, gDevDirList[i].dirName); + + if(strcmp((char *)gDevDirList[i].dirName, (char *)startDirKey) == 0) { appsvr_getFileList(dirPath, startFileKey); @@ -719,7 +732,7 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG i++; } - +*/ //appsvr_getFileList(dirPath, startDirKey); @@ -1603,6 +1616,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) if(puiPara->VideoSize != SysGetFlag(FL_MOVIE_SIZE)) { SysSetFlag(FL_MOVIE_SIZE, puiPara->VideoSize); + SysSetFlag(FL_MOVIE_SIZE_MENU, puiPara->VideoSize); } //forbuild appMediaAttrUpdate(puiPara.VideoSize); //sf_set_video_size(puiPara->VideoSize); @@ -1811,7 +1825,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) // msgParse.msgBuf.rctrlFileTransferInfo.filePath[13]=0; msgParse.msgBuf.rctrlFileTransferInfo.type = (tempbuf[0] == 'W' ? 0 : (tempbuf[0] == 'S' ? 1 : 1)); } - // printf("Send File:%s,function:%d,len:%d\n",msgParse.msgBuf.rctrlFileTransferInfo.fileName,function,strlen((char *)msgParse.msgBuf.rctrlFileTransferInfo.fileName)); + //printf("Send File:%s,function:%d,len:%d\n",msgParse.msgBuf.rctrlFileTransferInfo.fileName,function,strlen((char *)msgParse.msgBuf.rctrlFileTransferInfo.fileName)); if(function == 2)//download { fileFd = open((char *)fileName, O_RDONLY); @@ -1842,6 +1856,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) } else if(function == 1)//upload { + sf_sleep_ms(1000); fSize = ntohl(pMsgStruct->msgBuf.ctrlFileTransfer.fileSize); ret = sf_DataMapSet(keyMap, function, fileName, fSize); } @@ -2420,7 +2435,7 @@ void *sf_server_accept_thread(void *pData) } else if ( ret == 0 ) { - usleep(1*1000); /* ms */ + usleep(200*1000); /* ms */ } else {