1.wifi优化
This commit is contained in:
parent
9ea64c9a1d
commit
a103cf9c09
11
code/application/source/sf_app/code/source/wifi/sf_data_transfer.c
Normal file → Executable file
11
code/application/source/sf_app/code/source/wifi/sf_data_transfer.c
Normal file → Executable file
|
@ -320,11 +320,14 @@ U8 sf_DataMapSet(U32 key, U8 function, S8 *fileName, U32 FileSize)
|
||||||
|
|
||||||
MLOGI(" key:%d,fileName:%s\n",key,fileName);
|
MLOGI(" key:%d,fileName:%s\n",key,fileName);
|
||||||
|
|
||||||
if(fileName == NULL)
|
if(fileName == NULL){
|
||||||
|
MLOGE("CMD_ERR error!\n");
|
||||||
return CMD_ERR;
|
return CMD_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
if(pClient == NULL)
|
if(pClient == NULL)
|
||||||
{
|
{
|
||||||
|
MLOGE("pClient == NULL error!\n");
|
||||||
return DATA_CMD_8855_NO_CONNECT;
|
return DATA_CMD_8855_NO_CONNECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,9 +355,10 @@ U8 sf_DataMapSet(U32 key, U8 function, S8 *fileName, U32 FileSize)
|
||||||
if(function)
|
if(function)
|
||||||
{
|
{
|
||||||
memcpy((char *)&pClient->map.fileName[0], (char *)fileName,strlen((char *)fileName));
|
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.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);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -459,7 +463,7 @@ void *sf_DataSvrTransferThread(void *addr)
|
||||||
|
|
||||||
if(pClient->map.function != 3)
|
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));
|
//printf("socket=%d,key=%d,C_port=%d\n",pClient->socket,pClient->map.key,ntohs(pClient->ClientAddr.sin_port));
|
||||||
}
|
}
|
||||||
//pClient->map.fileName[47]=0;
|
//pClient->map.fileName[47]=0;
|
||||||
|
@ -467,6 +471,7 @@ void *sf_DataSvrTransferThread(void *addr)
|
||||||
//send(pClient->socket, tmpbuf, 100);
|
//send(pClient->socket, tmpbuf, 100);
|
||||||
if(pClient->map.function == 0 || poweroff_mode) //stop
|
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);
|
sf_DataMapClear(pClient);
|
||||||
if(poweroff_mode)
|
if(poweroff_mode)
|
||||||
{
|
{
|
||||||
|
|
49
code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c
Normal file → Executable file
49
code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c
Normal file → Executable file
|
@ -25,6 +25,7 @@
|
||||||
//#include "sf_syslib.h"
|
//#include "sf_syslib.h"
|
||||||
//#include "sf_para.h"
|
//#include "sf_para.h"
|
||||||
|
|
||||||
|
#include "sf_param_common.h"
|
||||||
#include "sf_wifi_svr.h"
|
#include "sf_wifi_svr.h"
|
||||||
#include "sf_data_transfer.h"
|
#include "sf_data_transfer.h"
|
||||||
#include "sf_svr_send.h"
|
#include "sf_svr_send.h"
|
||||||
|
@ -55,6 +56,7 @@
|
||||||
#include "Mode/UIModePhoto.h"
|
#include "Mode/UIModePhoto.h"
|
||||||
#include "Mode/UIModeMovie.h"
|
#include "Mode/UIModeMovie.h"
|
||||||
#include "sf_log.h"
|
#include "sf_log.h"
|
||||||
|
#include "DCF.h"
|
||||||
#if SF_LPA_SDK
|
#if SF_LPA_SDK
|
||||||
#include "lpasdk/api/lpasdk_api.h"
|
#include "lpasdk/api/lpasdk_api.h"
|
||||||
#include "sf_4g_lpa.h"
|
#include "sf_4g_lpa.h"
|
||||||
|
@ -85,6 +87,8 @@
|
||||||
#define SF_WIFI_NETDEV_NAME "ap0"
|
#define SF_WIFI_NETDEV_NAME "ap0"
|
||||||
#define SF_WIFI_NETDEV_8189_NAME "wlan0"
|
#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 *
|
* D A T A T Y P E S *
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
@ -123,8 +127,8 @@ SINT8 gApPasswd[MAX_PASSWORD_LEN]= {"abc.1234"};
|
||||||
|
|
||||||
pthread_mutex_t gAppSvrMutex;
|
pthread_mutex_t gAppSvrMutex;
|
||||||
UINT32 gDevFileListNums = 0,gDevDirListNums = 0;
|
UINT32 gDevFileListNums = 0,gDevDirListNums = 0;
|
||||||
MSG_DEV_THUMB_LIST_Get_Data_Rsp_T gDevFileList[9999];
|
MSG_DEV_THUMB_LIST_Get_Data_Rsp_T gDevFileList[FILE_LIST_NUM_MAX];
|
||||||
MSG_DEV_THUMB_DIR_LIST_T gDevDirList[999];
|
MSG_DEV_THUMB_DIR_LIST_T gDevDirList[MAX_DCF_DIR_NUM+1];
|
||||||
|
|
||||||
UINT16 CurrentWifiCmd = 0;
|
UINT16 CurrentWifiCmd = 0;
|
||||||
|
|
||||||
|
@ -547,10 +551,13 @@ void appsvr_getFileList(UINT8 *dirPath, UINT8 *startFileKey)
|
||||||
// printf("[appsvr_getFileList]open \n",nFileNums,idx);
|
// 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, idx:%d, %s %d\n",nFileNums,idx,fname,gDevFileListNums);
|
||||||
// printf("[appsvr_getFileList]nFileNums:%d, %d\n",nFileNums,gDevFileListNums);
|
// printf("[appsvr_getFileList]nFileNums:%d, %d\n",nFileNums,gDevFileListNums);
|
||||||
strcpy((char *)gDevFileList[nFileNums + gDevFileListNums].fileNameString, (char *)ptr->d_name);
|
if(strstr((char *)ptr->d_name, SF_DCF_EXT_MOV) || strstr((char *)ptr->d_name, SF_DCF_EXT_PHOTO))
|
||||||
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);
|
strcpy((char *)gDevFileList[nFileNums + gDevFileListNums].fileNameString, (char *)ptr->d_name);
|
||||||
nFileNums ++ ;
|
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);
|
//printf("[appsvr_getFileList]%d,%s\n",nFileNums - idx, gDevFileList[nFileNums - idx].fileName);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -611,6 +618,10 @@ void appsvr_getDirList(UINT8* dirPath, UINT8 *startDirKey)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(((nFileNums) > MAX_DCF_DIR_NUM))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gDevDirListNums = nFileNums;
|
gDevDirListNums = nFileNums;
|
||||||
|
@ -669,11 +680,11 @@ UINT8 appCmpFileList(void)
|
||||||
|
|
||||||
void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG
|
void appCreatThumbList(S8 *fileName)//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};
|
||||||
UINT8 temp[5] = {0};
|
//UINT8 temp[5] = {0};
|
||||||
|
|
||||||
MLOGI("fileName:%s\n",fileName);
|
MLOGI("fileName:%s\n",fileName);
|
||||||
|
|
||||||
|
@ -684,10 +695,10 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// startDirKey[0] = '\0';
|
startDirKey[0] = '\0';
|
||||||
// startFileKey[0] = '\0';
|
startFileKey[0] = '\0';
|
||||||
strncpy((char *)startDirKey, "100", 3);
|
//strncpy((char *)startDirKey, "100", 3);
|
||||||
strncpy((char *)startFileKey, "0001", 4);
|
//strncpy((char *)startFileKey, "0001", 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(gDevFileList, 0, sizeof(gDevFileList));
|
memset(gDevFileList, 0, sizeof(gDevFileList));
|
||||||
|
@ -695,18 +706,20 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG
|
||||||
//printf("get dir s\n");
|
//printf("get dir s\n");
|
||||||
sprintf((char *)dirPath, "%s/", THUMB_PATH);
|
sprintf((char *)dirPath, "%s/", THUMB_PATH);
|
||||||
|
|
||||||
|
appsvr_getFileList(dirPath, startFileKey);
|
||||||
// appsvr_getDirList(dirPath, startDirKey);
|
// appsvr_getDirList(dirPath, startDirKey);
|
||||||
|
|
||||||
// printf("get dir e\n");
|
// printf("get dir e\n");
|
||||||
// strcpy((char *)gDevDirList[0].dirName, dirPath);
|
// strcpy((char *)gDevDirList[0].dirName, dirPath);
|
||||||
|
/*
|
||||||
// while((gDevDirList[i].dirName[0] != '\0') && (i <= DCF_DIR_NUM_MAX))
|
// while((gDevDirList[i].dirName[0] != '\0') && (i <= DCF_DIR_NUM_MAX))
|
||||||
{
|
{
|
||||||
MLOGI("i=%d,dir:%s\n", i, gDevDirList[i].dirName);
|
MLOGI("i=%d,dir:%s\n", i, gDevDirList[i].dirName);
|
||||||
// printf("get file s\n");
|
// printf("get file s\n");
|
||||||
sprintf((char *)dirPath, "%s/%s", THUMB_PATH, gDevDirList[i].dirName);
|
sprintf((char *)dirPath, "%s/%s", THUMB_PATH, gDevDirList[i].dirName);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(strcmp((char *)gDevDirList[i].dirName, (char *)startDirKey) == 0)
|
if(strcmp((char *)gDevDirList[i].dirName, (char *)startDirKey) == 0)
|
||||||
{
|
{
|
||||||
appsvr_getFileList(dirPath, startFileKey);
|
appsvr_getFileList(dirPath, startFileKey);
|
||||||
|
@ -719,7 +732,7 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//appsvr_getFileList(dirPath, startDirKey);
|
//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))
|
if(puiPara->VideoSize != SysGetFlag(FL_MOVIE_SIZE))
|
||||||
{
|
{
|
||||||
SysSetFlag(FL_MOVIE_SIZE, puiPara->VideoSize);
|
SysSetFlag(FL_MOVIE_SIZE, puiPara->VideoSize);
|
||||||
|
SysSetFlag(FL_MOVIE_SIZE_MENU, puiPara->VideoSize);
|
||||||
}
|
}
|
||||||
//forbuild appMediaAttrUpdate(puiPara.VideoSize);
|
//forbuild appMediaAttrUpdate(puiPara.VideoSize);
|
||||||
//sf_set_video_size(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.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));
|
||||||
}
|
}
|
||||||
// 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
|
if(function == 2)//download
|
||||||
{
|
{
|
||||||
fileFd = open((char *)fileName, O_RDONLY);
|
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
|
else if(function == 1)//upload
|
||||||
{
|
{
|
||||||
|
sf_sleep_ms(1000);
|
||||||
fSize = ntohl(pMsgStruct->msgBuf.ctrlFileTransfer.fileSize);
|
fSize = ntohl(pMsgStruct->msgBuf.ctrlFileTransfer.fileSize);
|
||||||
ret = sf_DataMapSet(keyMap, function, fileName, fSize);
|
ret = sf_DataMapSet(keyMap, function, fileName, fSize);
|
||||||
}
|
}
|
||||||
|
@ -2420,7 +2435,7 @@ void *sf_server_accept_thread(void *pData)
|
||||||
}
|
}
|
||||||
else if ( ret == 0 )
|
else if ( ret == 0 )
|
||||||
{
|
{
|
||||||
usleep(1*1000); /* ms */
|
usleep(200*1000); /* ms */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user