From d973040350628bd79efadbb94ee825127cdbe7c0 Mon Sep 17 00:00:00 2001 From: payton Date: Thu, 16 Nov 2023 17:40:52 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8DWiFi=E5=92=8C=E8=93=9D?= =?UTF-8?q?=E7=89=99=E8=AE=BE=E7=BD=AEcam=20id=202.=E4=BF=AE=E5=A4=8DWiFi?= =?UTF-8?q?=E4=B8=8B=E5=9B=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sf_app/code/include/sf_param_enum.h | 2 - .../source/sf_app/code/source/4gMng/sf_ftp.c | 2 +- .../sf_app/code/source/fileMng/sf_file.c | 2 +- .../code/source/sf_blue/src/sf_blue_app.c | 4 +- .../sf_app/code/source/wifi/sf_wifi_svr.c | 55 ++++++++++--------- 5 files changed, 34 insertions(+), 31 deletions(-) diff --git a/code/application/source/sf_app/code/include/sf_param_enum.h b/code/application/source/sf_app/code/include/sf_param_enum.h index f8a9dfae8..0caf16245 100755 --- a/code/application/source/sf_app/code/include/sf_param_enum.h +++ b/code/application/source/sf_app/code/include/sf_param_enum.h @@ -187,8 +187,6 @@ extern "C" { #define SF_THUMB_SMALL_DIR SF_SD_DISK"THUMB/small" #define SF_THUMB_BIG_DIR SF_SD_DISK"THUMB/big" #define SF_THUMB_VIDEO_DIR SF_SD_DISK"THUMB/video" -#define DCF_DIR_FREE_CHAR "MEDIA" -#define DCF_FILE_FREE_CHAR "SYFW" #define SF_TRUE 1 #define SF_FALSE 0 diff --git a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c index 961e87bc8..d73de5bd8 100755 --- a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c @@ -1061,7 +1061,7 @@ SINT32 sf_video_send_ftp(void) sprintf((char *)ftpFileName, "%s%s", cameraID, videoFname); sprintf((char *)filePath, "UFS:/%s", videoFname); - sprintf((char *)videoDir, "%s\\%s%s\\%s", SF_DCIM_DIR, videoDirKey, DCF_DIR_FREE_CHAR, videoFname); + sprintf((char *)videoDir, "%s\\%s%s\\%s", SF_DCIM_DIR, videoDirKey, DCF_DIR_NAME, videoFname); */ fileIndex = sf_check_file_video(); diff --git a/code/application/source/sf_app/code/source/fileMng/sf_file.c b/code/application/source/sf_app/code/source/fileMng/sf_file.c index 2a9e12248..a8e1151fc 100755 --- a/code/application/source/sf_app/code/source/fileMng/sf_file.c +++ b/code/application/source/sf_app/code/source/fileMng/sf_file.c @@ -694,7 +694,7 @@ SINT32 sf_upload_send_files_to_module(UINT8 mode) { SendPicSize = tempPicSize; /*sf_get_send_video_fname(videoDirKey, videoFname); - sprintf((char *)uploadAbsolutePath[0], "%s\\%s%s\\%s", SF_DCIM_DIR, videoDirKey, DCF_DIR_FREE_CHAR, videoFname); + sprintf((char *)uploadAbsolutePath[0], "%s\\%s%s\\%s", SF_DCIM_DIR, videoDirKey, DCF_DIR_NAME, videoFname); sprintf((char *)uploadFname[0], "%s", videoFname);*/ fileIndex = sf_check_file_video(); diff --git a/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_app.c b/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_app.c index 05a3ad830..64a3f06c3 100644 --- a/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_app.c +++ b/code/application/source/sf_app/code/source/sf_blue/src/sf_blue_app.c @@ -271,7 +271,7 @@ static void sf_blue_command_get_camera_para(MSG_DEV_BLE_Param_Get_Rsp_T *CamPara CamPara->batType = puiPara->BatteryType; - CamPara->cameraID = puiPara->CamNameSwitch == SF_CAMID_OFF ? 0:1; + CamPara->cameraID = puiPara->CamNameSwitch == SF_CAMID_OFF ? 1:0; strcpy((char *)CamPara->cameraIDstr, (char *)puiPara->CamNameStr); CamPara->dateTimeAuto = puiPara->DateAuto; @@ -791,7 +791,7 @@ static signed int sf_blue_command_request_process(U8 *val, unsigned int nval, U8 case BLE_SET_CAMERA_CameraID: //O { BLU_SLOGI("[BLE_SET_CAMERA_CameraID],cameraID:%d\n",pMsgStruct->msgBuf.setCameraID.cameraID); - puiPara->CamNameSwitch = pMsgStruct->msgBuf.setCameraID.cameraID == 0 ? SF_CAMID_OFF : SF_CAMID_ON; + puiPara->CamNameSwitch = pMsgStruct->msgBuf.setCameraID.cameraID == 1 ? SF_CAMID_OFF : SF_CAMID_ON; strncpy(puiPara->CamNameStr, (char *)pMsgStruct->msgBuf.setCameraID.cameraIDstr, 4); //Use SF_STRNCPY to avoid that APP has not send '\0'. sf_camera_name_check(puiPara->CamNameStr); puiPara->CamNameStr[4] = '\0'; 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 index cc9392098..fa83af112 100755 --- 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 @@ -561,7 +561,7 @@ void appsvr_getFileList(UINT8 *dirPath, UINT8 *startFileKey) 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 ++ ; - //MLOGI("fileNameString:%s.\n", gDevFileList[nFileNums + gDevFileListNums].fileNameString); + // MLOGI("fileNameString:%s. srcFileType:%d\n", gDevFileList[nFileNums + gDevFileListNums].fileNameString, gDevFileList[nFileNums + gDevFileListNums].srcFileType); } //printf("[appsvr_getFileList]%d,%s\n",nFileNums - idx, gDevFileList[nFileNums - idx].fileName); } @@ -659,7 +659,7 @@ UINT8 appCmpFileList(void) //appThumbNameToKey(&fileType, &dirKey, &fileKey, gDevFileList[i].fileNameString);ERROR:dirKey always zero //printf("dirkey=%d\n",dirKey); sprintf(fileName,"D:/DCIM/%.3s%s/%s%.4s%s", - gDevFileList[i].fileNameString,DCF_DIR_FREE_CHAR,DCF_FILE_FREE_CHAR,gDevFileList[i].fileNameString+4, + gDevFileList[i].fileNameString,DCF_DIR_NAME,DCF_FILE_NAME,gDevFileList[i].fileNameString+4, (gDevFileList[i].fileNameString[3] == '0' ? ".JPG" : (gDevFileList[i].fileNameString[3] == '1' ? ".MP4" : ".MP4"))); //profLogPrintf(0,"file:%s", fileName); //printf("str:%s,name:%s,\n",gDevFileList[i].fileNameString,fileName); @@ -702,10 +702,10 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG else { MLOGI("fileName3:%s\n",fileName); - //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); } //MLOGI("startDirKey:%s startFileKey:%s sizeof:%d\n",startDirKey,startFileKey, FILE_LIST_NUM_MAX*(sizeof(MSG_DEV_THUMB_LIST_Get_Data_Rsp_T))); //memset(gDevFileList, 0, FILE_LIST_NUM_MAX*(sizeof(MSG_DEV_THUMB_LIST_Get_Data_Rsp_T))); @@ -975,7 +975,7 @@ void sf_app_Get_Camera_Para(MSG_DEV_Param_Get_Rsp_T *CamPara) CamPara->batType = puiPara->BatteryType; - CamPara->cameraID = puiPara->CamNameSwitch == SF_CAMID_OFF ? 0:1; + CamPara->cameraID = puiPara->CamNameSwitch == SF_CAMID_OFF ? 1:0; strcpy((char *)CamPara->cameraIDstr, (char *)puiPara->CamNameStr); CamPara->dateTimeAuto = puiPara->DateAuto; @@ -1261,8 +1261,8 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) // printf("nRet = %d\n", nRet); } - for(i =0 ; i<16; i++) - printf("%s\n",gDevFileList[i].fileNameString); + for(i =0 ; i<(SINT32)gDevFileListNums; i++) + printf("%s %d\n",gDevFileList[i].fileNameString, gDevFileList[i].srcFileType); memdump(gDevFileList, sendSize); @@ -1284,17 +1284,18 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) { strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.getHdFile.dirName); strncpy((char *)tempbuf2, (char *)pMsgStruct->msgBuf.getHdFile.dirName, 3); - sprintf((char *)gFileName, "%s/%s/%s", THUMB_PATH, tempbuf2, tempbuf); + sprintf((char *)gFileName, "%s%s/%s", THUMB_PATH, tempbuf2, tempbuf); } else if(pMsgStruct->msgBuf.getHdFile.type == 1) //srouce file { strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.getHdFile.dirName); strncpy((char *)tempbuf2, (char *)tempbuf, 3); tempbuf[8] = '\0'; - sprintf((char *)gFileName, "D:/DCIM/%s%s/%s%s%s", + sprintf((char *)gFileName, "%sDCIM/%s%s/%s%s%s", + SF_SD_ROOT, tempbuf2, - DCF_DIR_FREE_CHAR, - DCF_FILE_FREE_CHAR, + DCF_DIR_NAME, + DCF_FILE_NAME, tempbuf+4, (tempbuf[3] == '0' ? ".JPG" : (tempbuf[3] == '1' ? ".MP4" : ".MP4"))); } @@ -1685,7 +1686,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) case WIFI_SET_CAMERA_CameraID: //O MLOGI("[WIFI_SET_CAMERA_CameraID],cameraID:%d\n",pMsgStruct->msgBuf.setCameraID.cameraID); - puiPara->CamNameSwitch = pMsgStruct->msgBuf.setCameraID.cameraID == 0 ? SF_CAMID_OFF : SF_CAMID_ON; + puiPara->CamNameSwitch = pMsgStruct->msgBuf.setCameraID.cameraID == 1 ? SF_CAMID_OFF : SF_CAMID_ON; strncpy(puiPara->CamNameStr, (char *)pMsgStruct->msgBuf.setCameraID.cameraIDstr, 4); //Use SF_STRNCPY to avoid that APP has not send '\0'. sf_camera_name_check(puiPara->CamNameStr); puiPara->CamNameStr[4] = '\0'; @@ -1809,10 +1810,12 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_CONTROL_CAMERA_FileTransfer: - + //printf("WIFI_CONTROL_CAMERA_FileTransfer\n"); keyMap = ntohl(pMsgStruct->msgBuf.ctrlFileTransfer.PORT); function = pMsgStruct->msgBuf.ctrlFileTransfer.function; - MLOGI("[WIFI_CONTROL_CAMERA_FileTransfer], keyMap=%d, function=%d,type:%d\n",keyMap,function,pMsgStruct->msgBuf.ctrlFileTransfer.type); + + MLOGI("[WIFI_CONTROL_CAMERA_FileTransfer], keyMap=%d, function=%d,type:%d \n",keyMap,function,pMsgStruct->msgBuf.ctrlFileTransfer.type); + if(function) { if(pMsgStruct->msgBuf.ctrlFileTransfer.type == 0) //thumbnail @@ -1820,7 +1823,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) //strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName); memcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName,strlen((char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName)); - sprintf((char *)fileName, "%s/%s", THUMB_PATH, tempbuf); + sprintf((char *)fileName, "%s%s", THUMB_PATH, tempbuf); } else if(pMsgStruct->msgBuf.ctrlFileTransfer.type == 1) //srouce file @@ -1829,11 +1832,11 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) strncpy((char *)tempbuf2, (char *)pMsgStruct->msgBuf.ctrlFileTransfer.fileName +1, 3); tempbuf[8] = '\0'; - sprintf((char *)fileName, "%s/DCIM/%s%s/%s%s%s", + sprintf((char *)fileName, "%sDCIM/%s%s/%s%s%s", SD_PATH, tempbuf2, - DCF_DIR_FREE_CHAR, - DCF_FILE_FREE_CHAR, + DCF_DIR_NAME, + DCF_FILE_NAME, tempbuf+4, (tempbuf[0] == 'W' ? ".JPG" : (tempbuf[0] == 'S' ? ".MP4" : ".MP4"))); } @@ -1841,7 +1844,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) { sprintf((char *)fileName, "%s%s",SF_SD_ROOT,pMsgStruct->msgBuf.ctrlFileTransfer.fileName); } - // printf("rec file cmd:%s\n", fileName); + //MLOGI("rec file cmd:%s\n", fileName); } else { @@ -1865,11 +1868,12 @@ 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)); fileFd = open((char *)fileName, O_RDONLY); + //printf("fileFd = %d rctrlFileTransferInfo.type:%d\n", fileFd,msgParse.msgBuf.rctrlFileTransferInfo.type); if(fileFd > 0) { fSize = sp5kFsFileSizeGet((char *)fileName); msgParse.msgBuf.rctrlFileTransferInfo.fileSize = htonl(fSize); - // printf("fileSize = %d\n", fSize); + //printf("fileSize = %d\n", fSize); stat( fileName, &fstat); mtime = localtime((time_t *)&fstat.st_mtime); @@ -1935,9 +1939,9 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) 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_FREE_CHAR, fileKey); + sprintf((char *)fileName,"./%3dMEDIA/%s%04d.JPG", dirKey, DCF_FILE_NAME, fileKey); else - sprintf((char *)fileName,"./%3dMEDIA/%s%04d.MP4", dirKey, DCF_FILE_FREE_CHAR, fileKey); + sprintf((char *)fileName,"./%3dMEDIA/%s%04d.MP4", dirKey, DCF_FILE_NAME, fileKey); ret = remove((char *)fileName); } @@ -2097,11 +2101,12 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) #endif default: + WIFI_SLOGI("[WIFI_CMD_MAX] default\n"); msgParse.msgBuf.camreaSetRsp.cmdRet = -1; msgParse.msgBuf.camreaSetRsp.suffix = htons(MSG_END_FIX); /* add the cmd + resp total 2*2 bytes */ msgParse.msglen = htons(sizeof(MSG_DEV_SET_Rsp_T) + 2*sizeof(UINT16) ); - respFlag = 1; + respFlag = 0; break; }