Merge branch 'Branch_S550_Fast_Emmc' of gitlab.sifar.tech:linux-em-group/s530-ntk into branch_s550_fast_emmc
This commit is contained in:
		
						commit
						2f9abe77b2
					
				|  | @ -932,12 +932,15 @@ | |||
| #define MOVIE_THUMB_PATH 				":\\THUMB\\" | ||||
| 
 | ||||
| #define SF_SD_ROOT 	 	 				"/mnt/sd/" | ||||
| #define SF_SEND_LIST_DIR 	 	 		"/mnt/sd/THUMB/" | ||||
| #define SF_EMMC_ROOT					"/mnt/sd2/" | ||||
| 
 | ||||
| #define SF_SEND_LIST_DIR 	 	 		"THUMB/" | ||||
| #define SF_THUMB_SEND_LIST             SF_SEND_LIST_DIR"send.list" | ||||
| #define SF_THUMB_SEND_AUTO             SF_SEND_LIST_DIR"auto.list" | ||||
| #define SF_HD_DIR_LIST                 SF_SEND_LIST_DIR"HD/send.list" | ||||
| #define SF_HD_DIR_LIST                 SF_SEND_LIST_DIR"HD/send.list"  //No use
 | ||||
| #define SF_HD_DIR                      SF_SEND_LIST_DIR"HD" | ||||
| #define SF_HD_DIR_CARDV 				"A:\\THUMB\\HD\\" | ||||
| #define SF_HD_DIR_CARDV 				"A:\\THUMB\\HD\\"			   //No use
 | ||||
| 
 | ||||
| 
 | ||||
| #define SF_FW_CFG_FILE_NAME            "SPHOST_REVEAL.CFG" | ||||
| #define SF_FW_FILE_NAME                "SPHOST_REVEAL.BRN" | ||||
|  | @ -968,9 +971,9 @@ | |||
| #define SF_BATTERY_TEST_FILE            "A:\\BATTERY.TXT" | ||||
| #define SF_HW_TEST						DISABLE | ||||
| #define SF_MODULE_UP_FILE             "EG915QNA.tar.bz2" | ||||
| #define SF_MODULE_UP_FILE_PATH        "/mnt/sd/EG915QNA.tar.bz2" | ||||
| #define SF_MODULE_UP_FILE_PATH        "EG915QNA.tar.bz2" | ||||
| #define SF_CAM_UP_FILE             "CAM_OTA_S550/SPHOST_REVEAL.BIN" | ||||
| #define SF_CAM_UP_FILE_PATH        "/mnt/sd/FW98565A.bin" | ||||
| #define SF_CAM_UP_FILE_PATH        "FW98565A.bin" | ||||
| #define SF_CAMERA_GPS_INFO_FILENAME        "/tmp/gps.txt" | ||||
| #define SF_UBOOT_UPDATA_FW              ENABLE | ||||
| 
 | ||||
|  |  | |||
|  | @ -19,6 +19,11 @@ | |||
| #include <sf_param_struct.h> | ||||
| #include <FileSysTsk.h> | ||||
| #include "sf_mcu.h" | ||||
| 
 | ||||
| #if HUNTING_CAMERA_MCU == ENABLE | ||||
| #include <sf_message_queue.h> | ||||
| #endif | ||||
| 
 | ||||
| typedef struct | ||||
| { | ||||
| 	int event; | ||||
|  | @ -33,7 +38,6 @@ SF_THREAD_S MMCMonitorTskCfg = | |||
|     .TskId = -1, | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| #define MIN_DISK_FREE_SIZE_MB 30 | ||||
| 
 | ||||
| 
 | ||||
|  | @ -66,6 +70,8 @@ void SF_StrgInit(void) { | |||
|         sf_mmc_dev[i]->space_state = MMC_DEV_SPACE_STATE_ENOUGH; | ||||
|         sf_mmc_dev[i]->loop_state = MMC_DEV_LOOP_STATE_OFF; | ||||
|     } | ||||
| 
 | ||||
| 	pMMCDev = (SF_ST_MMC_DEV *)malloc(sizeof(SF_ST_MMC_DEV)); | ||||
| } | ||||
| 
 | ||||
| void SF_StrgUnInit(void) | ||||
|  | @ -338,13 +344,37 @@ SF_ST_MMC_DEV *SF_StrgCheckWorkableDev(void) | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| #if 1 | ||||
| static int sfStrgOnActionSendCurrentDev(SF_ST_MMC_DEV *pMMCDev) | ||||
| { | ||||
| 	SF_MESSAGE_BUF_S stMessageBuf = {0}; | ||||
| 	stMessageBuf.arg1 = SF_SYS_STRG_DEV_MSG; | ||||
| 	stMessageBuf.arg2 = pMMCDev->dev_type; | ||||
| 	stMessageBuf.arg3 = pMMCDev->moumted_state; | ||||
| 	stMessageBuf.cmdId = CMD_SD; | ||||
| 	sf_com_message_send_to_app(&stMessageBuf); | ||||
| 	MLOGD("sf sys strg update current dev!\n"); | ||||
| 	return 0; | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| static void* mmc_monitoring_thread(void *arg) | ||||
| { | ||||
| 	static MMC_DEV_TYPE current_id = MMC_DEV_NO; | ||||
| 	while(MMCMonitorTskCfg.IsRun) | ||||
| 	{ | ||||
| 		pMMCDev = SF_StrgCheckWorkableDev(); | ||||
| 
 | ||||
| 		sf_sleep_ms(1000); | ||||
| 		if(pMMCDev != NULL)	{		 | ||||
| 			if(current_id != pMMCDev->dev_type) | ||||
| 			{ | ||||
| 				current_id = pMMCDev->dev_type; | ||||
| 				MLOGD("mmc monitor dev has changed!, %d\n", pMMCDev->dev_type); | ||||
| 				sfStrgOnActionSendCurrentDev(pMMCDev); | ||||
| 			} | ||||
| 		} | ||||
| 			 | ||||
| 		sf_sleep_ms(5000); | ||||
| 	} | ||||
| 	return NULL; | ||||
| } | ||||
|  |  | |||
|  | @ -34,6 +34,9 @@ | |||
| 
 | ||||
| #define USE_MMC_DEV_CHECK	(1) | ||||
| 
 | ||||
| #define SF_SYS_STRG_DEV_MSG (7) | ||||
| 
 | ||||
| 
 | ||||
| typedef enum | ||||
| { | ||||
| 	MMC_DEV_SD = 0, | ||||
|  |  | |||
|  | @ -364,12 +364,12 @@ static void LV_MenuCommonOption_UpdateContent(TM_MENU *pMenu) | |||
| 			printf("[LV_MenuCommonOption_UpdateContent]s_SelOption: %d\n", s_SelOption); | ||||
| 			if (IDM_FORMAT_SD == pItem->ItemId) { | ||||
| 				if (0 == SelOption && i == 0) { | ||||
| 					itemIconId = LV_PLUGIN_IMG_ID_SF_LIST_SELECTED;//√
 | ||||
| 					lv_obj_set_pos(image_option1_scr_uiflowmenucommonoption, 272, 0); | ||||
| 					itemIconId = LV_PLUGIN_IMG_ID_SF_NEXT2;//>
 | ||||
| 					lv_obj_set_pos(image_option1_scr_uiflowmenucommonoption, 288, 0); | ||||
| 					ui_hidden = false; | ||||
| 				} else if (1 == SelOption && i == 1) { | ||||
| 					itemIconId = LV_PLUGIN_IMG_ID_SF_LIST_SELECTED;//√
 | ||||
| 					lv_obj_set_pos(image_option2_scr_uiflowmenucommonoption, 272, 0); | ||||
| 					itemIconId = LV_PLUGIN_IMG_ID_SF_NEXT2;//>
 | ||||
| 					lv_obj_set_pos(image_option2_scr_uiflowmenucommonoption, 288, 0); | ||||
| 					ui_hidden = false; | ||||
| 				} else if (0 == SelOption && i == 1) { | ||||
| 					itemIconId = LV_PLUGIN_IMG_ID_SF_NEXT1;//>
 | ||||
|  |  | |||
|  | @ -2380,6 +2380,10 @@ static void UIFlowPlay_Key(lv_obj_t* obj, uint32_t key) | |||
|     case LV_USER_KEY_UP: | ||||
|     case LV_USER_KEY_PREV: | ||||
|     { | ||||
|         printf("[UIFlowPlay_Key]exit play handle change: %d. \n", FirstHandle); | ||||
|         ChangeHandle = FirstHandle; | ||||
|         FirstHandle = -1; | ||||
|          | ||||
|         UIFlowPlay_Exit(obj); | ||||
|         break; | ||||
|     UINT32 uiFileSeq; | ||||
|  |  | |||
|  | @ -1748,6 +1748,7 @@ void SysResetFlag(void) | |||
|     /////////////
 | ||||
| 	puiPara->StampSwitch = DEFAULT_DATE_STAMP;//DEFAULT_STAMP_SWITCH;
 | ||||
| 	puiPara->BatteryType = DEFAULT_BATTERY_TYPE; | ||||
| 	puiPara->LiBatteryType = DEFAULT_BATTERY_TYPE; | ||||
| 	puiPara->SdLoopSwitch = DEFAULT_SD_LOOP_SWITCH; | ||||
| 	puiPara->PwdSwitch = DEFAULT_PWD_SWITCH; | ||||
| 	puiPara->SendPhotoSwitch = DEFAULT_SEND_PHOTO_SWITCH; | ||||
|  |  | |||
|  | @ -580,6 +580,7 @@ typedef struct _UIMenuUIMenuStoreInfo { | |||
| 	CHAR SimIccidV[21]; | ||||
| 	CHAR SimIccidA[21]; | ||||
|     UINT32 SdFailCount; | ||||
| 	CHAR LiBatteryType;/*Alkaline/NI-MH/LI*/ | ||||
| 	UINT32 x1; | ||||
| 	UINT32 x2; | ||||
| 	UINT32 x3; | ||||
|  |  | |||
|  | @ -274,6 +274,7 @@ SRC = \ | |||
| 	./code/source/app/sf_dbg.c \
 | ||||
|     ./code/source/gpio/sf_hal_gpio.c \
 | ||||
| 	./code/source/logMng/sf_log.c \
 | ||||
| 	./code/source/storeMng/sf_storeMng.c \
 | ||||
| 	./code/source/commMng/sf_message_queue.c \
 | ||||
| 	./code/source/commMng/sf_share_mem.c \
 | ||||
| 	./code/source/fileMng/cJSON.c \
 | ||||
|  | @ -297,7 +298,6 @@ SRC = \ | |||
| 	./code/source/qrcodeMng/sf_bmp.c \
 | ||||
| 	./code/source/qrcodeMng/sf_qrcode.c \
 | ||||
| 	./code/source/qrcodeMng/split.c \
 | ||||
| 	./code/source/storeMng/sf_storeMng.c \
 | ||||
| 	./code/source/ttyusb/sf_hal_ttyusb.c \
 | ||||
| 	./code/source/4gMng/sf_4g_lpa.c \
 | ||||
| 	./code/source/4gMng/sf_4G_sms_lpa_cmd.c \
 | ||||
|  |  | |||
|  | @ -57,8 +57,8 @@ | |||
| #define SF_LPA_DOWNLOAD_PROFILE_AC_FILENEME                  	"/tmp/download_ac.txt" | ||||
| #define SF_LPA_DOWNLOAD_ENABLE_PROFILE_AC_FILENEME               "/tmp/download_enable_ac.txt" | ||||
| #define SF_LPA_PROFILE_INFO_FILENEME                  			 "/tmp/profile_info.txt" | ||||
| #define SF_LPA_PROFILE_INFO_BACKUP_FILENEME                  	 "/mnt/sd/profile_info.txt" | ||||
| #define SF_LPA_LOG_FILE_PATH         "/mnt/sd/"   | ||||
| #define SF_LPA_PROFILE_INFO_BACKUP_FILENEME                  	 "profile_info.txt" | ||||
| #define SF_LPA_LOG_FILE_PATH         "/mnt/sd/"       //No use
 | ||||
| 
 | ||||
| #endif | ||||
| typedef struct SF_SMS_LPA_CMD_S{ | ||||
|  |  | |||
|  | @ -138,16 +138,18 @@ extern "C" { | |||
| 
 | ||||
| #define DEFAULT_RTC_DEVICE 					"/dev/rtc0" | ||||
| 
 | ||||
| //#define SF_SD_ROOT 	 	 					"/mnt/sd/"
 | ||||
| 
 | ||||
| #define SIFAR_CUSTOMER_PARAM_PATH  			"/misc/sfSysParm.bin" | ||||
| #define SIFAR_STATISTICS_PARAM_PATH  		"/mnt/sd/THUMB/sfStatisticsParm.bin" | ||||
| #define SIFAR_STATISTICS_PARAM_PATH  		"THUMB/sfStatisticsParm.bin" | ||||
| //#define SF_SEND_LIST_DIR              		SF_SD_ROOT"THUMB"
 | ||||
| #define SF_DAILYREPORT_FILENAME        		SF_SD_ROOT"THUMB/d.txt" | ||||
| #define SF_ERROR_CODE                  		SF_SD_ROOT"THUMB/warning.txt" | ||||
| #define SF_DAILYREPORT_FILENAME        		"THUMB/d.txt" | ||||
| #define SF_ERROR_CODE                  		"THUMB/warning.txt" | ||||
| #define SF_DAILYREPORT_TXT          		"DailyReport.txt" | ||||
| #define SF_LOG_TXT          		"log.txt" | ||||
| #define SF_LOW_POWER_WARN_FILENAME     SF_SD_ROOT"/THUMB/btalarm.txt" | ||||
| #define SF_LOW_POWER_WARN_FILENAME     "/THUMB/btalarm.txt" | ||||
| 
 | ||||
| #define UPGRADE_FIRMWARE_NANE  (char*)"Mupgrade.bin" | ||||
| 
 | ||||
| 
 | ||||
| #define GPIO_DIR_OUT    1 | ||||
| #define GPIO_DIR_IN     0 | ||||
|  | @ -158,9 +160,9 @@ extern "C" { | |||
| #define SECRET_VER 		"aws4_request" | ||||
| #define AMZ 			"s3" | ||||
| 
 | ||||
| #define SF_4G_PIC_THUMB_PATH         			SF_SD_ROOT"DCIM/THUMB/" | ||||
| #define SF_4G_SMALL_VIDEO_STREAM_PATH 			SF_SD_ROOT"DCIM/SMALL/" | ||||
| #define SIM_AUTO_MATCH_FILE_PATH    			SF_SD_ROOT"SIM Auto Match.TXT" | ||||
| #define SF_4G_PIC_THUMB_PATH         			SF_SD_ROOT"DCIM/THUMB/"       //No use
 | ||||
| #define SF_4G_SMALL_VIDEO_STREAM_PATH 			"DCIM/SMALL/" | ||||
| #define SIM_AUTO_MATCH_FILE_PATH    			"SIM Auto Match.TXT" | ||||
| 
 | ||||
| #define SF_DCF_DIR_NAME_SUFFIX  DCF_FILE_NAME		/**< DCF Directory Name (it must be 5-characters) */ | ||||
| #define SF_DCF_ROOT_DIR_NAME    "DCIM"		/**< DCF Root Directory Name */ | ||||
|  | @ -181,12 +183,12 @@ extern "C" { | |||
| 
 | ||||
| #define GPRS_INFO_LINE_MAX      512 | ||||
| #define MAX_CALL_TIMES 100 | ||||
| #define SF_SD_DISK "/mnt/sd/" | ||||
| #define SF_DCIM_DIR                    SF_SD_ROOT"DCIM" | ||||
| #define SF_THUMB_DIR                   SF_SD_DISK"THUMB" | ||||
| #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 SF_SD_DISK 					   "/mnt/sd/"		//No use
 | ||||
| #define SF_DCIM_DIR                    "DCIM" | ||||
| #define SF_THUMB_DIR                   "THUMB" | ||||
| #define SF_THUMB_SMALL_DIR             SF_SD_DISK"THUMB/small"  //No use
 | ||||
| #define SF_THUMB_BIG_DIR               SF_SD_DISK"THUMB/big"	//No use
 | ||||
| #define SF_THUMB_VIDEO_DIR             SF_SD_DISK"THUMB/video"	//No use
 | ||||
| 
 | ||||
| #define SF_TRUE   	1 | ||||
| #define SF_FALSE  	0 | ||||
|  | @ -404,6 +406,7 @@ typedef enum sf_MESSAGE_CMD_SD_e | |||
|     CMD_SD_STRG_CB_UNMOUNT_FINISH  = 4,   ///< The type for calling after storage unmounted
 | ||||
|     CMD_SD_FULL                    = 5, | ||||
|     CMD_SD_FORMAT                  = 6, | ||||
|     CMD_SD_STRG_WORKABLE_DEV       = 7, | ||||
|     CMD_SD_SYSTEM_CB_CONFIG        = 0xFFFFFFFF, | ||||
| 
 | ||||
| }SF_MESSAGE_CMD_SD_E; | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ extern "C" { | |||
| #endif | ||||
| #include "sf_type.h" | ||||
| #include "sf_param_common.h" | ||||
| #define QLOG_PATH	SF_SD_ROOT"qlog/" | ||||
| #define QLOG_PATH	"qlog/" | ||||
| 
 | ||||
| #define SF_APP_ERROR_NO_SUPPOET         	            	SF_ERR_ID(SF_MOD_APP, ERROR_NO_SUPPORT) | ||||
| #define SF_APP_ERROR_REQUEST         	                	SF_ERR_ID(SF_MOD_APP, ERROR_REQUEST) | ||||
|  |  | |||
|  | @ -56,6 +56,40 @@ typedef struct sf_STORE_ATTR_S { | |||
| }SF_STORE_ATTR_S; | ||||
| 
 | ||||
| 
 | ||||
| typedef enum | ||||
| { | ||||
| 	MMC_DEV_SD = 0, | ||||
| 	MMC_DEV_EMMC = 1, | ||||
| 	MMC_DEV_NO = 2, | ||||
| }MMC_DEV_TYPE; | ||||
| 
 | ||||
| typedef enum | ||||
| { | ||||
| 	MMC_DEV_NODE_STATE_NO = 0, | ||||
| 	MMC_DEV_NODE_STATE_EXIST = 1, | ||||
| 	MMC_DEV_NODE_STATE_NO_EXIST = 2, | ||||
| }MMC_DEV_NODE_STATE; | ||||
| 
 | ||||
| typedef enum | ||||
| { | ||||
| 	MMC_DEV_MOUNT_STATE_NO = 0, | ||||
| 	MMC_DEV_MOUNT_STATE_MOUNTED = 1, | ||||
| 	MMC_DEV_MOUNT_STATE_UNMOUNTED = 2, | ||||
| }MMC_DEV_MOUNT_STATE; | ||||
| 
 | ||||
| typedef struct | ||||
| { | ||||
| 	MMC_DEV_TYPE dev_type; | ||||
| 	MMC_DEV_MOUNT_STATE moumted_state; | ||||
| }SF_STRG_DEV; | ||||
| 
 | ||||
| 
 | ||||
| void sf_strg_dev_init(void); | ||||
| void sf_strg_dev_uninit(void); | ||||
| void sf_strg_dev_register(SINT32 dev_id, SINT32 mounted); | ||||
| MMC_DEV_TYPE sf_get_strg_dev(void); | ||||
| char *sf_root_path_strcat(char *path_name); | ||||
| char *sf_get_root_path(void); | ||||
| 
 | ||||
| SINT32 sf_sd_info_get(SF_STORE_ATTR_S *pstoreattrs); | ||||
| 
 | ||||
|  |  | |||
|  | @ -47,10 +47,10 @@ | |||
| #define DEV_UPLOADFILE_END     0x1008 | ||||
| #define DEV_UPLOADFILE_END_RSP 0x1009 | ||||
| 
 | ||||
| #define SF_DCF_SD_ROOT	"/mnt/sd/"		/**< DCF File Name (it must be 4-characters) */ | ||||
| #define SD_PATH     SF_DCF_SD_ROOT //"/sdcard/mmcblk0p1" //mnt/hgfs
 | ||||
| #define SF_DCF_SD_ROOT	"/mnt/sd/"		/**< DCF File Name (it must be 4-characters) */  //No use
 | ||||
| #define SD_PATH     SF_DCF_SD_ROOT //"/sdcard/mmcblk0p1" //mnt/hgfs  //No use
 | ||||
| #define THUMB_PATH  SF_SEND_LIST_DIR | ||||
| #define THUMB_HD_PATH  SD_PATH "/DCIM/THUMB/LARGE" | ||||
| #define THUMB_HD_PATH   "/DCIM/THUMB/LARGE"  //No use
 | ||||
| 
 | ||||
| /*typedef enum {		 
 | ||||
| 	POWEROFF_COUNTDOWN	= 1, | ||||
|  |  | |||
|  | @ -36,6 +36,7 @@ | |||
| #include "sf_log.h" | ||||
| #include "sf_sim.h" | ||||
| #include "sf_systemMng.h" | ||||
| #include "sf_storeMng.h" | ||||
| #include "sf_service.h" | ||||
| #include "sf_4G_sms_lpa_cmd.h" | ||||
| #include "sf_file.h" | ||||
|  | @ -810,7 +811,14 @@ int sf_sms_lpa_command_log(SF_SMS_LPA_CMD_T* pLpaCmd, SINT8 status, unsigned sho | |||
| 	 | ||||
| 	UIMenuStoreInfo *sfParam = sf_app_ui_para_get(); | ||||
| 	 | ||||
| 	SF_SPRINTF(filePath, "%sLPA%sTS.log", SF_LPA_LOG_FILE_PATH, sfParam->ModuleImei); | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 	 | ||||
| 	SF_SPRINTF(filePath, "%sLPA%sTS.log", strg_path, sfParam->ModuleImei); | ||||
| 	SLOGD("filePath:%s\n", filePath); | ||||
| 	 | ||||
| 	fdOld = SF_OPEN(filePath, O_RDWR, 0777); | ||||
|  | @ -828,7 +836,7 @@ int sf_sms_lpa_command_log(SF_SMS_LPA_CMD_T* pLpaCmd, SINT8 status, unsigned sho | |||
|  			sf_move_line(fdOld, delLineNum + 1); | ||||
| 			SLOGD("delLineNum:%d\n", delLineNum); | ||||
| 			 | ||||
| 			SF_SPRINTF(newFilePath, "%sLPA.log", SF_LPA_LOG_FILE_PATH); | ||||
| 			SF_SPRINTF(newFilePath, "%sLPA.log", strg_path); | ||||
| 			fdNew = SF_OPEN(newFilePath, O_WRONLY | O_CREAT, 0777); | ||||
| 			if(fdNew >= 0) | ||||
| 			{ | ||||
|  | @ -864,14 +872,14 @@ int sf_sms_lpa_command_log(SF_SMS_LPA_CMD_T* pLpaCmd, SINT8 status, unsigned sho | |||
| 	{ | ||||
| 		//old log file in sd card, not exist
 | ||||
| 		SLOGD("\n"); | ||||
| 		SF_SPRINTF(filePath, "%sLPA%sTS.log", SF_LPA_LOG_FILE_PATH, sfParam->ModuleImei); | ||||
| 		SF_SPRINTF(filePath, "%sLPA%sTS.log", strg_path, sfParam->ModuleImei); | ||||
| 		SLOGD("filePath:%s\n", filePath); | ||||
| 		fdNew = SF_OPEN(filePath, O_WRONLY | O_CREAT, 0777); | ||||
| 		if(fdNew >= 0) | ||||
| 			sf_write_log_content(fdNew, pLpaCmd, status, errorCode, Source); | ||||
| 		SF_CLOSE(fdNew); | ||||
| 	} | ||||
| 
 | ||||
| 	free(strg_path); | ||||
| 	SF_SYNC(); | ||||
| 	 | ||||
| } | ||||
|  | @ -879,8 +887,14 @@ int sf_sms_lpa_command_log(SF_SMS_LPA_CMD_T* pLpaCmd, SINT8 status, unsigned sho | |||
| void sf_sms_lpa_delete_lpa_log(void) | ||||
| {	 | ||||
| 	UINT8 fileName[64] = { 0 }; | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
| 	SF_SPRINTF(fileName, "%s%s", SF_LPA_LOG_FILE_PATH, sf_sms_lpa_log_file_name_get()); | ||||
| 	SF_SPRINTF(fileName, "%s%s", strg_path, sf_sms_lpa_log_file_name_get()); | ||||
| 
 | ||||
| 	if(sf_file_exsit(fileName) == SF_SUCCESS) | ||||
| 	{ | ||||
|  | @ -888,6 +902,7 @@ void sf_sms_lpa_delete_lpa_log(void) | |||
| 		SF_DELETE(fileName); | ||||
| 		SF_SYNC(); | ||||
| 	} | ||||
| 	free(strg_path); | ||||
| } | ||||
| 
 | ||||
| SINT32 sf_sms_lpa_command_recombination(SF_SMS_LPA_CMD_T *pLpaCmd) | ||||
|  | @ -1145,6 +1160,13 @@ SINT32 sf_sms_lpa_save_profile_info_item(const SINT8* iccid, const SINT8* apn, c | |||
| 	UINT32 fd = 0; | ||||
| 	SINT8 buff[256] = {0}; | ||||
| 
 | ||||
| 	char *file_path = sf_root_path_strcat(SF_LPA_PROFILE_INFO_BACKUP_FILENEME); | ||||
| 	if(file_path == NULL) | ||||
| 	{ | ||||
| 		free(file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
| 	if((iccid == NULL) || (apn == NULL) || (activationCodeStr == NULL)) | ||||
| 	{ | ||||
| 		return SF_FAILURE; | ||||
|  | @ -1166,7 +1188,8 @@ SINT32 sf_sms_lpa_save_profile_info_item(const SINT8* iccid, const SINT8* apn, c | |||
| 	SF_WRITE(fd, (UINT8 *)buff, SF_STRLEN(buff)); | ||||
| 	SF_CLOSE(fd); | ||||
| 
 | ||||
| 	SF_DELETE(SF_LPA_PROFILE_INFO_BACKUP_FILENEME); | ||||
| 	SF_DELETE(file_path); | ||||
| 	free(file_path); | ||||
| 	memset(buff, '\0', sizeof(buff)); | ||||
| 	sprintf(buff, "cp %s /sdcard/mmcblk0p1/ -f", SF_LPA_PROFILE_INFO_FILENEME); | ||||
| 	system(buff); | ||||
|  | @ -1193,6 +1216,13 @@ SINT32 sf_sms_lpa_delete_profile_info_item(const SINT8* iccid) | |||
| 	{ | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
| 	char *file_path = sf_root_path_strcat(SF_LPA_PROFILE_INFO_BACKUP_FILENEME); | ||||
| 	if(file_path == NULL) | ||||
| 	{ | ||||
| 		free(file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 	 | ||||
| 	SLOGD("Delete %s to %s\n", iccid, SF_LPA_PROFILE_INFO_FILENEME); | ||||
| 
 | ||||
|  | @ -1269,7 +1299,7 @@ SINT32 sf_sms_lpa_delete_profile_info_item(const SINT8* iccid) | |||
| 		if(sf_save_file(SF_LPA_PROFILE_INFO_FILENEME, tmpFileBuff, len) == FAIL) | ||||
| 		{ | ||||
| 			memset(buff, '\0', sizeof(buff)); | ||||
| 			sprintf(buff, "cp %s /appfs/ -f", SF_LPA_PROFILE_INFO_BACKUP_FILENEME); | ||||
| 			sprintf(buff, "cp %s /appfs/ -f", file_path); | ||||
| 			system(buff); | ||||
| 			SF_SYNC(); | ||||
| 		 | ||||
|  | @ -1279,12 +1309,13 @@ SINT32 sf_sms_lpa_delete_profile_info_item(const SINT8* iccid) | |||
| 			return SF_FAILURE; | ||||
| 		} | ||||
| 
 | ||||
| 		SF_DELETE(SF_LPA_PROFILE_INFO_BACKUP_FILENEME); | ||||
| 		SF_DELETE(file_path); | ||||
| 		memset(buff, '\0', sizeof(buff)); | ||||
| 		sprintf(buff, "cp %s /sdcard/mmcblk0p1/ -f", SF_LPA_PROFILE_INFO_FILENEME); | ||||
| 		system(buff); | ||||
| 		SF_SYNC(); | ||||
| 
 | ||||
| 		free(file_path); | ||||
| 		free(fileBuff); | ||||
| 		free(tmpFileBuff); | ||||
| 	} | ||||
|  | @ -1310,16 +1341,23 @@ SINT32 sf_sms_lpa_get_profile_info_item(const SINT8* iccid, SINT8* apn, SINT8* a | |||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
| 	char *file_path = sf_root_path_strcat(SF_LPA_PROFILE_INFO_BACKUP_FILENEME); | ||||
| 	if(file_path == NULL) | ||||
| 	{	 | ||||
| 		free(file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
| 	if((sf_sd_status_get() == SF_SD_OK) || (sf_sd_status_get() == SF_SD_FULL)) | ||||
| 	{ | ||||
| 		if((sf_file_exsit(SF_LPA_PROFILE_INFO_FILENEME) != SUCCESS) && (sf_file_exsit(SF_LPA_PROFILE_INFO_BACKUP_FILENEME) == SUCCESS)) | ||||
| 		if((sf_file_exsit(SF_LPA_PROFILE_INFO_FILENEME) != SUCCESS) && (sf_file_exsit(file_path) == SUCCESS)) | ||||
| 		{ | ||||
| 			memset(buff, '\0', sizeof(buff)); | ||||
| 			sprintf(buff, "cp %s /appfs/ -f", SF_LPA_PROFILE_INFO_BACKUP_FILENEME); | ||||
| 			sprintf(buff, "cp %s /appfs/ -f", file_path); | ||||
| 			system(buff); | ||||
| 			SF_SYNC(); | ||||
| 		} | ||||
| 		else if((sf_file_exsit(SF_LPA_PROFILE_INFO_FILENEME) == SUCCESS) && (sf_file_exsit(SF_LPA_PROFILE_INFO_BACKUP_FILENEME) != SUCCESS)) | ||||
| 		else if((sf_file_exsit(SF_LPA_PROFILE_INFO_FILENEME) == SUCCESS) && (sf_file_exsit(file_path) != SUCCESS)) | ||||
| 		{ | ||||
| 			memset(buff, '\0', sizeof(buff)); | ||||
| 			sprintf(buff, "cp %s /sdcard/mmcblk0p1/ -f", SF_LPA_PROFILE_INFO_FILENEME); | ||||
|  | @ -1335,9 +1373,10 @@ SINT32 sf_sms_lpa_get_profile_info_item(const SINT8* iccid, SINT8* apn, SINT8* a | |||
| 
 | ||||
| 	if(fSize == 0) | ||||
| 	{ | ||||
| 		sprintf(fileName, "%s", SF_LPA_PROFILE_INFO_BACKUP_FILENEME); | ||||
| 		sprintf(fileName, "%s", file_path); | ||||
| 		fSize = sf_get_file_size(fileName); | ||||
| 	} | ||||
| 	free(file_path); | ||||
| 
 | ||||
| 	if(fSize != 0) | ||||
| 	{ | ||||
|  | @ -1402,7 +1441,7 @@ SINT32 sf_sms_lpa_get_profile_info_item(const SINT8* iccid, SINT8* apn, SINT8* a | |||
| 		pStr = SF_STRSTR(buff, "AC:"); | ||||
| 
 | ||||
| 		if(pStr == NULL) | ||||
| 		{			 | ||||
| 		{	 | ||||
| 			SLOGD("AC not found\n"); | ||||
| 			return SF_FAILURE; | ||||
| 		} | ||||
|  | @ -1420,7 +1459,7 @@ SINT32 sf_sms_lpa_get_profile_info_item(const SINT8* iccid, SINT8* apn, SINT8* a | |||
| 	} | ||||
| 
 | ||||
| 	SLOGD("profile info file error\n"); | ||||
| 
 | ||||
| 	 | ||||
| 	return SF_FAILURE; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -14,6 +14,7 @@ extern "C" { | |||
| 
 | ||||
| #include "sf_hal_ttyusb.h" | ||||
| #include "sf_systemMng.h" | ||||
| #include "sf_storeMng.h" | ||||
| #include "sf_commu_mcu_reg.h" | ||||
| #include "sf_opera_adapt.h" | ||||
| #include "sf_eg91_sim.h" | ||||
|  | @ -329,12 +330,21 @@ SINT32 eg91_other_sim_apn_cfg(UIMenuStoreInfo *pstaticParam) | |||
| 	//SF_CHAR *pTemp = SF_NULL;
 | ||||
| 	int enbleValue = 0; | ||||
| 	 | ||||
| 	fp = fopen(SIM_AUTO_MATCH_FILE_PATH, "r"); | ||||
| 	char *file_path = sf_root_path_strcat(SIM_AUTO_MATCH_FILE_PATH); | ||||
| 	if(file_path == NULL) | ||||
| 	{ | ||||
| 		free(file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 	 | ||||
| 	fp = fopen(file_path, "r"); | ||||
| 	if(fp == NULL) | ||||
| 	{ | ||||
| 		SLOGE("open file [%s] failed!\n", SIM_AUTO_MATCH_FILE_PATH); | ||||
| 		free(file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 	free(file_path); | ||||
| 	 | ||||
| 	{ | ||||
| 	 	fgets(linestr, 128, fp); | ||||
|  |  | |||
|  | @ -1108,12 +1108,20 @@ SINT32 sf_ftp_dailyreport_send(void) | |||
| 
 | ||||
|     MLOGD("start\n"); | ||||
| 
 | ||||
| 	char *dp_filename = sf_root_path_strcat(SF_DAILYREPORT_FILENAME); | ||||
| 	if(dp_filename == NULL) | ||||
| 	{ | ||||
| 		free(dp_filename); | ||||
| 	   	return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
| 	if(SUCCESS != sf_create_dailyreport_file()) | ||||
| 	{ | ||||
| 		printf("%s:%d err create dailyreport file\n", __FUNCTION__, __LINE__); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 	sprintf((char *)filePath, "%s", SF_DAILYREPORT_FILENAME); | ||||
| 	sprintf((char *)filePath, "%s", dp_filename); | ||||
| 	free(dp_filename); | ||||
| 	//sprintf((char *)filePath, "UFS:/%s-dr.txt", pPara->ModuleImei);
 | ||||
| 
 | ||||
| 	printf("%s:%d filePath:%s\n", __FUNCTION__, __LINE__, filePath); | ||||
|  | @ -1123,6 +1131,12 @@ SINT32 sf_ftp_dailyreport_send(void) | |||
| 
 | ||||
| 	ret = SF_SUCCESS;//sf_quectel_upload_file_to_module((UINT8 *)SF_DAILYREPORT_FILENAME, (UINT8 *)SF_DAILYREPORT_TXT);
 | ||||
| 
 | ||||
| 	char *err_code_path = sf_root_path_strcat(SF_ERROR_CODE); | ||||
| 	if(err_code_path == NULL) | ||||
| 	{ | ||||
| 		free(err_code_path); | ||||
| 	   	return SF_FAILURE; | ||||
| 	} | ||||
| 	if(SF_SUCCESS != ret) | ||||
| 	{ | ||||
| 		printf("%s:%d upload err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); | ||||
|  | @ -1153,12 +1167,12 @@ SINT32 sf_ftp_dailyreport_send(void) | |||
|             pSifarPara->videoSendFailCount = 0; | ||||
|             pSifarPara->videoSendSucessCount = 0; | ||||
|             pSifarPara->SendlowPowerWarnCnt = 0; | ||||
|             sf_file_remove(SF_ERROR_CODE); | ||||
|             sf_file_remove(err_code_path); | ||||
| 		} | ||||
|         sf_dailyReport_set(); | ||||
| 	} | ||||
|     MLOGD(" end ret:[0x%08X]\n", ret); | ||||
| 
 | ||||
| 	free(err_code_path); | ||||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
|  | @ -1366,6 +1380,13 @@ SINT32 sf_4g_module_ota_ftp(void) | |||
|     const UINT8 *password; | ||||
|     // FtpConfig config;
 | ||||
|     MLOGD("start\n"); | ||||
| 	char tmp_path[64] = {'\0'}; | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
|     ssl_flag = FTP_SSL_FLAG_DISABLE; | ||||
|     ftpIP = pPara->OtaFtpIp; | ||||
|  | @ -1387,15 +1408,15 @@ SINT32 sf_4g_module_ota_ftp(void) | |||
|     printf("ftp_manager_init password = %s\n", config.password); | ||||
|     */ | ||||
|     ftp_manager_init(config); | ||||
| 
 | ||||
|     if(SF_TRUE == sf_file_IsExsit(SF_MODULE_UP_FILE_PATH)){ | ||||
|         sf_file_remove(SF_MODULE_UP_FILE_PATH); | ||||
| 	snprintf(tmp_path, sizeof(tmp_path), "%s%s", strg_path, SF_MODULE_UP_FILE_PATH); | ||||
|     if(SF_TRUE == sf_file_IsExsit(tmp_path)){ | ||||
|         sf_file_remove(tmp_path); | ||||
|     } | ||||
| 
 | ||||
|     ret = ftp_download_file(SF_MODULE_UP_FILE,SF_MODULE_UP_FILE_PATH,0); | ||||
|     ret = ftp_download_file(SF_MODULE_UP_FILE,tmp_path,0); | ||||
|     if(SUCCESS == ret){ | ||||
|         system("sync"); | ||||
|         sprintf(Cmd, "tar -xjvf %s -C %s", SF_MODULE_UP_FILE_PATH, SF_SD_ROOT); | ||||
|         sprintf(Cmd, "tar -xjvf %s -C %s", tmp_path, strg_path); | ||||
|         MLOGD("%s\n", Cmd); | ||||
|         ret = system(Cmd); | ||||
|         if(SUCCESS == ret){ | ||||
|  | @ -1408,7 +1429,7 @@ SINT32 sf_4g_module_ota_ftp(void) | |||
|             sf_set_module_update(0); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 	free(strg_path); | ||||
|     MLOGD(" end ret:[0x%08X]\n", ret); | ||||
|     return ret; | ||||
| } | ||||
|  | @ -1487,6 +1508,13 @@ SINT32 sf_camera_ota_ftp(void) | |||
|     // FtpConfig config;
 | ||||
|     MLOGD("start\n"); | ||||
| 
 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 	   	return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
|     ssl_flag = FTP_SSL_FLAG_DISABLE; | ||||
|     ftpIP = pPara->OtaFtpIp; | ||||
|     port = atoi((const char *)(pPara->OtaFtpPort)); | ||||
|  | @ -1507,12 +1535,14 @@ SINT32 sf_camera_ota_ftp(void) | |||
|     printf("ftp_manager_init password = %s\n", config.password); | ||||
|     */ | ||||
|     ftp_manager_init(config); | ||||
| 	char tmp[64] = {'\0'}; | ||||
| 	snprintf(tmp, sizeof(tmp), "%s%s", strg_path, SF_CAM_UP_FILE_PATH); | ||||
| 
 | ||||
|     if(SF_TRUE == sf_file_IsExsit(SF_CAM_UP_FILE_PATH)){ | ||||
|         sf_file_remove(SF_CAM_UP_FILE_PATH); | ||||
|     if(SF_TRUE == sf_file_IsExsit(tmp)){ | ||||
|         sf_file_remove(tmp); | ||||
|     } | ||||
| 
 | ||||
|     ret = ftp_download_file(SF_CAM_UP_FILE,SF_CAM_UP_FILE_PATH,0); | ||||
|     ret = ftp_download_file(SF_CAM_UP_FILE,tmp,0); | ||||
|     //if(SUCCESS == ret)
 | ||||
|     { | ||||
|         // sprintf(Cmd, "tar -xjvf %s -C %s", SF_CAM_UP_FILE_PATH, SF_SD_ROOT);
 | ||||
|  | @ -1534,7 +1564,7 @@ SINT32 sf_camera_ota_ftp(void) | |||
|             sf_log_error_code(logStr); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 	free(strg_path); | ||||
|     MLOGD(" end ret:[0x%08X]\n", ret); | ||||
|     return ret; | ||||
| } | ||||
|  | @ -1769,6 +1799,13 @@ SINT32 sf_hd_ftp_send(void) | |||
|     UINT8 timeoutCnt = 0; | ||||
|     double elapsed_time = 0; | ||||
| 
 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 	    return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
|     sf_set_send_hd(0); | ||||
| 	sf_custom_str_get(CamNameStr); | ||||
| 	sf_4G_signal_level_get(sf_get_net_generation(),sf_get_cq_signal(),&csqlevel); | ||||
|  | @ -1783,8 +1820,8 @@ SINT32 sf_hd_ftp_send(void) | |||
|         while((sf_app_while_flag()) && (((piccount) < SendFileTotal)) && ((pPara->GprsMode == 1) || ((pSifarPara->subscribeSendCnt < SUBSCRIBE_SEND_MAX_NUM) && (pPara->GprsMode != 1)))) | ||||
|         { | ||||
|             snprintf((char *)ftpFileName, sizeof(ftpFileName), "W%03d%04d.JPG", fileCfg->stfileattr[piccount].dirKey, fileCfg->stfileattr[piccount].fileKey); | ||||
|             snprintf((char *)filePath, sizeof(filePath), "%s/%s", SF_HD_DIR, ftpFileName); | ||||
|              | ||||
|             snprintf((char *)filePath, sizeof(filePath), "%s%s/%s", strg_path, SF_HD_DIR, ftpFileName); | ||||
|             free(strg_path); | ||||
|             sf_set_del_flag(FALSE); | ||||
|             ret1 = SF_SUCCESS;//sf_quectel_upload_file_to_module(filePath, ftpFileName);
 | ||||
| 
 | ||||
|  | @ -1927,6 +1964,13 @@ UINT32 sf_video_find_file(UINT16 dirKey, UINT16 fileKey, UINT8 *destFname) | |||
| 	UINT8 i = 0; | ||||
| 	char fname[50] = {0}; | ||||
| 	//UINT8 srcFname[50] = {0};
 | ||||
| 
 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 	 | ||||
| 	fileIndex = dirKey * 10000 + fileKey + 1; | ||||
| 
 | ||||
|  | @ -1934,7 +1978,7 @@ UINT32 sf_video_find_file(UINT16 dirKey, UINT16 fileKey, UINT8 *destFname) | |||
| 	{ | ||||
| 		dirKey = fileIndex / 10000; | ||||
| 		fileKey = fileIndex % 10000; | ||||
| 		SF_SPRINTF(fname, "%s/%03dMEDIA/%s%04d.MP4", SF_DCIM_DIR, dirKey, DCF_FILE_NAME, fileKey); | ||||
| 		SF_SPRINTF(fname, "%s%s/%03dMEDIA/%s%04d.MP4", strg_path, SF_DCIM_DIR, dirKey, DCF_FILE_NAME, fileKey); | ||||
| 
 | ||||
| 		//fileSize = sf_get_file_size(fname);
 | ||||
|         sf_file_size_get(fname,&fileSize); | ||||
|  | @ -1947,6 +1991,7 @@ UINT32 sf_video_find_file(UINT16 dirKey, UINT16 fileKey, UINT8 *destFname) | |||
| 		} | ||||
| 		fileIndex++; | ||||
| 	} | ||||
| 	free(strg_path); | ||||
| 	return fileSize; | ||||
| } | ||||
| /*************************************************
 | ||||
|  | @ -2165,9 +2210,16 @@ SINT32 sf_log_send_ftp(void) | |||
| 	ssl = ((2 == pPara->FtpSwitch) ? 1 : 0); | ||||
| 	gprsMode = 0;//puiPara->GprsMode;
 | ||||
| 
 | ||||
| 	char *file_path = sf_root_path_strcat(LOG_AT_FILE_PATH); | ||||
| 	if(file_path == NULL) | ||||
| 	{ | ||||
| 		free(file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
|     MLOGD("start\n"); | ||||
|     sf_set_send_log(0); | ||||
| 	if(sf_file_IsExsit(LOG_AT_FILE_PATH) != SF_TRUE) | ||||
| 	if(sf_file_IsExsit(file_path) != SF_TRUE) | ||||
| 	{ | ||||
| 		printf("%s:%d err file\n", __FUNCTION__, __LINE__); | ||||
| 		return SF_FAILURE; | ||||
|  | @ -2178,8 +2230,8 @@ SINT32 sf_log_send_ftp(void) | |||
| 	if(SF_SUCCESS == ret) | ||||
| 	{ | ||||
|         //sprintf((char *)filePath, "UFS:/%s", SF_LOG_TXT);
 | ||||
|         sprintf((char *)filePath, "%s", LOG_AT_FILE_PATH); | ||||
| 
 | ||||
|         sprintf((char *)filePath, "%s", file_path); | ||||
| 		 | ||||
|         printf("%s:%d filePath:%s\n", __FUNCTION__, __LINE__, filePath); | ||||
| 
 | ||||
|         sf_custom_str_get(customStr); | ||||
|  | @ -2214,6 +2266,7 @@ SINT32 sf_log_send_ftp(void) | |||
| 	//printf("[%s:%d]ret:[0x%08X],ret2:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret, ret2);
 | ||||
|     MLOGD(" end ret:[0x%08X],ret2:[0x%08X]\n", ret, ret2); | ||||
| 
 | ||||
| 	free(file_path); | ||||
| 	if(ret != SF_SUCCESS) | ||||
| 	{ | ||||
| 		return ret; | ||||
|  | @ -2247,7 +2300,14 @@ SINT32 sf_low_power_warn_send_ftp(void) | |||
| 	} | ||||
|     MLOGD("start\n"); | ||||
| 
 | ||||
| 	sprintf((char *)filePath, "%s", SF_LOW_POWER_WARN_FILENAME); | ||||
| 	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); | ||||
| 
 | ||||
| 	sf_custom_str_get(customStr); | ||||
| 	sprintf((char *)uploadFname, "%s-%s-btalarm.txt",pPara->ModuleImei, customStr); | ||||
|  | @ -2265,6 +2325,7 @@ SINT32 sf_low_power_warn_send_ftp(void) | |||
|     } | ||||
|     MLOGD(" end ret:[0x%08X]\n", ret); | ||||
| 	//printf("[%s:%d]ret:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret);
 | ||||
| 	free(file_path); | ||||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1980,7 +1980,14 @@ void sf_hd_pic_add_to_list(UINT8 *fileName) | |||
|     SF_STRNCPY(tempStr, fileName+1, 3); | ||||
|     dirKey = atoi((const char *)tempStr); | ||||
|     fileKey = atoi((const char *)fileName+4); | ||||
|     SF_SPRINTF(fname, "%s/%03dMEDIA/%s%04d.JPG", SF_DCIM_DIR, dirKey, DCF_FILE_NAME, fileKey); | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return; | ||||
| 	} | ||||
|     SF_SPRINTF(fname, "%s%s/%03dMEDIA/%s%04d.JPG", strg_path, SF_DCIM_DIR, dirKey, DCF_FILE_NAME, fileKey); | ||||
| 	free(strg_path); | ||||
|     if(sf_file_IsExsit(fname) != SF_TRUE) | ||||
|     { | ||||
|         MLOGE("%s\n", fname); | ||||
|  | @ -2032,17 +2039,28 @@ void sf_hd_pic_list_print(void) | |||
|     UINT8 i = 0; | ||||
|     //int fd = 0;
 | ||||
|     struct stat st_buffer; | ||||
| 	char hd_dir[64] = {'\0'}; | ||||
|     //char sendListName[64] = {0};
 | ||||
|     //char buff[SF_SEND_LIST_ITEM_LENGTH+1] = {0};
 | ||||
|     SubImgList_t *pList = pSubImgListHead->pNext; | ||||
|     printf("[%s:%d] print list:\n", __FUNCTION__, __LINE__); | ||||
|     SF_HDFILE_ATTR_S* fileCfg = sf_file_hd_cfg_get(); | ||||
| 
 | ||||
|     if (stat(SF_HD_DIR, &st_buffer) == 0 && S_ISDIR(st_buffer.st_mode)) { | ||||
|         printf("%s exists\n", SF_HD_DIR); | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 	   	return; | ||||
| 	} | ||||
| 	 | ||||
| 	snprintf(hd_dir, sizeof(hd_dir), "%s%s", strg_path, SF_HD_DIR); | ||||
| 	free(strg_path); | ||||
| 	 | ||||
|     if (stat(hd_dir, &st_buffer) == 0 && S_ISDIR(st_buffer.st_mode)) { | ||||
|         printf("%s exists\n", hd_dir); | ||||
|     } | ||||
|     else{ | ||||
|         if (mkdir(SF_HD_DIR, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) { | ||||
|         if (mkdir(hd_dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) { | ||||
|             printf("Failed to create directory"); | ||||
|         } | ||||
|     } | ||||
|  | @ -2101,6 +2119,13 @@ void sf_video_add_to_list(UINT8 *fileName) | |||
|     UINT16 fileKeytmp = 0; | ||||
|     printf("add to list:%s\n", fileName); | ||||
| 
 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
|     SF_STRNCPY(tempStr, fileName+1, 3); | ||||
|     dirKey = atoi((const char *)tempStr); | ||||
|     fileKey = atoi((const char *)fileName+4); | ||||
|  | @ -2111,7 +2136,8 @@ void sf_video_add_to_list(UINT8 *fileName) | |||
| 	{ | ||||
| 		dirKeytmp = fileIndex / 10000; | ||||
| 		fileKeytmp = fileIndex % 10000; | ||||
|         SF_SPRINTF(fname, "%s/%03dMEDIA/%s%04d.MP4", SF_DCIM_DIR, dirKeytmp, DCF_FILE_NAME, fileKeytmp); | ||||
|         SF_SPRINTF(fname, "%s%s/%03dMEDIA/%s%04d.MP4", strg_path, SF_DCIM_DIR, dirKeytmp, DCF_FILE_NAME, fileKeytmp); | ||||
| 		free(strg_path); | ||||
|         sf_file_size_get(fname,&fileSize); | ||||
| 		printf("find video:%s size=%d\n", fname, fileSize); | ||||
| 
 | ||||
|  |  | |||
|  | @ -143,7 +143,9 @@ int main(int argc, char *argv[]) | |||
|     //sf_share_mem_customer_update();
 | ||||
| 	sf_com_message_app_init(); | ||||
| 	sf_com_message_cardv_init(); | ||||
|      | ||||
| 
 | ||||
| 	//init stroage_dev struct
 | ||||
| 	sf_strg_dev_init(); | ||||
|     //app_led_group_register();
 | ||||
| 	app_message_recv_start(); | ||||
| 
 | ||||
|  | @ -258,7 +260,7 @@ int main(int argc, char *argv[]) | |||
|         stMessageBuf.arg2 = SF_KEY_PIN_AOTU_MODE_POWOFF;//auto mode powoff
 | ||||
|         sf_com_message_send_to_cardv(&stMessageBuf); | ||||
|     }*/ | ||||
| 
 | ||||
| 	 | ||||
|     ftp_manager_uninit(); | ||||
| 	sf_share_mem_file_deinit(); | ||||
| 	sf_share_mem_customer_deinit(); | ||||
|  |  | |||
|  | @ -415,6 +415,12 @@ static SINT32 process_cmd_shortclick(SF_MESSAGE_BUF_S *pMessageBuf) | |||
| } | ||||
| static SINT32 process_cmd_longclick(SF_MESSAGE_BUF_S *pMessageBuf) | ||||
| { | ||||
| 	char *file_path = sf_root_path_strcat("EG95"); | ||||
| 	if(file_path == NULL) | ||||
| 	{ | ||||
| 		free(file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 	switch(pMessageBuf->arg2) { | ||||
| 		case SF_KEY_PIN_RESET: | ||||
| 				 | ||||
|  | @ -426,15 +432,22 @@ static SINT32 process_cmd_longclick(SF_MESSAGE_BUF_S *pMessageBuf) | |||
| 				break; | ||||
| 			} | ||||
| 			MLOGI("BatRemainCap = [%d]\n",	sf_statistics_param_get()->BatRemainCap); | ||||
| 			if((access("/mnt/sd/EG95", F_OK) == 0) && (sf_statistics_param_get()->BatRemainCap > 40)) | ||||
| 			if((access(file_path, F_OK) == 0) && (sf_statistics_param_get()->BatRemainCap > 40)) | ||||
| 			{	 | ||||
| 				MLOGI("eg95\n"); | ||||
| 				bmoduleupdate = 1; | ||||
| 				if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) | ||||
| 					sf_led_event_process(LED_STATUS_QUICKFLASH_ON,LED_GROUP_SD,LED_TYPE_GREEN); | ||||
| 				system("/usr/bin/QFirehose -f /mnt/sd/EG95"); | ||||
| 				if(strcmp(file_path, "/mnt/sd/EG95") == 0) | ||||
| 				{ | ||||
| 					system("/usr/bin/QFirehose -f /mnt/sd/EG95"); | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| 					system("/usr/bin/QFirehose -f /mnt/sd2/EG95"); | ||||
| 				} | ||||
| 				free(file_path); | ||||
| 				app_system_poweroff(SF_POWEROFF_REBOOT); | ||||
| 
 | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
|  | @ -588,172 +601,139 @@ static SINT32 sf_app_process_cmd_keyctrl(SF_MESSAGE_BUF_S *pMessageBuf) | |||
| 	 | ||||
| 	return SF_SUCCESS; | ||||
| } | ||||
| static SINT32 sf_app_process_cmd_SD(SF_MESSAGE_BUF_S *pMessageBuf) | ||||
| { | ||||
| 	//static SINT8 bsdstatus = 0;
 | ||||
| 	//static SINT8 bsdoutstatus = 0;
 | ||||
| 	UINT32 status; | ||||
|     SINT16 startup = sf_poweron_type_get(); | ||||
| 
 | ||||
| 	MLOGD("[dev_id:%d,evt:%s]\n",pMessageBuf->arg2,app_process_SD_getstatusstring(pMessageBuf->arg1)); | ||||
| 	 | ||||
| 	switch(pMessageBuf->arg1) | ||||
| static SINT32 sfStrgDevOnActionMount(int dev_id, int result) | ||||
| {	 | ||||
| 	SINT16 startup = sf_poweron_type_get(); | ||||
| 	UINT32 status  = 0; | ||||
| 	status = result; | ||||
| 	switch (status) | ||||
| 	{ | ||||
|         case CMD_SD_STRG_CB_UNKNOWN: | ||||
| 		case FST_STA_OK: | ||||
| 			sf_set_card(1); | ||||
| 			sf_sd_status_set(SF_SD_OK); | ||||
| 			 | ||||
| 			if(SF_MCU_STARTUP_ONKEY == startup) | ||||
| 			{ | ||||
| 				SF_STORE_ATTR_S storeattrs = {0}; | ||||
| 				sf_sd_info_get(&storeattrs); | ||||
| 				printf("SD free=%dM/%dM\n", storeattrs.SDFree, storeattrs.SDTotalSize); | ||||
| 				if (storeattrs.SDFree < 30) /* 30MB */ | ||||
| 				{ | ||||
| 					sf_sys_status_led_set(SF_LED_SYS_STATE_SD_FULL); | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| 					sf_sys_status_led_set(SF_LED_SYS_STATE_SD_NORMAL); | ||||
| 				} | ||||
| 			} | ||||
| 			sf_statistics_param_load(sf_statistics_param_get()); | ||||
| 			MLOGI("card-%d mount OK\r\n", dev_id + 1); | ||||
| 			sf_set_key_fw_update(sf_get_fw_update());//up fw
 | ||||
| 			if(sf_get_mcu_update_flag())//up mcu
 | ||||
| 			{ | ||||
| 				sf_app_mcu_updata_start(); | ||||
| 			} | ||||
| 			break; | ||||
| 		case FST_STA_DISK_UNFORMAT: | ||||
| 			sf_statistics_param_load(sf_statistics_param_get()); | ||||
| 			MLOGI("^Rcard-%d mount FAIL: Unformat\r\n", dev_id + 1); | ||||
| 			break; | ||||
| 		case FST_STA_DISK_UNKNOWN_FORMAT: | ||||
| 			sf_sys_status_led_set(SF_LED_SYS_STATE_SD_FULL); | ||||
| 			MLOGI("^Rcard-%d mount FAIL: Unknown Format\r\n", dev_id + 1); | ||||
| 			break; | ||||
| 		case FST_STA_CARD_ERR: | ||||
| 			sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR); | ||||
| 			MLOGI("^Rcard-%d mount FAIL: Card Error\r\n", dev_id + 1); | ||||
| 			break; | ||||
| 		default: | ||||
| 			MLOGI("^Rcard-%d mount FAIL: ErrID=%d\r\n", dev_id + 1, status); | ||||
| 			break; | ||||
| 	} | ||||
| 	return SF_SUCCESS; | ||||
| } | ||||
| 
 | ||||
| static SINT32 sfStrgDevSdHandler(int cb_evt, int dev_id, int result) | ||||
| { | ||||
| 	switch(cb_evt) | ||||
| 	{ | ||||
| 		case CMD_SD_STRG_CB_UNKNOWN: | ||||
| 			sf_set_card_full(1); | ||||
| 			break; | ||||
| 		case CMD_SD_STRG_CB_INSERTED: | ||||
| 			sf_set_card(1); | ||||
| 			break; | ||||
| 		case CMD_SD_STRG_CB_REMOVED: | ||||
| 			sf_set_card(0); | ||||
| 			sf_sd_status_set(SF_SD_OUT); | ||||
| 			sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR); | ||||
| 			break; | ||||
| 		case CMD_SD_STRG_CB_MOUNT_FINISH: | ||||
| 			sfStrgDevOnActionMount(dev_id, result); | ||||
| 			break; | ||||
| 		case CMD_SD_STRG_CB_UNMOUNT_FINISH: | ||||
| 			sf_set_card(0); | ||||
| 			sf_sd_status_set(SF_SD_OUT); | ||||
| 			sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR); | ||||
| 			MLOGI("CMD_SD_STRG_CB_UNMOUNT_FINISH\r\n"); | ||||
| 			break; | ||||
| 	} | ||||
| 	return SF_SUCCESS; | ||||
| } | ||||
| 
 | ||||
| static SINT32 sfStrgDevEmmcHandler(int cb_evt, int dev_id, int result) | ||||
| { | ||||
| 	switch(cb_evt) | ||||
| 	{ | ||||
| 		case CMD_SD_STRG_CB_UNKNOWN: | ||||
|             sf_set_card_full(1); | ||||
|             break; | ||||
|         case CMD_SD_STRG_CB_INSERTED: | ||||
|             sf_set_card(1); | ||||
|             // sf_sd_status_set(SF_SD_OK);
 | ||||
|             break; | ||||
|         case CMD_SD_STRG_CB_REMOVED: | ||||
|             sf_set_card(0); | ||||
|             sf_sd_status_set(SF_SD_OUT); | ||||
|             sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR); | ||||
|             break; | ||||
| 		 | ||||
|         case CMD_SD_STRG_CB_MOUNT_FINISH: | ||||
| 
 | ||||
|             status = pMessageBuf->arg3; | ||||
|             switch (status) | ||||
|             { | ||||
|                 case FST_STA_OK: | ||||
|                     sf_set_card(1); | ||||
|                     sf_sd_status_set(SF_SD_OK); | ||||
|                      | ||||
|                     if(SF_MCU_STARTUP_ONKEY == startup) | ||||
|                     { | ||||
|                         SF_STORE_ATTR_S storeattrs = {0}; | ||||
|                         sf_sd_info_get(&storeattrs); | ||||
|                         printf("SD free=%dM/%dM\n", storeattrs.SDFree, storeattrs.SDTotalSize); | ||||
|                         if (storeattrs.SDFree < 30) /* 30MB */ | ||||
|                         { | ||||
|                             sf_sys_status_led_set(SF_LED_SYS_STATE_SD_FULL); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             sf_sys_status_led_set(SF_LED_SYS_STATE_SD_NORMAL); | ||||
|                         } | ||||
|                     } | ||||
| 
 | ||||
| 					sf_statistics_param_load(sf_statistics_param_get()); | ||||
|                     MLOGI("card-%d mount OK\r\n", pMessageBuf->arg2 + 1); | ||||
| 
 | ||||
|                     sf_set_key_fw_update(sf_get_fw_update());//up fw
 | ||||
| 
 | ||||
|                     if(sf_get_mcu_update_flag())//up mcu
 | ||||
|                     { | ||||
|                         sf_app_mcu_updata_start(); | ||||
|                     } | ||||
|                     break; | ||||
|                 case FST_STA_DISK_UNFORMAT: | ||||
| 					//sf_set_card(1);
 | ||||
|                     //sf_sd_status_set(SF_SD_OK);
 | ||||
|                     //sf_sys_status_led_set(SF_LED_SYS_STATE_SD_NORMAL);
 | ||||
| 					sf_statistics_param_load(sf_statistics_param_get()); | ||||
|                     MLOGI("^Rcard-%d mount FAIL: Unformat\r\n", pMessageBuf->arg2 + 1); | ||||
|                     break; | ||||
|                 case FST_STA_DISK_UNKNOWN_FORMAT: | ||||
|                     sf_sys_status_led_set(SF_LED_SYS_STATE_SD_FULL); | ||||
|                     MLOGI("^Rcard-%d mount FAIL: Unknown Format\r\n", pMessageBuf->arg2 + 1); | ||||
|                     break; | ||||
|                 case FST_STA_CARD_ERR: | ||||
|                     sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR); | ||||
|                     MLOGI("^Rcard-%d mount FAIL: Card Error\r\n", pMessageBuf->arg2 + 1); | ||||
|                     break; | ||||
|                 default: | ||||
|                     MLOGI("^Rcard-%d mount FAIL: ErrID=%d\r\n", pMessageBuf->arg2 + 1, status); | ||||
|                     break; | ||||
|             } | ||||
| 
 | ||||
|              break; | ||||
|    			sfStrgDevOnActionMount(dev_id, result); | ||||
|             break; | ||||
|         case CMD_SD_STRG_CB_UNMOUNT_FINISH: | ||||
| 			sf_set_card(0); | ||||
|             sf_sd_status_set(SF_SD_OUT); | ||||
| 			sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR); | ||||
| 			MLOGI("CMD_SD_STRG_CB_UNMOUNT_FINISH\r\n"); | ||||
| 			break; | ||||
|         case CMD_SD_SYSTEM_CB_CONFIG: | ||||
|                  | ||||
| 	} | ||||
| 	return SF_SUCCESS; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| static SINT32 sf_app_process_cmd_SD(SF_MESSAGE_BUF_S *pMessageBuf) | ||||
| { | ||||
| 	MLOGD("[dev_id:%d,evt:%d]\n",pMessageBuf->arg2,pMessageBuf->arg1); | ||||
| 
 | ||||
| 	if(pMessageBuf->arg2 == MMC_DEV_SD) | ||||
| 	{ | ||||
| 		sfStrgDevSdHandler(pMessageBuf->arg1, pMessageBuf->arg2, pMessageBuf->arg3); | ||||
| 	} | ||||
| 	//else if(pMessageBuf->arg2 == MMC_DEV_EMMC)
 | ||||
| 	{ | ||||
| 		//sfStrgDevEmmcHandler(pMessageBuf->arg1, pMessageBuf->arg2, pMessageBuf->arg3);
 | ||||
| 	} | ||||
| 	 | ||||
| 	switch(pMessageBuf->arg1) | ||||
| 	{ | ||||
|         case CMD_SD_SYSTEM_CB_CONFIG:    | ||||
|             break; | ||||
|         case CMD_SD_FULL: | ||||
| 			sf_sys_status_led_set(SF_LED_SYS_STATE_SD_ERROR); | ||||
| 			MLOGI("CMD_SD_FULL\r\n"); | ||||
|             sf_set_card_full(1); | ||||
|             sf_sd_status_set(SF_SD_FULL); | ||||
| 			/*sf_sd_status_set(SF_SD_FULL);
 | ||||
| 			if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) { | ||||
| 				if(!(SF_UPGRADE_ING == sf_upgrade_status_get() || SF_UPGRADE_FAIL == sf_upgrade_status_get())) | ||||
| 					sf_led_event_process(LED_STATUS_HOLD_ON,LED_GROUP_SD,LED_TYPE_YELLOW); | ||||
| 				} | ||||
| 				 | ||||
| 			if(!bsdstatus) { | ||||
| 				bsdstatus = 1; | ||||
| 				 | ||||
| 				sf_upgrade_ota_param_recover(); | ||||
| 				sf_statistics_param_load(sf_statistics_param_get()); | ||||
| 				app_system_param_update(); | ||||
| 				if((sf_poweron_type_get() != SF_MCU_STARTUP_TIMELAPSE) && (sf_poweron_type_get() != SF_MCU_STARTUP_PIR)) { | ||||
| 					app_t110(); | ||||
| 				} | ||||
| 			}*/ | ||||
| 			break; | ||||
| 		/*case CMD_SD_MOUNT_SUCCESS:
 | ||||
| 			sf_sd_status_set(SF_SD_OK); | ||||
| 			if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) { | ||||
| 				if(!(SF_UPGRADE_ING == sf_upgrade_status_get() || SF_UPGRADE_FAIL == sf_upgrade_status_get())) | ||||
| 					sf_led_event_process((sf_customer_param_get()->DebugMode?LED_STATUS_SLOWFLASH_ON:LED_STATUS_HOLD_ON),LED_GROUP_SD,LED_TYPE_GREEN); | ||||
| 			} | ||||
| 			if(!bsdstatus) { | ||||
| 				bsdstatus = 1; | ||||
| 				sf_upgrade_ota_param_recover(); | ||||
| 				sf_statistics_param_load(sf_statistics_param_get()); | ||||
| 				app_system_param_update(); | ||||
| 				if((sf_poweron_type_get() != SF_MCU_STARTUP_TIMELAPSE) && (sf_poweron_type_get() != SF_MCU_STARTUP_PIR)) { | ||||
| 					app_t110(); | ||||
| 				} | ||||
| 			} | ||||
| 			break; | ||||
| 		case CMD_SD_ERROR: | ||||
| 			sf_sd_status_set(SF_SD_ERROR); | ||||
| 			if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) { | ||||
| 				if(!(SF_UPGRADE_ING == sf_upgrade_status_get() || SF_UPGRADE_FAIL == sf_upgrade_status_get())) | ||||
| 					sf_led_event_process(LED_STATUS_HOLD_ON,LED_GROUP_SD,LED_TYPE_YELLOW); | ||||
| 			} | ||||
| 			 | ||||
| 			if(!bsdstatus) { | ||||
| 				sf_statistics_param_reset(sf_statistics_param_get()); | ||||
| 				app_system_param_update(); | ||||
| 				if((sf_poweron_type_get() != SF_MCU_STARTUP_TIMELAPSE) && (sf_poweron_type_get() != SF_MCU_STARTUP_PIR)) { | ||||
| 					app_t110(); | ||||
| 				} | ||||
| 			} | ||||
| 			break; | ||||
| 
 | ||||
| 		case CMD_SD_MOUNT_FAILURE: | ||||
| 		case CMD_SD_OUT: | ||||
| 			sf_sd_status_set(SF_SD_OUT); | ||||
| 			if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) { | ||||
| 				if(!(SF_UPGRADE_ING == sf_upgrade_status_get() || SF_UPGRADE_FAIL == sf_upgrade_status_get())) | ||||
| 					sf_led_event_process(LED_STATUS_HOLD_ON,LED_GROUP_SD,LED_TYPE_RED); | ||||
| 			} | ||||
| 			 | ||||
| 			if((sf_poweron_type_get() == SF_MCU_STARTUP_PIR) || (sf_poweron_type_get() == SF_MCU_STARTUP_TIMELAPSE)) | ||||
| 			{ | ||||
| 				app_system_poweroff(SF_POWEROFF_NO_SD); | ||||
| 			} | ||||
| 			if((!bsdoutstatus) && (!bsdstatus)) { | ||||
| 					sf_statistics_param_reset(sf_statistics_param_get()); | ||||
| 					app_system_param_update(); | ||||
| 					bsdoutstatus = 1; | ||||
| 					if((sf_poweron_type_get() != SF_MCU_STARTUP_TIMELAPSE) && (sf_poweron_type_get() != SF_MCU_STARTUP_PIR)) { | ||||
| 						app_t110(); | ||||
| 					} | ||||
| 			} | ||||
| 			break; | ||||
|             */ | ||||
|         case CMD_SD_FORMAT: | ||||
|             sf_set_card_statu(pMessageBuf->arg2); | ||||
| 			break; | ||||
| 		case CMD_SD_STRG_WORKABLE_DEV: | ||||
| 			sf_strg_dev_register(pMessageBuf->arg2, pMessageBuf->arg3); | ||||
| 			break; | ||||
| 		default: | ||||
| 			break; | ||||
| 	} | ||||
|  |  | |||
|  | @ -153,6 +153,12 @@ SF_BOOL app_disconnect_4g_module(void) { | |||
| #if SF_QLOG_ENABLE | ||||
| static SINT16 app_Qlog_procress(void) { | ||||
|     SINT16 s32ret = SF_SUCCESS; | ||||
| 	char *file_path = sf_root_path_strcat(QLOG_PATH); | ||||
| 	if(file_path == NULL) | ||||
| 	{ | ||||
| 		free(file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
|     char qlogPath[128] = {0}; | ||||
|     char qlogDirCmd[128] = {0}; | ||||
|  | @ -161,19 +167,20 @@ static SINT16 app_Qlog_procress(void) { | |||
|     if(SF_FAILURE == sf_check_sd()) | ||||
|     { | ||||
|         MLOGE("ERROR sf_check_sd\n"); | ||||
| 		free(file_path); | ||||
|         return SF_FAILURE; | ||||
|     } | ||||
| 
 | ||||
|     time(&timep); | ||||
|     p = gmtime(&timep); | ||||
|     if (access("/mnt/sd/qlog", F_OK) != 0) { | ||||
|     s32ret = mkdir("/mnt/sd/qlog", S_IRWXU); | ||||
|     if (access(file_path, F_OK) != 0) { | ||||
|     s32ret = mkdir(file_path, S_IRWXU); | ||||
|     if (s32ret != 0) | ||||
|         return s32ret; | ||||
|     } | ||||
|     sprintf(qlogPath, "%04d%02d%02d%02d%02d%02d", p->tm_year + 1900, | ||||
|             p->tm_mon + 1, p->tm_mday, p->tm_hour, p->tm_min, p->tm_sec); | ||||
|     sprintf(qlogDirCmd, "/usr/bin/QLog -s %s%s &", QLOG_PATH, qlogPath); | ||||
|     sprintf(qlogDirCmd, "/usr/bin/QLog -s %s%s%s &", file_path, qlogPath); | ||||
|     MLOGD("%s\n", qlogDirCmd); | ||||
|     s32ret = system(qlogDirCmd); | ||||
|     while (sf_app_while_flag()) | ||||
|  | @ -187,6 +194,7 @@ static SINT16 app_Qlog_procress(void) { | |||
|     s32ret = system("killall QLog"); | ||||
|     QlogTsk.IsRun = 0; | ||||
|     MLOGI("exit QlogTsk.IsRun:%d\n", QlogTsk.IsRun); | ||||
| 	free(file_path); | ||||
|     return s32ret; | ||||
| } | ||||
| 
 | ||||
|  | @ -871,6 +879,12 @@ SINT16 sf_thumb_file_creat(void) { | |||
|   SF_CHAR fileKeyStr[10] = {0}; | ||||
|   SF_CHAR filePathStr[128] = {0}; | ||||
|   SINT16 fileIndex = 0; | ||||
|   char *strg_path = sf_get_root_path(); | ||||
|   if(strg_path == NULL) | ||||
|   { | ||||
|   	 free(strg_path); | ||||
| 	 return SF_FAILURE; | ||||
|   } | ||||
|   SF_SRCFILE_ATTR_S *fileCfg = sf_file_thumb_cfg_get(); | ||||
| 
 | ||||
|   for (fileIndex = 0; fileIndex < fileCfg->filecnt; fileIndex++) { | ||||
|  | @ -879,7 +893,7 @@ SINT16 sf_thumb_file_creat(void) { | |||
|       strncpy(dirKeyStr, fileCfg->stfileattr[fileIndex].thumbfileName + 1, 3); | ||||
|       strncpy(fileKeyStr, fileCfg->stfileattr[fileIndex].thumbfileName + 4, 8); | ||||
|       MLOGD("dirKeyStr:%s, fileKeyStr:%s\n", dirKeyStr, fileKeyStr); | ||||
|       sprintf(filePathStr, "%s%s/%s%s/%s%s", SF_SD_ROOT, SF_DCF_ROOT_DIR_NAME, | ||||
|       sprintf(filePathStr, "%s%s/%s%s/%s%s", strg_path, SF_DCF_ROOT_DIR_NAME, | ||||
|               dirKeyStr, SF_DCF_DIR_NAME_SUFFIX, SF_DCF_FILE_NAME_PREFIX, | ||||
|               fileKeyStr); | ||||
|       MLOGD("fileKeyStr:%s\n", filePathStr); | ||||
|  | @ -893,7 +907,7 @@ SINT16 sf_thumb_file_creat(void) { | |||
|       } | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   free(strg_path); | ||||
|   return SF_SUCCESS; | ||||
| } | ||||
| 
 | ||||
|  | @ -1104,6 +1118,8 @@ SINT16 app_file_transfer_Error_return_server(SF_FN_PARAM_S *pfnParam) { | |||
| static SINT32 app_file_transfer(SF_FN_PARAM_S *pfnParam) { | ||||
|   SINT32 s32ret = 0; | ||||
|   static int DailyreportSendFlag = 0; | ||||
|     static int PicUpDailyReportFlag = 0; | ||||
| 
 | ||||
|   // SF_MESSAGE_BUF_S stMessageBuf = {0};
 | ||||
|   // UIMenuStoreInfo *pCustomerParam = pfnParam->pstParam;
 | ||||
|   // SF_PDT_PARAM_STATISTICS_S *pStaticParam = pfnParam->pstaticParam;
 | ||||
|  | @ -1189,8 +1205,22 @@ static SINT32 app_file_transfer(SF_FN_PARAM_S *pfnParam) { | |||
|     if(sf_get_send_gps_txt()){ | ||||
|         s32ret = sf_gps_send_ftp(); | ||||
|     } | ||||
| 
 | ||||
|     if((!PicUpDailyReportFlag) && (pCustomerParam->PicUpDailyReport)) | ||||
|     { | ||||
|         PicUpDailyReportFlag = 1; | ||||
|         sf_sms_set_pic(1); | ||||
|         sf_sleep_ms(200); | ||||
|         SLOGD("GpsSendFlag:%d\n", pCustomerParam->GpsSendFlag); | ||||
|         break; | ||||
|     } | ||||
| 
 | ||||
|     if (!DailyreportSendFlag)  | ||||
|     { | ||||
|         if ((sf_get_pic())  && (pCustomerParam->PicUpDailyReport)) { | ||||
|             s32ret = sf_send_file_to_ftp(1); | ||||
|             sf_sms_set_pic(0); | ||||
|         } | ||||
|         DailyreportSendFlag = 1; | ||||
|         s32ret = sf_send_file_to_ftp(2); | ||||
|         if(pCustomerParam->SdFailCount) | ||||
|  | @ -1200,12 +1230,6 @@ static SINT32 app_file_transfer(SF_FN_PARAM_S *pfnParam) { | |||
|             sf_sleep_ms(200); | ||||
|         } | ||||
|         //pCustomerParam->GpsSendFlag = 0;
 | ||||
|         if(pCustomerParam->PicUpDailyReport){ | ||||
|             sf_sms_set_pic(1); | ||||
|             sf_sleep_ms(200); | ||||
|             SLOGD("GpsSendFlag:%d\n", pCustomerParam->GpsSendFlag); | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     if (sf_get_pic()) { | ||||
|  | @ -2054,13 +2078,20 @@ SINT32 sf_app_to_cardv_hd_ture(void) { | |||
|     SINT32 s32ret = SF_FAILURE; | ||||
| 	MLOGI(" falg:%d\n",falg); | ||||
| 
 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 	    return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
|     char sendHDName[64] = {0};  | ||||
|     if(falg) | ||||
|     { | ||||
|         return falg; | ||||
|     } | ||||
|     falg = 1; | ||||
| 	snprintf(sendHDName, sizeof(sendHDName), "%s", SF_HD_DIR); | ||||
| 	snprintf(sendHDName, sizeof(sendHDName), "%s%s", strg_path, SF_HD_DIR); | ||||
| 
 | ||||
| 	if(sf_file_IsExsit((CHAR *)sendHDName) != SF_TRUE) | ||||
|     { | ||||
|  |  | |||
|  | @ -1623,8 +1623,14 @@ void* sf_app_mcu_updata_thread(void *arg) | |||
|     MLOGI("MCU_UPGRADE\n"); | ||||
|     UINT32 McuFsize = 0; | ||||
|     SINT8 ret = 0; | ||||
|     ret = Fw_GetFirmwareSize((char*)"/mnt/sd/Mupgrade.bin", &McuFsize); | ||||
|     if((sf_in_card_exist() == SF_TRUE) && (access("/mnt/sd/Mupgrade.bin", F_OK) == 0) | ||||
| 
 | ||||
| 	char *file_path = sf_root_path_strcat(UPGRADE_FIRMWARE_NANE); | ||||
| 	if(file_path == NULL) | ||||
| 	{ | ||||
| 		return NULL; | ||||
| 	} | ||||
|     ret = Fw_GetFirmwareSize(file_path, &McuFsize); | ||||
|     if((sf_in_card_exist() == SF_TRUE) && (access(file_path, F_OK) == 0) | ||||
|     && (ret == 0) && (McuFsize > 1024) && (sf_is_enough_power_to_update() == SF_TRUE)) | ||||
|     { | ||||
|         sf_set_mcu_update_flag(SF_TRUE); | ||||
|  | @ -1660,4 +1666,4 @@ SINT32 sf_app_mcu_updata_start(void) | |||
| 	} | ||||
| 	return SF_SUCCESS; | ||||
| 
 | ||||
| } | ||||
| } | ||||
|  |  | |||
|  | @ -411,6 +411,7 @@ UINT32 sf_battery_adc_value_get_once(void) | |||
| 			printf("[sf_battery_level_polling]is lith battery\n"); | ||||
| 			if(SF_BATT_LI_PACK != puiPara->BatteryType) | ||||
| 			{ | ||||
|                 puiPara->LiBatteryType = puiPara->BatteryType; | ||||
| 				puiPara->BatteryType = SF_BATT_LI_PACK; | ||||
| 				 | ||||
| 			} | ||||
|  | @ -420,7 +421,7 @@ UINT32 sf_battery_adc_value_get_once(void) | |||
| 		{	first_init--; | ||||
| 			if (puiPara->BatteryType == SF_BATT_LI_PACK) | ||||
| 			{ | ||||
| 				puiPara->BatteryType = SF_BATT_ALKALINE; | ||||
|                 puiPara->BatteryType = puiPara->LiBatteryType == SF_BATT_LI_PACK ?SF_BATT_ALKALINE:puiPara->LiBatteryType; | ||||
| 			} | ||||
| 			 | ||||
| 		} | ||||
|  | @ -901,15 +902,15 @@ void sf_battery_level_polling(void) | |||
| 			readBatCnt++; | ||||
|             if(puiPara->BatteryLogSwitch) | ||||
|             { | ||||
|                 printf("\nDC Adc:%d After Convert:(%d.%dV),Is Dc In=%s, TemperAdc:%d \n", sf_battery_convert_to_adc(24, 100, DcVoltageVal), DcVoltageVal / 10, DcVoltageVal % 10, IsPowerDcIn == 1? "Yes" : "No", TemperAdc); | ||||
|                 printf("\nDC Adc:%d After Convert:(%d.%dV),Is Dc In=%s, TemperAdc:%d \n", sf_battery_convert_to_adc(24, 100, _DcVoltageVal), _DcVoltageVal / 10, _DcVoltageVal % 10, IsPowerDcIn == 1? "Yes" : "No", TemperAdc); | ||||
| 
 | ||||
|                 if(LiPolymerVoltageVal) | ||||
|                 if(_LiPolymerVoltageVal) | ||||
|                 { | ||||
|                     printf("Li Battery Adc:%d After Convert:(%d.%dV)\n\n", sf_battery_convert_to_adc(24, 100, LiPolymerVoltageVal), LiPolymerVoltageVal / 10, LiPolymerVoltageVal % 10); | ||||
|                     printf("Li Battery Adc:%d After Convert:(%d.%dV)\n\n", sf_battery_convert_to_adc(24, 100, _LiPolymerVoltageVal), _LiPolymerVoltageVal / 10, _LiPolymerVoltageVal % 10); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     printf("Other Battery Adc:%d After Convert:(%d.%dV)\n\n", sf_aa_battery_convert_to_adc(24, 100, BatVoltageVal),BatVoltageVal / 10, BatVoltageVal % 10); | ||||
|                     printf("Other Battery Adc:%d After Convert:(%d.%dV)\n\n", sf_aa_battery_convert_to_adc(24, 100, _BatVoltageVal),_BatVoltageVal / 10, _BatVoltageVal % 10); | ||||
|                 } | ||||
|             } | ||||
| 			if(readBatCnt >= 10) | ||||
|  | @ -969,16 +970,17 @@ void sf_battery_level_polling(void) | |||
| 		printf("[sf_battery_level_polling]is lith battery\n"); | ||||
|         if(SF_BATT_LI_PACK != puiPara->BatteryType) | ||||
|         { | ||||
|             puiPara->LiBatteryType = puiPara->BatteryType; | ||||
|             puiPara->BatteryType = SF_BATT_LI_PACK; | ||||
|         } | ||||
|     } | ||||
| 	else{ | ||||
| 		if(puiPara->BatteryType == SF_BATT_LI_PACK) | ||||
| 		{ | ||||
| 			puiPara->BatteryType = SF_BATT_ALKALINE; | ||||
| 		} | ||||
| 		 | ||||
| 	} | ||||
|     else{ | ||||
|         if(puiPara->BatteryType == SF_BATT_LI_PACK) | ||||
|         { | ||||
|             puiPara->BatteryType = puiPara->LiBatteryType == SF_BATT_LI_PACK ?SF_BATT_ALKALINE:puiPara->LiBatteryType; | ||||
|         } | ||||
|          | ||||
|     } | ||||
| 	 | ||||
| 	//ret = sf_check_low_battery();
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -942,18 +942,25 @@ UINT32 sf_create_dailyreport_file(void) | |||
|     char imageSize = 0; | ||||
|     char videoSize = 0; | ||||
|     /*Avoid New Card*/ | ||||
| 	char *thumb_dir = sf_root_path_strcat(SF_THUMB_DIR); | ||||
| 	if(thumb_dir == NULL) | ||||
| 	{ | ||||
| 		free(thumb_dir); | ||||
| 	    return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
|     if (access(SF_THUMB_DIR, F_OK) == -1) { | ||||
|         printf("%s directory does not exist. Creating...\n", SF_THUMB_DIR); | ||||
|     if (access(thumb_dir, F_OK) == -1) { | ||||
|         printf("%s directory does not exist. Creating...\n", thumb_dir); | ||||
| 
 | ||||
|         if (mkdir(SF_THUMB_DIR, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) { | ||||
|         if (mkdir(thumb_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) { | ||||
|             perror("mkdir() error"); | ||||
|         } else { | ||||
|             printf("%s directory created.\n", SF_THUMB_DIR); | ||||
|             printf("%s directory created.\n", thumb_dir); | ||||
|         } | ||||
|     } else { | ||||
|         printf("%s directory exists.\n", SF_THUMB_DIR); | ||||
|         printf("%s directory exists.\n", thumb_dir); | ||||
|     } | ||||
| 	free(thumb_dir); | ||||
|     //sf_create_thumb_dir();
 | ||||
| 
 | ||||
|     if(SF_CAMID_ON == pPara->CamNameSwitch) | ||||
|  | @ -1280,14 +1287,20 @@ UINT32 sf_create_dailyreport_file(void) | |||
|     printf("szTmp2=%s\n",szTmp2); | ||||
|     printf("cfgTmp:%s\n", cfgTmp); | ||||
| 
 | ||||
|     if(sf_file_IsExsit(SF_DAILYREPORT_FILENAME) == SF_TRUE){ | ||||
|         sf_file_remove(SF_DAILYREPORT_FILENAME); | ||||
| 	char *dailyrp_file = sf_root_path_strcat(SF_DAILYREPORT_FILENAME); | ||||
| 	if(dailyrp_file == NULL) | ||||
| 	{ | ||||
| 		  free(dailyrp_file); | ||||
| 		  return SF_FAILURE; | ||||
| 	} | ||||
|     if(sf_file_IsExsit(dailyrp_file) == SF_TRUE){ | ||||
|         sf_file_remove(dailyrp_file); | ||||
|     } | ||||
| 
 | ||||
|     fd = open(SF_DAILYREPORT_FILENAME, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); | ||||
| 
 | ||||
|     fd = open(dailyrp_file, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); | ||||
|     if(fd) | ||||
|     { | ||||
|     	free(dailyrp_file); | ||||
|         szTmpsize=SF_STRLEN(szTmp); | ||||
|         //printf("szTmpsize=%d\n",szTmpsize);
 | ||||
|         write(fd, szTmp, szTmpsize); | ||||
|  | @ -1298,12 +1311,18 @@ UINT32 sf_create_dailyreport_file(void) | |||
|         //printf("szTmpsize=%d\n",szTmpsize);
 | ||||
|         write(fd, szTmp2, szTmpsize); | ||||
| 
 | ||||
| 
 | ||||
|         if(sf_file_IsExsit(SF_ERROR_CODE) == SF_TRUE){ | ||||
|             size = sf_get_file_size((UINT8 *)SF_ERROR_CODE); | ||||
|             fd1 = open(SF_ERROR_CODE, O_RDONLY, S_IRUSR | S_IWUSR); | ||||
| 		char *err_code_path = sf_root_path_strcat(SF_ERROR_CODE); | ||||
| 		if(err_code_path == NULL) | ||||
| 		{ | ||||
| 		   free(err_code_path); | ||||
| 		   return SF_FAILURE; | ||||
| 		} | ||||
|         if(sf_file_IsExsit(err_code_path) == SF_TRUE){ | ||||
|             size = sf_get_file_size((UINT8 *)err_code_path); | ||||
|             fd1 = open(err_code_path, O_RDONLY, S_IRUSR | S_IWUSR); | ||||
|             if(fd1) | ||||
|             { | ||||
|             	free(err_code_path); | ||||
|                 //size = sp5kFsFileSizeGet(fd1);
 | ||||
|                 buf = malloc(size); | ||||
| 
 | ||||
|  | @ -1327,7 +1346,7 @@ UINT32 sf_create_dailyreport_file(void) | |||
|         ret = SUCCESS; | ||||
|         close(fd); | ||||
|     } | ||||
| 
 | ||||
| 	 | ||||
|     return ret; | ||||
| } | ||||
| 
 | ||||
|  | @ -1356,30 +1375,44 @@ UINT32 sf_create_low_power_warn_file(void) | |||
| 	 	printf("battery val > 20,no need to send\n"); | ||||
| 	 	return ret; | ||||
| 	 } | ||||
| 
 | ||||
| 	char *thumb_dir = sf_root_path_strcat(SF_THUMB_DIR); | ||||
| 	if(thumb_dir == NULL) | ||||
| 	{ | ||||
| 		free(thumb_dir); | ||||
| 	    return SF_FAILURE; | ||||
| 	} | ||||
| 	  | ||||
|     /*Avoid New Card*/ | ||||
| 
 | ||||
|     if (access(SF_THUMB_DIR, F_OK) == -1) { | ||||
|         printf("%s directory does not exist. Creating...\n", SF_THUMB_DIR); | ||||
|     if (access(thumb_dir, F_OK) == -1) { | ||||
|         printf("%s directory does not exist. Creating...\n", thumb_dir); | ||||
| 
 | ||||
|         if (mkdir(SF_THUMB_DIR, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) { | ||||
|         if (mkdir(thumb_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) { | ||||
|             //perror("mkdir() error");
 | ||||
|         } else { | ||||
|             printf("%s directory created.\n", SF_THUMB_DIR); | ||||
|             printf("%s directory created.\n", thumb_dir); | ||||
|         } | ||||
|     } else { | ||||
|         printf("%s directory exists.\n", SF_THUMB_DIR); | ||||
|         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); | ||||
|     } | ||||
| 
 | ||||
|     if(sf_file_IsExsit(SF_LOW_POWER_WARN_FILENAME) == SF_TRUE){ | ||||
|         sf_file_remove(SF_LOW_POWER_WARN_FILENAME); | ||||
|     } | ||||
| 
 | ||||
|     fd = open(SF_LOW_POWER_WARN_FILENAME, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); | ||||
|     fd = open(lp_path, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); | ||||
| 
 | ||||
|     if(!fd) | ||||
|     { | ||||
|         fd = open(SF_LOW_POWER_WARN_FILENAME, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); | ||||
|         fd = open(lp_path, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); | ||||
|     } | ||||
| 
 | ||||
|     if(fd) | ||||
|  | @ -1409,7 +1442,7 @@ UINT32 sf_create_low_power_warn_file(void) | |||
| 		if(ret <0) | ||||
| 		{ | ||||
| 			close(fd); | ||||
| 			sf_file_remove(SF_LOW_POWER_WARN_FILENAME); | ||||
| 			sf_file_remove(lp_path); | ||||
| 			printf("write low power warn file failed!,ret:%d\n",ret); | ||||
| 			ret = FAIL; | ||||
| 		} | ||||
|  | @ -1420,7 +1453,7 @@ UINT32 sf_create_low_power_warn_file(void) | |||
| 			ret = SUCCESS; | ||||
| 		} | ||||
|     } | ||||
| 
 | ||||
| 	free(lp_path); | ||||
|     return ret; | ||||
| } | ||||
| 
 | ||||
|  | @ -1452,7 +1485,15 @@ BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname) | |||
|     struct dirent *ptr = NULL; | ||||
| 
 | ||||
|     UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); | ||||
|     if ((dirp=opendir((char *)SF_SD_ROOT)) != NULL) | ||||
| 
 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return FALSE; | ||||
| 	} | ||||
| 	 | ||||
|     if ((dirp=opendir((char *)strg_path)) != NULL) | ||||
| 	{ | ||||
|         while ((ptr=readdir(dirp)) != NULL) | ||||
|         { | ||||
|  | @ -1462,7 +1503,7 @@ BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname) | |||
|             { | ||||
|                 if(SF_STRNCMP(ptr->d_name, puiPara->ModuleVer, 6) == 0) | ||||
|                 { | ||||
|                     SF_SPRINTF(updateFname, "%s%s", SF_SD_ROOT, ptr->d_name); | ||||
|                     SF_SPRINTF(updateFname, "%s%s", strg_path, ptr->d_name); | ||||
|                     closedir(dirp); | ||||
|                     printf("[%s:%d] updateFname:%s\n", __FUNCTION__, __LINE__, updateFname); | ||||
|                     return TRUE; | ||||
|  | @ -1475,7 +1516,7 @@ BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname) | |||
|         } | ||||
|     } | ||||
|     closedir(dirp); | ||||
| 
 | ||||
| 	free(strg_path); | ||||
| 	printf("no update file\n"); | ||||
| 	return FALSE; | ||||
| } | ||||
|  | @ -1502,13 +1543,20 @@ UINT8 sf_get_send_file_list(char *sendfileList, UINT8 *fileTotal) | |||
|     char *pFileHasSend = NULL; | ||||
|     UINT32 fileOffset = 0; | ||||
| 
 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 	   	return FAIL; | ||||
| 	} | ||||
| 
 | ||||
| 	if(0 == pPara->SendType){ | ||||
| 		snprintf(sendListName, sizeof(sendListName), "%s", SF_THUMB_SEND_AUTO); | ||||
| 		snprintf(sendListName, sizeof(sendListName), "%s%s", strg_path, SF_THUMB_SEND_AUTO); | ||||
| 	}else { | ||||
| 	    snprintf(sendListName, sizeof(sendListName), "%s", SF_THUMB_SEND_LIST); | ||||
| 	    snprintf(sendListName, sizeof(sendListName), "%s%s", strg_path, SF_THUMB_SEND_LIST); | ||||
| 	} | ||||
| 	sf_file_size_get(sendListName, &fsize); | ||||
| 
 | ||||
| 	free(strg_path); | ||||
|     fd = fopen(sendListName,"r"); | ||||
|     if(fd == 0) | ||||
|     { | ||||
|  | @ -1593,6 +1641,13 @@ BOOL sf_check_auto_thumb_file(VOID) | |||
|     printf("%s:%d s\n", __FUNCTION__, __LINE__); | ||||
|      | ||||
|     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(); | ||||
| 	if(0 == puiPara->SendType){ | ||||
|  | @ -1613,14 +1668,16 @@ BOOL sf_check_auto_thumb_file(VOID) | |||
| 					fileCfg->stfileattr[fileIndex].enFileTye = SF_FILE_TYPE_PIC_SMALL; | ||||
| 				} | ||||
| 				snprintf(fileCfg->stfileattr[fileIndex].thumbfileName, sizeof(fileCfg->stfileattr[fileIndex].thumbfileName), "%s", &SendFileList[fileIndex][1]); | ||||
| 				snprintf(fileCfg->stfileattr[fileIndex].thumbfilePath, sizeof(fileCfg->stfileattr[fileIndex].thumbfilePath), "%s%s", SF_SEND_LIST_DIR, &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); | ||||
| 				snprintf(fileCfg->stfileattr[fileIndex].thumbfilePath, sizeof(fileCfg->stfileattr[fileIndex].thumbfilePath), "%s%s%s", strg_path, SF_SEND_LIST_DIR,  | ||||
| 					&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); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|     printf("%s:%d e \n", __FUNCTION__, __LINE__); | ||||
| 
 | ||||
| 	free(strg_path); | ||||
|     return ret; | ||||
| } | ||||
| 
 | ||||
|  | @ -1892,10 +1949,16 @@ UINT8 sf_save_sd_log(void) | |||
| void sf_log_error_code(char* buff) | ||||
| { | ||||
|     UINT32 fd = 0; | ||||
| 
 | ||||
| 	char *file_path = sf_root_path_strcat(SF_ERROR_CODE); | ||||
| 	if(file_path == NULL) | ||||
| 	{ | ||||
| 		free(file_path); | ||||
| 	    return; | ||||
| 	} | ||||
| 		 | ||||
|     if(sf_in_card_exist()) | ||||
|     { | ||||
|         fd = open(SF_ERROR_CODE, O_WRONLY | O_CREAT); | ||||
|         fd = open(file_path, O_WRONLY | O_CREAT); | ||||
|         if(fd) | ||||
|         { | ||||
|             lseek(fd, 0, SEEK_END); | ||||
|  | @ -1904,6 +1967,7 @@ void sf_log_error_code(char* buff) | |||
|             system("sync"); | ||||
|         } | ||||
|     } | ||||
| 	free(file_path); | ||||
| } | ||||
| #ifdef __cplusplus | ||||
| #if __cplusplus | ||||
|  |  | |||
|  | @ -14,6 +14,8 @@ | |||
| #include "sf_fileMng.h" | ||||
| #include "sf_common.h" | ||||
| #include "sf_battery.h" | ||||
| #include "sf_storeMng.h" | ||||
| 
 | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| #if __cplusplus | ||||
|  | @ -310,7 +312,13 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SUBSCRIBE_ATTR_S | |||
| 	memset(pstfileAttr->txtfileName, '\0', sizeof(pstfileAttr->txtfileName)); | ||||
| 	memset(pstfileAttr->txtfilePath, '\0', sizeof(pstfileAttr->txtfilePath)); | ||||
| 
 | ||||
| 	 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
| 	switch(pSubscribe->subscribeType) | ||||
| 	{ | ||||
| 		case SF_SUBSCRIBE_VIDEO: | ||||
|  | @ -323,7 +331,7 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SUBSCRIBE_ATTR_S | |||
| 			MLOGD("FileName:%s, fileKey:%d\n", fileName, fileKey); | ||||
| 			for(int i=0; i<SF_VIDEO_LOOP_NUM;i++) | ||||
| 			{ | ||||
| 				sprintf(filePath, "%s%s", SF_4G_SMALL_VIDEO_STREAM_PATH,fileName ); | ||||
| 				sprintf(filePath, "%s%s%s", strg_path, SF_4G_SMALL_VIDEO_STREAM_PATH,fileName ); | ||||
| 				MLOGD("srcFile:%s\n", filePath); | ||||
| 				pstfileAttr->enFileTye = SF_FILE_TYPE_VIDEO; | ||||
| 				ret = sf_file_IsExsit((CHAR*)filePath); | ||||
|  | @ -345,7 +353,7 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SUBSCRIBE_ATTR_S | |||
| 			strncpy(fileName, pSubscribe->subscribeFileName + (strlen(pSubscribe->subscribeFileName) - 12), 12); | ||||
| 			fileKey = atoi(fileName+4); | ||||
| 			MLOGD("FileName:%s, fileKey:%d\n", fileName, fileKey); | ||||
| 			sprintf(filePath, "%s%s/%03d%s/%s%s", SF_SD_ROOT, SF_DCF_ROOT_DIR_NAME,dirKey, SF_DCF_DIR_NAME_SUFFIX, SF_DCF_FILE_NAME_PREFIX,fileName+4); | ||||
| 			sprintf(filePath, "%s%s/%03d%s/%s%s", strg_path, SF_DCF_ROOT_DIR_NAME,dirKey, SF_DCF_DIR_NAME_SUFFIX, SF_DCF_FILE_NAME_PREFIX,fileName+4); | ||||
| 			MLOGD("srcFile:%s\n", filePath); | ||||
| 
 | ||||
| 			ret = sf_file_IsExsit((CHAR*)filePath); | ||||
|  | @ -359,7 +367,7 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SUBSCRIBE_ATTR_S | |||
| 			} | ||||
| 			break; | ||||
| 		case SF_SUBSCRIBE_SPEC_FILE: | ||||
| 			sprintf(filePath, "%s%s", SF_SD_ROOT,"SF_GPS.TXT" ); | ||||
| 			sprintf(filePath, "%s%s", strg_path,"SF_GPS.TXT" ); | ||||
| 			MLOGD("srcFile:%s\n", filePath); | ||||
| 
 | ||||
| 			ret = sf_file_IsExsit((CHAR*)filePath); | ||||
|  | @ -376,10 +384,10 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SUBSCRIBE_ATTR_S | |||
| 			MLOGE("CMD[%d] no process!!!\n",pSubscribe->subscribeType); | ||||
| 	} | ||||
| 	 | ||||
| 
 | ||||
| 	free(strg_path); | ||||
| 	if(ret != SF_TRUE) | ||||
| 		return SF_FILE_ERROR_NO_FILE; | ||||
| 
 | ||||
| 	 | ||||
| 	return SF_SUCCESS; | ||||
| 	 | ||||
| } | ||||
|  | @ -540,6 +548,12 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SEND_FILE_ATTR_S* | |||
| 	memset(pstfileAttr->txtfileName, '\0', sizeof(pstfileAttr->txtfileName)); | ||||
| 	memset(pstfileAttr->txtfilePath, '\0', sizeof(pstfileAttr->txtfilePath)); | ||||
| 
 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 	 | ||||
| 	switch(pSendFileAttr->enFileTye) | ||||
| 	{ | ||||
|  | @ -554,7 +568,7 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SEND_FILE_ATTR_S* | |||
| 			strncpy(fileName, pSendFileAttr->SubFileName + (strlen(pSendFileAttr->SubFileName) - 12), 12); | ||||
| 			fileKey = atoi(fileName+4); | ||||
| 			SLOGD("FileName:%s, fileKey:%d\n", fileName, fileKey); | ||||
| 			sprintf(filePath, "%s%s/%03d%s/%s%04d.%s", SF_SD_ROOT, SF_DCF_ROOT_DIR_NAME,dirKey, SF_DCF_DIR_NAME_SUFFIX, SF_DCF_FILE_NAME_PREFIX,fileKey,SF_DCF_EXT_MOV); | ||||
| 			sprintf(filePath, "%s%s/%03d%s/%s%04d.%s", strg_path, SF_DCF_ROOT_DIR_NAME,dirKey, SF_DCF_DIR_NAME_SUFFIX, SF_DCF_FILE_NAME_PREFIX,fileKey,SF_DCF_EXT_MOV); | ||||
| 			SLOGD("srcFile:%s\n", filePath); | ||||
| 			 | ||||
| //			strncpy(fileName, pSendFileAttr->SubFileName + (strlen(pSendFileAttr->SubFileName) - 11), 8);
 | ||||
|  | @ -583,7 +597,7 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SEND_FILE_ATTR_S* | |||
| 			strncpy(fileName, pSendFileAttr->SubFileName + (strlen(pSendFileAttr->SubFileName) - 12), 12); | ||||
| 			fileKey = atoi(fileName+4); | ||||
| 			SLOGD("FileName:%s, fileKey:%d\n", fileName, fileKey); | ||||
| 			sprintf(filePath, "%s%s/%03d%s/%s%s", SF_SD_ROOT, SF_DCF_ROOT_DIR_NAME,dirKey, SF_DCF_DIR_NAME_SUFFIX, SF_DCF_FILE_NAME_PREFIX,fileName+4); | ||||
| 			sprintf(filePath, "%s%s/%03d%s/%s%s", strg_path, SF_DCF_ROOT_DIR_NAME,dirKey, SF_DCF_DIR_NAME_SUFFIX, SF_DCF_FILE_NAME_PREFIX,fileName+4); | ||||
| 			SLOGD("srcFile:%s\n", filePath); | ||||
| 
 | ||||
| 			ret = sf_file_IsExsit((CHAR*)filePath); | ||||
|  | @ -601,7 +615,7 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SEND_FILE_ATTR_S* | |||
| 			break; | ||||
| 			 | ||||
| 		case SF_FILE_TYPE_LOG_ERROR: | ||||
| 			sprintf(filePath, "%s%s", SF_SD_ROOT,"SF_GPS.TXT" ); | ||||
| 			sprintf(filePath, "%s%s", strg_path,"SF_GPS.TXT" ); | ||||
| 			SLOGD("srcFile:%s\n", filePath); | ||||
| 
 | ||||
| 			ret = sf_file_IsExsit((CHAR*)filePath); | ||||
|  | @ -624,7 +638,7 @@ SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SEND_FILE_ATTR_S* | |||
| 			SLOGD("CMD[%d] no process!!!\n", pSendFileAttr->enFileTye); | ||||
| 	} | ||||
| 	 | ||||
| 
 | ||||
| 	free(strg_path); | ||||
| 	if(ret != SF_TRUE)  | ||||
| 		return SF_FILE_ERROR_NO_FILE; | ||||
| 		 | ||||
|  |  | |||
|  | @ -1282,15 +1282,22 @@ SINT32 sf_statistics_param_save(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam) | |||
| 	SINT32 ret = 0; | ||||
| 	UINT32 CheckSum = 0; | ||||
| 	SINT32 lenth = 0; | ||||
| 
 | ||||
| 	char *file_path = sf_root_path_strcat(SIFAR_STATISTICS_PARAM_PATH); | ||||
| 	if(file_path == NULL) | ||||
| 	{ | ||||
| 		free(file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 		 | ||||
| 	lenth = sizeof(SF_PDT_PARAM_STATISTICS_S); | ||||
| 	 | ||||
| 	fd = open(SIFAR_STATISTICS_PARAM_PATH, O_CREAT|O_RDWR, 0); | ||||
| 	fd = open(file_path, O_CREAT|O_RDWR, 0); | ||||
| 	if(fd < 0) { | ||||
| 		fd = open(SIFAR_STATISTICS_PARAM_PATH, O_CREAT|O_RDWR, 0);			/*open jpg file*/ | ||||
| 		fd = open(file_path, O_CREAT|O_RDWR, 0);			/*open jpg file*/ | ||||
| 		if(fd < 0) { | ||||
| 			MLOGE("errno = [%d,%s]\n",errno,strerror(errno)); | ||||
| 			SF_APPCOMM_CHECK_OPENFILE_RETURN(fd,SIFAR_STATISTICS_PARAM_PATH,SF_FAILURE); | ||||
| 			SF_APPCOMM_CHECK_OPENFILE_RETURN(fd,file_path,SF_FAILURE); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
|  | @ -1304,6 +1311,8 @@ SINT32 sf_statistics_param_save(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam) | |||
| 		MLOGE("save param failed!!!\n"); | ||||
| 	fsync(fd); | ||||
| 	close(fd); | ||||
| 
 | ||||
| 	free(file_path); | ||||
|     system("sync"); | ||||
| 	MLOGI("save e\n"); | ||||
| 	return SF_SUCCESS; | ||||
|  | @ -1320,7 +1329,14 @@ SINT32 sf_statistics_param_load(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam) | |||
| 	SINT32 ret = SF_SUCCESS; | ||||
| 	static SINT32 loadFalg = 0; | ||||
| 	SF_PDT_PARAM_CFG_S *pSfCustomerPara = sf_customer_param_get(); | ||||
| 	 | ||||
| 
 | ||||
| 	char *file_path = sf_root_path_strcat(SIFAR_STATISTICS_PARAM_PATH); | ||||
| 	if(file_path == NULL) | ||||
| 	{ | ||||
| 		free(file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
| 	if(loadFalg) | ||||
| 		return SF_SUCCESS; | ||||
| 
 | ||||
|  | @ -1336,9 +1352,9 @@ SINT32 sf_statistics_param_load(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam) | |||
| 		MLOGI("FirstUpdateFlag = [%d],First start!!!,reset all param \n",pSfCustomerPara->FirstUpdateFlag); | ||||
| 		return SF_SUCCESS; | ||||
| 	} | ||||
| 	if(access((char*)SIFAR_STATISTICS_PARAM_PATH, F_OK) == 0) | ||||
| 	if(access((char*)file_path, F_OK) == 0) | ||||
| 	{ | ||||
| 		fd = open(SIFAR_STATISTICS_PARAM_PATH, O_RDWR); | ||||
| 		fd = open(file_path, O_RDWR); | ||||
| 		if(fd < 0) { | ||||
| 
 | ||||
| 			//SF_MESSAGE_BUF_S stMessageBuf = {0};
 | ||||
|  | @ -1346,10 +1362,10 @@ SINT32 sf_statistics_param_load(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam) | |||
| 			//stMessageBuf.arg1 = 0;
 | ||||
| 			//sf_com_message_send_to_cardv(&stMessageBuf);
 | ||||
| 			//usleep(500000);
 | ||||
| 			fd = open(SIFAR_STATISTICS_PARAM_PATH, O_RDWR);			/*open jpg file*/ | ||||
| 			fd = open(file_path, O_RDWR);			/*open jpg file*/ | ||||
| 			if(fd < 0) { | ||||
| 				MLOGE("errno = [%d,%s]\n",errno,strerror(errno)); | ||||
| 				SF_APPCOMM_CHECK_OPENFILE_RETURN(fd,SIFAR_STATISTICS_PARAM_PATH,SF_FAILURE); | ||||
| 				SF_APPCOMM_CHECK_OPENFILE_RETURN(fd,file_path,SF_FAILURE); | ||||
| 			} | ||||
| 		} | ||||
| 	 | ||||
|  | @ -1375,17 +1391,17 @@ SINT32 sf_statistics_param_load(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam) | |||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		fd = open(SIFAR_STATISTICS_PARAM_PATH, O_CREAT|O_RDWR, 0); | ||||
| 		fd = open(file_path, O_CREAT|O_RDWR, 0); | ||||
| 		if(fd < 0) { | ||||
| 			//SF_MESSAGE_BUF_S stMessageBuf = {0};
 | ||||
| 			//stMessageBuf.cmdId = 0x0113;
 | ||||
| 			///stMessageBuf.arg1 = 0;
 | ||||
| 			//sf_com_message_send_to_cardv(&stMessageBuf);
 | ||||
| 			//usleep(500000);
 | ||||
| 			fd = open(SIFAR_STATISTICS_PARAM_PATH, O_CREAT|O_RDWR, 0);			/*open jpg file*/ | ||||
| 			fd = open(file_path, O_CREAT|O_RDWR, 0);			/*open jpg file*/ | ||||
| 			if(fd < 0) { | ||||
| 				MLOGE("errno = [%d,%s]\n",errno,strerror(errno)); | ||||
| 				SF_APPCOMM_CHECK_OPENFILE_RETURN(fd,SIFAR_STATISTICS_PARAM_PATH,SF_FAILURE); | ||||
| 				SF_APPCOMM_CHECK_OPENFILE_RETURN(fd,file_path,SF_FAILURE); | ||||
| 			} | ||||
| 		} | ||||
| 		 | ||||
|  | @ -1406,7 +1422,7 @@ SINT32 sf_statistics_param_load(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam) | |||
| 	MLOGD("SendPicDayCnt::%d\n", pStatisticsParam->SendPicDayCnt); | ||||
| 	//if(strlen(pStatisticsParam->WebIP) < 1)
 | ||||
| 	//	sf_statistics_param_specify(pStatisticsParam);
 | ||||
| 	 | ||||
| 	free(file_path); | ||||
|     return SF_SUCCESS; | ||||
| } | ||||
| void sf_all_param_reset(void) | ||||
|  |  | |||
|  | @ -24,6 +24,7 @@ | |||
| #include "sf_base64.h" | ||||
| #include "sf_qrcode.h" | ||||
| #include "sf_4g_lpa.h" | ||||
| #include "sf_storeMng.h" | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| #if __cplusplus | ||||
|  | @ -33,6 +34,7 @@ extern "C" { | |||
| 
 | ||||
| 
 | ||||
| #define SIZE 6 | ||||
| #define QR_CODE_NAME 		"QR.BMP" | ||||
| 
 | ||||
| static void strConv(char *p) | ||||
| { | ||||
|  | @ -82,18 +84,29 @@ static int sf_qrcode_encode(char *intext, int length, char *outfile) | |||
| 
 | ||||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
| SINT16 sf_qrcode_create(SF_CHAR *pIMEI,SF_CHAR *pSimID ,SF_CHAR* pVersion) | ||||
| { | ||||
| 	SINT16 ret = SF_SUCCESS; | ||||
| 	SF_CHAR qrsrc_Str[160] = { 0 }; | ||||
| 	SF_CHAR qrdst_Str[160] = { 0 }; | ||||
| 	 | ||||
| 	char *file_path = sf_root_path_strcat(QR_CODE_NAME); | ||||
| 	if(file_path == NULL) | ||||
| 	{ | ||||
| 		free(file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 	 | ||||
| 	if(strlen(pIMEI) == 0 ) { | ||||
| 		SLOGE("the current IEMI is null!!!\n"); | ||||
| 		free(file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
| 	if(strlen(pVersion) == 0) { | ||||
| 		SLOGE("the current Version is null!!!\n"); | ||||
| 		free(file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| #if 0 | ||||
|  | @ -112,9 +125,9 @@ SINT16 sf_qrcode_create(SF_CHAR *pIMEI,SF_CHAR *pSimID ,SF_CHAR* pVersion) | |||
| 	sprintf(qrsrc_Str, "{\"imei\":\"%s\",\"verizonICCID\":\"%s\",\"attICCID\":\"%s\",\"isEsim\":%s}",  | ||||
| 			puiPara->ModuleImei, puiPara->SimIccidV, puiPara->SimIccidA, sf_is_esim_card() == 1 ? "true" : "false"); | ||||
| 	MLOGI("qrStr = %s\n",qrsrc_Str); | ||||
| 	sf_qrcode_encode(qrsrc_Str, strlen(qrsrc_Str), "/mnt/sd/QR.BMP"); | ||||
| 	sf_qrcode_encode(qrsrc_Str, strlen(qrsrc_Str), file_path); | ||||
| 	MLOGI("QR.BMP have existed \n"); | ||||
| 
 | ||||
| 	free(file_path); | ||||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -36,6 +36,32 @@ UINT32 gnFileIdx = 0; | |||
| UINT32 gnDirIdx = 0; | ||||
| 
 | ||||
| static SF_SD_STATUS_E SdStatus = SF_SD_BUTT; | ||||
| SF_STRG_DEV *sf_strg_dev = NULL; | ||||
| 
 | ||||
| void sf_strg_dev_init(void) | ||||
| { | ||||
| 	sf_strg_dev = (SF_STRG_DEV *)malloc(sizeof(SF_STRG_DEV)); | ||||
| 	sf_strg_dev->dev_type = MMC_DEV_NO; | ||||
| 	sf_strg_dev->moumted_state = MMC_DEV_MOUNT_STATE_NO; | ||||
| 	MLOGD("sf_app strg dev init success!\n"); | ||||
| } | ||||
| 
 | ||||
| void sf_strg_dev_uninit(void) | ||||
| { | ||||
| 	free(sf_strg_dev); | ||||
| 	sf_strg_dev = NULL; | ||||
| } | ||||
| 
 | ||||
| void sf_strg_dev_register(SINT32 dev_id, SINT32 mounted) | ||||
| { | ||||
| 	sf_strg_dev->dev_type = dev_id; | ||||
| 	sf_strg_dev->moumted_state = mounted; | ||||
| } | ||||
| 
 | ||||
| MMC_DEV_TYPE sf_get_strg_dev(void) | ||||
| { | ||||
| 	return sf_strg_dev->dev_type; | ||||
| } | ||||
| 
 | ||||
| static SINT32 sd_file_Isexsit(SF_CHAR *fileName) | ||||
| { | ||||
|  | @ -76,17 +102,70 @@ static SINT32 sd_Isdirempty(char *dirname) | |||
|     return SF_SUCCESS; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| char *sf_get_root_path(void) | ||||
| { | ||||
|     char *strg_path = NULL; | ||||
|     MMC_DEV_TYPE mmc_dev = MMC_DEV_NO; | ||||
| 
 | ||||
|     mmc_dev = sf_get_strg_dev(); | ||||
|     if (mmc_dev == MMC_DEV_NO) | ||||
|     { | ||||
|     	MLOGE("get strg dev no!\n"); | ||||
|         return NULL; | ||||
|     } | ||||
| 
 | ||||
|     if (mmc_dev == MMC_DEV_SD) | ||||
|     { | ||||
|         strg_path = (char *)malloc(strlen(SF_SD_ROOT) + 1); | ||||
|         strcpy(strg_path, SF_SD_ROOT); | ||||
|     } | ||||
|     else if (mmc_dev == MMC_DEV_EMMC) | ||||
|     { | ||||
|         strg_path = (char *)malloc(strlen(SF_EMMC_ROOT) + 1); | ||||
|         strcpy(strg_path, SF_EMMC_ROOT); | ||||
|     } | ||||
| 	MLOGD("strg_path: %s\n", strg_path); | ||||
|     return strg_path; | ||||
| } | ||||
| 
 | ||||
| char *sf_root_path_strcat(char *path_name) | ||||
| { | ||||
|     char *tmp = NULL; | ||||
|     char *strg_path = sf_get_root_path(); | ||||
|     if (strg_path == NULL) | ||||
|     { | ||||
|     	free(strg_path); | ||||
|         return NULL; | ||||
|     } | ||||
| 
 | ||||
|     tmp = (char *)malloc(strlen(strg_path) + strlen(path_name) + 1); | ||||
|     strcpy(tmp, strg_path); | ||||
|     strcat(tmp, path_name); | ||||
| 
 | ||||
|     free(strg_path); // 释放内存
 | ||||
|     MLOGD("root path: %s\n", tmp); | ||||
|     return tmp; | ||||
| } | ||||
| 
 | ||||
| SINT32 sf_sd_info_get(SF_STORE_ATTR_S *pstoreattrs) | ||||
| { | ||||
| 	SF_COMM_CHECK_POINTER(pstoreattrs,SF_FAILURE); | ||||
| 	 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
| 	SINT32 fd = -1; | ||||
|     fd = open(SF_SD_ROOT, O_RDONLY,0); | ||||
|     fd = open(strg_path, O_RDONLY,0); | ||||
|     if(fd >= 0) | ||||
|     { | ||||
|         struct statfs diskInfo; | ||||
|         statfs(SF_SD_ROOT, &diskInfo); | ||||
| 
 | ||||
|         statfs(strg_path, &diskInfo); | ||||
| 		free(strg_path); | ||||
|         if(diskInfo.f_bsize > 1024) | ||||
|         { | ||||
|             pstoreattrs->SDTotalSize = (diskInfo.f_blocks * (diskInfo.f_bsize >> 10)) >> 10 ; //blocks * 4096 / 1024 /1024 = MB
 | ||||
|  | @ -409,16 +488,26 @@ SINT32 sf_sd_status_set(SF_SD_STATUS_E enStatus) | |||
| UINT32 sf_delete_send_flie_list(void) | ||||
| { | ||||
|     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 1; | ||||
| 	} | ||||
| 	 | ||||
|     if(0 == puiPara->SendType){ | ||||
|         if(sf_file_IsExsit(SF_THUMB_SEND_AUTO) == SF_TRUE) | ||||
|             sf_file_remove(SF_THUMB_SEND_AUTO); | ||||
| 		snprintf(tmp, sizeof(tmp), "%s%s", strg_path, SF_THUMB_SEND_AUTO); | ||||
|         if(sf_file_IsExsit(tmp) == SF_TRUE) | ||||
|             sf_file_remove(tmp); | ||||
|     } | ||||
|     else{ | ||||
| 		snprintf(tmp, sizeof(tmp), "%s%s", strg_path, SF_THUMB_SEND_LIST); | ||||
|         printf("delete %s\n", SF_SEND_LIST_DIR); | ||||
|         if(sf_file_IsExsit(SF_THUMB_SEND_LIST) == SF_TRUE) | ||||
|             sf_file_remove(SF_THUMB_SEND_LIST); | ||||
|         if(sf_file_IsExsit(tmp) == SF_TRUE) | ||||
|             sf_file_remove(tmp); | ||||
|     } | ||||
| 
 | ||||
| 	free(strg_path); | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
|  | @ -704,9 +793,16 @@ int sf_dcf_resort_min(void) | |||
|     char sTmp[SF_DCF_FILENAME_LEN_MAX] = {0}; | ||||
|     int nmax_dirkey = 0; | ||||
|     int nmin_dirkey = 0; | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
|     strcpy(sRootPath, SF_SD_ROOT); // "/mnt/sd/"
 | ||||
|     strcpy(sRootPath, strg_path); // "/mnt/sd/"
 | ||||
|     strcat(sRootPath, SF_DCF_ROOT_DIR_NAME); // ""/mnt/sd/DCIM/"
 | ||||
|     free(strg_path); | ||||
| 
 | ||||
|     trave_dir(sRootPath,0); | ||||
| 	MLOGD("gnDirIdx:%d,gDirList:%d\n", gnDirIdx, gnDirList[gnDirIdx-1]); | ||||
|  | @ -776,10 +872,16 @@ int sf_app_sd_loop(void) | |||
|     nFileKey = gLastFileKey; | ||||
| 
 | ||||
| 	MLOGD(" s\n"); | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
|     while((nloop) && (dircount < 5)) | ||||
|     { | ||||
|         sprintf(cPathTmp,"%s%s/%03d%s", SF_SD_ROOT, SF_DCF_ROOT_DIR_NAME, nDirKey, DCF_DIR_NAME); // ""/mnt/sd/DCIM/100MEDIA"
 | ||||
|         sprintf(cPathTmp,"%s%s/%03d%s", strg_path, SF_DCF_ROOT_DIR_NAME, nDirKey, DCF_DIR_NAME); // ""/mnt/sd/DCIM/100MEDIA"
 | ||||
|         //Not Empty,Record File Name
 | ||||
|         sprintf(cFileTmp, "%s/%s%04d.%s",cPathTmp, DCF_FILE_NAME, nFileKey, SF_DCF_EXT_PHOTO); | ||||
| 
 | ||||
|  | @ -817,7 +919,7 @@ int sf_app_sd_loop(void) | |||
|             } | ||||
|         } | ||||
| 
 | ||||
|         sprintf(cFileTmp,"%s%s/W%03d%04d.JPG", SF_SD_ROOT, SF_DCF_THM_DIR_NAME, nDirKey, nFileKey); | ||||
|         sprintf(cFileTmp,"%s%s/W%03d%04d.JPG", strg_path, SF_DCF_THM_DIR_NAME, nDirKey, nFileKey); | ||||
|         //MLOGD("Thumb Filename:%s\n", cFileTmp);		
 | ||||
|         if(access(cFileTmp,R_OK) == 0) | ||||
|         { | ||||
|  | @ -825,7 +927,7 @@ int sf_app_sd_loop(void) | |||
|             remove(cFileTmp); | ||||
|         } | ||||
| 
 | ||||
|         sprintf(cFileTmp,"%s%s/S%03d%04d.JPG", SF_SD_ROOT, SF_DCF_THM_DIR_NAME, nDirKey, nFileKey); | ||||
|         sprintf(cFileTmp,"%s%s/S%03d%04d.JPG", strg_path, SF_DCF_THM_DIR_NAME, nDirKey, nFileKey); | ||||
|         //MLOGD("Thumb Filename:%s\n", cFileTmp);		
 | ||||
|         if(access(cFileTmp,R_OK) == 0) | ||||
|         { | ||||
|  | @ -871,7 +973,7 @@ int sf_app_sd_loop(void) | |||
|     } | ||||
|      | ||||
|     sync(); | ||||
| 
 | ||||
| 	free(strg_path); | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -37,6 +37,7 @@ | |||
| #include "sf_type.h" | ||||
| #include "sf_system.h" | ||||
| #include "sf_fileMng.h" | ||||
| #include "sf_storeMng.h" | ||||
| #ifdef __cplusplus | ||||
| #if __cplusplus | ||||
| extern "C" { | ||||
|  | @ -45,7 +46,6 @@ extern "C" { | |||
| 
 | ||||
| extern int gsfd; | ||||
| 
 | ||||
| #define UPGRADE_FIRMWARE_NANE  (char*)"/mnt/sd/Mupgrade.bin" | ||||
| #define UART_PATH "dev/ttyS2" | ||||
| 
 | ||||
| //unsigned char mcu_upgrade_buf[32] = {0};
 | ||||
|  | @ -340,6 +340,13 @@ static void * FwUpgradeTask(void * argv) | |||
| 	SINT8 param[1] = {0}; | ||||
| 	param[0] = 0; | ||||
| 
 | ||||
| 	char *file_path = sf_root_path_strcat(UPGRADE_FIRMWARE_NANE); | ||||
| 	if(file_path == NULL) | ||||
| 	{ | ||||
| 		free(file_path); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	while(FwUpgradeExit == 0) | ||||
| 	{ | ||||
| 		switch (FwUpgradeState) | ||||
|  | @ -351,7 +358,7 @@ static void * FwUpgradeTask(void * argv) | |||
| 				fw_packet.fw_total_size = 0; | ||||
| 				fw_packet.fw_remain_size = 0; | ||||
| 				fw_packet.fw_complete_size = 0; | ||||
| 				ret = Fw_GetFirmwareSize(UPGRADE_FIRMWARE_NANE, &fw_packet.fw_total_size); | ||||
| 				ret = Fw_GetFirmwareSize(file_path, &fw_packet.fw_total_size); | ||||
| 
 | ||||
| 				if(ret < 0) | ||||
| 				{ | ||||
|  | @ -368,7 +375,7 @@ static void * FwUpgradeTask(void * argv) | |||
| 					FwUpgradeState = FWUPGRADE_ERROR_OCCUR_STATE; | ||||
| 					break; | ||||
| 				} | ||||
| 				ret = Fw_GetFirmwareContent(UPGRADE_FIRMWARE_NANE, fw_packet.fw_content, fw_packet.fw_total_size); | ||||
| 				ret = Fw_GetFirmwareContent(file_path, fw_packet.fw_content, fw_packet.fw_total_size); | ||||
| 				fw_packet.fw_crc = sf_crc16_check(fw_packet.fw_content, fw_packet.fw_total_size); | ||||
| 				 | ||||
| 				if(sf_poweron_type_get() != 0x0f) /*at upgrade start mode already*/ | ||||
|  | @ -521,6 +528,7 @@ static void * FwUpgradeTask(void * argv) | |||
| 		 | ||||
| 		usleep(200000); | ||||
| 	} | ||||
| 	free(file_path); | ||||
| 	printf("ret is %d\r\n", ret); | ||||
| 	pthread_exit(NULL); | ||||
| 	 | ||||
|  |  | |||
|  | @ -451,15 +451,41 @@ SINT32 sf_upgrade_ota_init(void) | |||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 	MLOGI("filename = [%s]\n",stOtaAttrs.filename); | ||||
| 
 | ||||
| 	 | ||||
| 	char *upgrade_file_path = sf_root_path_strcat(SF_OTA_UPGRADE_FILE_PATH); | ||||
| 	if(upgrade_file_path == NULL) | ||||
| 	{ | ||||
| 		free(upgrade_file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
| 	char *cfg_file_path = sf_root_path_strcat(OTA_CFG_FILE_PATH); | ||||
| 	if(cfg_file_path == NULL) | ||||
| 	{ | ||||
| 		free(cfg_file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
| 	char *ota_file_path = sf_root_path_strcat(OTAFILE_PATH); | ||||
| 	if(ota_file_path == NULL) | ||||
| 	{ | ||||
| 		free(ota_file_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 	 | ||||
| 	if(upgrade_ota_file_IsExsit(SF_OTA_UPGRADE_FILE_PATH) == SF_TRUE) | ||||
| 		sf_file_remove(SF_OTA_UPGRADE_FILE_PATH); | ||||
| 	if(upgrade_ota_file_IsExsit(OTA_CFG_FILE_PATH) == SF_TRUE) | ||||
| 		sf_file_remove(OTA_CFG_FILE_PATH); | ||||
| 	if(upgrade_ota_file_IsExsit(OTAFILE_PATH) == SF_TRUE) | ||||
| 		sf_file_remove(OTAFILE_PATH); | ||||
| 	 | ||||
| 	if(upgrade_ota_file_IsExsit(upgrade_file_path) == SF_TRUE) { | ||||
| 		sf_file_remove(upgrade_file_path); | ||||
| 	} | ||||
| 	if(upgrade_ota_file_IsExsit(cfg_file_path) == SF_TRUE) { | ||||
| 		sf_file_remove(cfg_file_path);	 | ||||
| 	} | ||||
| 	if(upgrade_ota_file_IsExsit(ota_file_path) == SF_TRUE) { | ||||
| 		sf_file_remove(ota_file_path); | ||||
| 	} | ||||
| 	free(upgrade_file_path); | ||||
| 	free(cfg_file_path); | ||||
| 	free(ota_file_path); | ||||
| 	return SF_SUCCESS; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -159,11 +159,19 @@ void dataClientListPrint(void); | |||
| static S32 sf_get_sd_info(UINT32 *pSDStatus, UINT32 *pSDFree, UINT32 *pSDTotalSize) | ||||
| { | ||||
|     int fd = -1; | ||||
|     fd = open(SD_PATH, O_RDONLY,0); | ||||
| 	 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 	 | ||||
|     fd = open(strg_path, O_RDONLY,0); | ||||
|     if(fd >= 0) | ||||
|     { | ||||
|         struct statfs diskInfo; | ||||
|         statfs(SD_PATH, &diskInfo); | ||||
|         statfs(strg_path, &diskInfo); | ||||
|         /*printf("f_type=%ld\n", diskInfo.f_type);
 | ||||
|         printf("f_bsize=%ld\n", diskInfo.f_bsize); | ||||
|         printf("f_blocks=%ld\n", diskInfo.f_blocks); | ||||
|  | @ -204,7 +212,7 @@ static S32 sf_get_sd_info(UINT32 *pSDStatus, UINT32 *pSDFree, UINT32 *pSDTotalSi | |||
|     MLOGI("pSDStatus = %d\n", *pSDStatus); | ||||
|     MLOGI("pSDFree = %d MB\n", *pSDFree); | ||||
|     MLOGI("pSDTotalSize = %d MB\n", *pSDTotalSize); | ||||
| 
 | ||||
| 	free(strg_path); | ||||
|     return *pSDStatus; | ||||
| } | ||||
| #if 0 | ||||
|  | @ -415,23 +423,30 @@ S8 *appThumbKeyToName(thumbSize_t imgSize, thumbType_t fileType, UINT16 dirKey, | |||
|         } | ||||
|     } | ||||
| #endif | ||||
| 	 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
|     if(imgSize == THUMB_320x240) | ||||
|     { | ||||
|         sprintf((char *)tempPath, "%s/small", THUMB_PATH); | ||||
|         sprintf((char *)tempPath, "%s%s/small", strg_path, THUMB_PATH); | ||||
|         sprintf((char *)path, "%s/%03d", tempPath, dirKey); | ||||
|     } | ||||
|     else if(imgSize == THUMB_1280x960) | ||||
|     { | ||||
|         sprintf((char *)tempPath, "%s/middle", THUMB_PATH); | ||||
|         sprintf((char *)tempPath, "%s%s/middle", strg_path, THUMB_PATH); | ||||
|         sprintf((char *)path, "%s/%03d", tempPath, dirKey); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         sprintf((char *)tempPath, "%s/large", THUMB_PATH); | ||||
|         sprintf((char *)tempPath, "%s%s/large", strg_path, THUMB_PATH); | ||||
|         sprintf((char *)path, "%s/%03d", tempPath, dirKey); | ||||
|     } | ||||
| 
 | ||||
| 	free(strg_path); | ||||
|     /****check floder and creat it if that is not exist ***start****/ | ||||
| #if 0 | ||||
|     printf("Thumb key s"); | ||||
|  | @ -720,6 +735,13 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG | |||
| 
 | ||||
|     MLOGI("fileName:%s\n",fileName); | ||||
| 
 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
|     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); | ||||
|  | @ -739,8 +761,8 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG | |||
|     gDevFileListNums = 0; | ||||
|     //printf("get dir s\n");
 | ||||
|     //sprintf((char *)dirPath, "%s/", THUMB_PATH);
 | ||||
|     snprintf((char *)dirPath, sizeof(dirPath), "%s", (char *)THUMB_PATH); | ||||
| 
 | ||||
|     snprintf((char *)dirPath, sizeof(dirPath), "%s%s", strg_path, (char *)THUMB_PATH); | ||||
| 	free(strg_path); | ||||
|     appsvr_getFileList(dirPath, startFileKey); | ||||
| //    appsvr_getDirList(dirPath, startDirKey);
 | ||||
| 
 | ||||
|  | @ -817,6 +839,8 @@ void sf_app_Get_Camera_Info(MSG_DEV_INFO_Get_Rsp_T *camInfo) | |||
| { | ||||
|     UIMenuStoreInfo *puiPara = sf_ui_para_get(); | ||||
| 
 | ||||
| 	 | ||||
| 
 | ||||
|     MLOGI("camInfo:%x\n",camInfo->cmdRet); | ||||
|     //MLOGI("[sf_app_Get_Camera_Info],sf_get_sifar_param\n");
 | ||||
| 
 | ||||
|  | @ -1110,6 +1134,14 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8  *pAppData, UINT16 dataLen) | |||
| 	SF_MESSAGE_BUF_S stMessageBuf = {0}; | ||||
| //  HI_MESSAGE_S stMessage;
 | ||||
| 
 | ||||
| 	char *strg_path = sf_get_root_path(); | ||||
| 	if(strg_path == NULL) | ||||
| 	{ | ||||
| 		free(strg_path); | ||||
| 		return SF_FAILURE; | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
|     //printf("[sf_svr_packet_proc]dataLen: %d\n",dataLen);
 | ||||
| 
 | ||||
|     if(poweroff_mode == POWEROFF_COUNTDOWN) | ||||
|  | @ -1316,7 +1348,7 @@ 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/%s", strg_path, THUMB_PATH, tempbuf2, tempbuf); | ||||
|                         } | ||||
|                         else if(pMsgStruct->msgBuf.getHdFile.type == 1) //srouce file
 | ||||
|                         { | ||||
|  | @ -1324,7 +1356,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8  *pAppData, UINT16 dataLen) | |||
|                             strncpy((char *)tempbuf2, (char *)tempbuf, 3); | ||||
|                             tempbuf[8] = '\0'; | ||||
|                             sprintf((char *)gFileName, "%sDCIM/%s%s/%s%s%s", | ||||
|                                     SF_SD_ROOT, | ||||
|                                     strg_path, | ||||
|                                     tempbuf2, | ||||
|                                     DCF_DIR_NAME, | ||||
|                                     DCF_FILE_NAME, | ||||
|  | @ -1855,7 +1887,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%s", strg_path, THUMB_PATH,  tempbuf); | ||||
| 
 | ||||
|                             } | ||||
|                             else if(pMsgStruct->msgBuf.ctrlFileTransfer.type == 1) //srouce file
 | ||||
|  | @ -1865,7 +1897,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8  *pAppData, UINT16 dataLen) | |||
| 
 | ||||
|                                 tempbuf[8] = '\0'; | ||||
|                                 sprintf((char *)fileName, "%sDCIM/%s%s/%s%s%s", | ||||
|                                         SD_PATH, | ||||
|                                         strg_path, | ||||
|                                         tempbuf2, | ||||
|                                         DCF_DIR_NAME, | ||||
|                                         DCF_FILE_NAME, | ||||
|  | @ -1874,7 +1906,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8  *pAppData, UINT16 dataLen) | |||
|                             } | ||||
|                             else | ||||
|                             { | ||||
|                                 sprintf((char *)fileName, "%s%s",SF_SD_ROOT,pMsgStruct->msgBuf.ctrlFileTransfer.fileName); | ||||
|                                 sprintf((char *)fileName, "%s%s",strg_path,pMsgStruct->msgBuf.ctrlFileTransfer.fileName); | ||||
|                             } | ||||
|                             //MLOGI("rec file cmd:%s\n", fileName);
 | ||||
|                         } | ||||
|  | @ -2205,7 +2237,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8  *pAppData, UINT16 dataLen) | |||
|             printf("offset=%d\n",offset); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 	free(strg_path); | ||||
|     return ntohs(pMsgStruct->cmd); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -80,6 +80,7 @@ SRC = \ | |||
|     code/source/common/sf_sd_common.c \
 | ||||
| 	code/source/common/sf_common.c \
 | ||||
| 	code/source/common/sf_led.c \
 | ||||
| 	$(APP_DIR)/source/sf_app/code/source/storeMng/sf_storeMng.c \
 | ||||
| 	$(APP_DIR)/source/sf_app/code/source/logMng/sf_log.c \
 | ||||
| 	$(APP_DIR)/source/sf_app/code/source/qrcodeMng/sf_base64.c \
 | ||||
| 	$(APP_DIR)/source/sf_app/code/source/paramMng/sf_param_common.c \
 | ||||
|  |  | |||
|  | @ -580,6 +580,7 @@ typedef struct _UIMenuUIMenuStoreInfo { | |||
|     CHAR SimIccidV[21]; | ||||
| 	CHAR SimIccidA[21]; | ||||
|     UINT32 SdFailCount; | ||||
| 	CHAR LiBatteryType;/*Alkaline/NI-MH/LI*/ | ||||
| 
 | ||||
| 	UINT32 x1; | ||||
| 	UINT32 x2; | ||||
|  |  | |||
|  | @ -38,6 +38,7 @@ | |||
| #include "PrjCfg.h" | ||||
| #include "sf_battery.h" | ||||
| #include <IOCfg.h> | ||||
| #include <sf_sd_common.h> | ||||
| static UINT8 McuSubVersion = 0; | ||||
| static UINT16 McuVersion = 0; | ||||
| static UINT8 DailyReportStartMode = 0; | ||||
|  | @ -2172,6 +2173,20 @@ void sf_file_thumb_cfg_sava(void) | |||
|     INT32 ret_fs = 0; | ||||
|     FST_FILE_STATUS FileStat; | ||||
|     UIMenuStoreInfo *puiPara = sf_ui_para_get(); | ||||
| 	 | ||||
| #if USE_RTOS_MMC_CHECK	 | ||||
| 		SF_RTOS_ST_MMC_DEV *mmc_dev = SF_RtosStrgCheckWorkableDev(); | ||||
| 		if(mmc_dev ==NULL) | ||||
| 		{ | ||||
| 			DBG_ERR("No MMC_Dev Can use!\n"); | ||||
| 			return; | ||||
| 		} | ||||
| 		if(mmc_dev->dcf_handle < 0) | ||||
| 		{ | ||||
| 			DBG_ERR("dcf_handle err\n"); | ||||
| 			return; | ||||
| 		} | ||||
| #endif | ||||
| 
 | ||||
| 	if (pThumbFileCfg != NULL) { | ||||
| 
 | ||||
|  | @ -2185,8 +2200,19 @@ void sf_file_thumb_cfg_sava(void) | |||
|         char tmp[64] = {'\0'}; | ||||
|         INT32 uiStatus = 0; | ||||
|         UINT8  ucAttrib = 0; | ||||
|         snprintf(tmp, sizeof(tmp), "%c%s", 'A', PHOTO_THUMB_PATH); | ||||
|          | ||||
| #if USE_RTOS_MMC_CHECK | ||||
| 	if(mmc_dev->dev_type == MMC_DEV_SD) | ||||
| 	{ | ||||
| 		snprintf(tmp, sizeof(tmp), "%c%s", 'A', PHOTO_THUMB_PATH); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		snprintf(tmp, sizeof(tmp), "%c%s", 'B', PHOTO_THUMB_PATH); | ||||
| 	} | ||||
| #else | ||||
| 		snprintf(tmp, sizeof(tmp), "%c%s", 'A', PHOTO_THUMB_PATH); | ||||
| #endif | ||||
|        | ||||
|         uiStatus = FileSys_GetAttrib(tmp, &ucAttrib); | ||||
|         if (uiStatus == FST_STA_OK) { | ||||
|             if(!(ucAttrib&FST_ATTRIB_HIDDEN)){ | ||||
|  | @ -2195,8 +2221,10 @@ void sf_file_thumb_cfg_sava(void) | |||
|         } | ||||
|         #endif | ||||
| 
 | ||||
|         //printf("Add %s to send.List\n", sendfname);
 | ||||
|         if(0 == puiPara->SendType){ | ||||
| #if USE_RTOS_MMC_CHECK | ||||
| 	if(mmc_dev->dev_type == MMC_DEV_SD) | ||||
| 	{ | ||||
| 		if(0 == puiPara->SendType){ | ||||
|             snprintf(sendListName, sizeof(sendListName), "A%s", SF_THUMB_SEND_AUTO); | ||||
|             fs = FileSys_OpenFile(sendListName, FST_CREATE_ALWAYS | FST_OPEN_WRITE); | ||||
| 
 | ||||
|  | @ -2204,6 +2232,31 @@ void sf_file_thumb_cfg_sava(void) | |||
|             snprintf(sendListName, sizeof(sendListName), "A%s", SF_THUMB_SEND_LIST); | ||||
|             fs = FileSys_OpenFile(sendListName, FST_OPEN_ALWAYS | FST_OPEN_WRITE); | ||||
|         } | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		if(0 == puiPara->SendType){ | ||||
|             snprintf(sendListName, sizeof(sendListName), "B%s", SF_THUMB_SEND_AUTO); | ||||
|             fs = FileSys_OpenFile(sendListName, FST_CREATE_ALWAYS | FST_OPEN_WRITE); | ||||
| 
 | ||||
|         }else { | ||||
|             snprintf(sendListName, sizeof(sendListName), "B%s", SF_THUMB_SEND_LIST); | ||||
|             fs = FileSys_OpenFile(sendListName, FST_OPEN_ALWAYS | FST_OPEN_WRITE); | ||||
|         } | ||||
| 	} | ||||
| #else | ||||
| 		if(0 == puiPara->SendType){ | ||||
|             snprintf(sendListName, sizeof(sendListName), "A%s", SF_THUMB_SEND_AUTO); | ||||
|             fs = FileSys_OpenFile(sendListName, FST_CREATE_ALWAYS | FST_OPEN_WRITE); | ||||
| 
 | ||||
|         }else { | ||||
|             snprintf(sendListName, sizeof(sendListName), "A%s", SF_THUMB_SEND_LIST); | ||||
|             fs = FileSys_OpenFile(sendListName, FST_OPEN_ALWAYS | FST_OPEN_WRITE); | ||||
|         } | ||||
| #endif | ||||
| 
 | ||||
|         //printf("Add %s to send.List\n", sendfname);
 | ||||
| 
 | ||||
|          | ||||
|         /*if(access(sendListName, F_OK) == 0)
 | ||||
|         { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 xiaojiazhu
						xiaojiazhu