diff --git a/code/application/source/cardv/SrcCode/System/SysMain_Exe.c b/code/application/source/cardv/SrcCode/System/SysMain_Exe.c index f07d28870..217320011 100755 --- a/code/application/source/cardv/SrcCode/System/SysMain_Exe.c +++ b/code/application/source/cardv/SrcCode/System/SysMain_Exe.c @@ -23,7 +23,9 @@ #define __DBGFLT__ "*" //*=All, [mark]=CustomClass #include /////////////////////////////////////////////////////////////////////////////// - +#if HUNTING_CAMERA_MCU == ENABLE +#include "sf_mcu.h" +#endif extern VControl SystemObjCtrl; extern VControl UISetupObjCtrl; extern VControl *gUxCtrlTypeList[]; @@ -147,19 +149,25 @@ INT32 System_GetBootFirstMode(void) #if !UI_SENSOR #if HUNTING_CAMERA_MCU == ENABLE + UINT8 PowerOnMode = sf_cardv_convert_power_on_mode(); + printf("%s:%d CamMode :%d\n", __FUNCTION__, __LINE__,puiPara->CamMode); - if(SF_CAM_MODE_PHOTO == puiPara->CamMode) - { - return PRIMARY_MODE_PHOTO; - } - else if(SF_CAM_MODE_VIDEO == puiPara->CamMode) - { - return PRIMARY_MODE_MOVIE; - } - else - { - return PRIMARY_MODE_PHOTO;//PRIMARY_MODE_MOVIE; - } + if(PWR_ON_SETUP != PowerOnMode) + { + return PRIMARY_MODE_TRANSCODE; + } + else if(SF_CAM_MODE_PHOTO == puiPara->CamMode) + { + return PRIMARY_MODE_PHOTO; + } + else if(SF_CAM_MODE_VIDEO == puiPara->CamMode) + { + return PRIMARY_MODE_MOVIE; + } + else + { + return PRIMARY_MODE_PHOTO;//PRIMARY_MODE_MOVIE; + } #else printf("%s:%d CamMode :%d\n", __FUNCTION__, __LINE__,SysGetFlag(CamMode)); if(SF_CAM_MODE_PHOTO == SysGetFlag(CamMode)) diff --git a/code/application/source/cardv/SrcCode/System/SysUsb_Exe.c b/code/application/source/cardv/SrcCode/System/SysUsb_Exe.c index 96a878b99..aeab3f047 100755 --- a/code/application/source/cardv/SrcCode/System/SysUsb_Exe.c +++ b/code/application/source/cardv/SrcCode/System/SysUsb_Exe.c @@ -39,13 +39,14 @@ static char* usb_host_drivers[] = { "kernel/drivers/usb/host/ehci-hcd.ko", "kernel/drivers/net/mii.ko", "kernel/drivers/net/usb/usbnet.ko", + "extra/net/GobiNet/drv_gobi_net.ko", + "kernel/drivers/net/usb/cdc_ether.ko", + "kernel/drivers/net/usb/rndis_host.ko", "kernel/drivers/usb/serial/usbserial.ko", "kernel/drivers/usb/serial/usb_wwan.ko", "kernel/drivers/usb/serial/option.ko", - "kernel/drivers/net/usb/cdc_ether.ko", "kernel/drivers/usb/class/cdc-wdm.ko", "kernel/drivers/net/usb/qmi_wwan.ko", - "extra/net/GobiNet/drv_gobi_net.ko", NULL }; diff --git a/code/application/source/cardv/SrcCode/UIApp/Photo/UIAppPhoto_Exe.c b/code/application/source/cardv/SrcCode/UIApp/Photo/UIAppPhoto_Exe.c index 7d03a0679..258138a5a 100644 --- a/code/application/source/cardv/SrcCode/UIApp/Photo/UIAppPhoto_Exe.c +++ b/code/application/source/cardv/SrcCode/UIApp/Photo/UIAppPhoto_Exe.c @@ -2464,7 +2464,7 @@ INT32 PhotoExe_OnOpen(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray) // g_photo_ImageRatioSize = IMAGERATIO_SIZE[4]; FileSys_MakeDir(PHOTO_THUMB_PATH); #if SF_IQ_TEST != ENABLE - FileSys_SetAttrib(PHOTO_THUMB_PATH, FST_ATTRIB_HIDDEN | FST_ATTRIB_SYSTEM, TRUE); + FileSys_SetAttrib(PHOTO_THUMB_PATH, FST_ATTRIB_HIDDEN/* | FST_ATTRIB_SYSTEM*/, TRUE); #endif GOIO_Turn_Onoff_IRCUT(1); diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h index 67dd1b07c..4bf30cca5 100644 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UICfgDefault.h @@ -189,7 +189,7 @@ #define DEFAULT_NET_WORK_NEED_SEARCH SF_ON #endif -#define DEFAULT_GPRS_SWITCH SF_OFF +#define DEFAULT_GPRS_SWITCH SF_ON #define DEFAULT_BATTERY_TYPE SF_BATT_ALKALINE #define DEFAULT_WORKTIME_SWITCH SF_OFF #define DEFAULT_SIM_AUTO_SWITCH SF_SIM_SWITCH_AUTO diff --git a/code/application/source/sf_app/code/include/sf_commu_mcu_reg.h b/code/application/source/sf_app/code/include/sf_commu_mcu_reg.h index dd77af089..ead00c67f 100644 --- a/code/application/source/sf_app/code/include/sf_commu_mcu_reg.h +++ b/code/application/source/sf_app/code/include/sf_commu_mcu_reg.h @@ -377,6 +377,8 @@ UINT8 sf_get_fw_update(void); void sf_set_fw_update(UINT8 flag); void sf_set_gprs_errno(SINT32 value); SINT32 sf_get_gprs_errno(void); +BOOL sf_get_signal_ready_flag(void); +void sf_set_signal_ready_flag(BOOL Flag); extern unsigned short TrigType; diff --git a/code/application/source/sf_app/code/include/sf_eg91_sim.h b/code/application/source/sf_app/code/include/sf_eg91_sim.h index 8467fd6be..b3f3a0f18 100644 --- a/code/application/source/sf_app/code/include/sf_eg91_sim.h +++ b/code/application/source/sf_app/code/include/sf_eg91_sim.h @@ -266,7 +266,7 @@ void sf_gprs_init(UINT32 param); void sf_4g_module_sleep(void); -void sf_4g_set_module_minimun_fun(void); +SINT32 sf_4g_set_module_minimun_fun(void); #ifdef __cplusplus #if __cplusplus diff --git a/code/application/source/sf_app/code/include/sf_file.h b/code/application/source/sf_app/code/include/sf_file.h index e882f655f..8dc15dcad 100644 --- a/code/application/source/sf_app/code/include/sf_file.h +++ b/code/application/source/sf_app/code/include/sf_file.h @@ -33,6 +33,9 @@ BOOL sf_is_enough_power_to_update(void); BOOL sf_is_4g_module_usb_update_file_exist(UINT8 *updateFname); +void sf_set_del_flag(BOOL flag); + +BOOL sf_get_del_flag(void); #ifdef __cplusplus #if __cplusplus } diff --git a/code/application/source/sf_app/code/include/sf_fileMng.h b/code/application/source/sf_app/code/include/sf_fileMng.h index ad5848b56..e1964aa58 100644 --- a/code/application/source/sf_app/code/include/sf_fileMng.h +++ b/code/application/source/sf_app/code/include/sf_fileMng.h @@ -78,6 +78,7 @@ SINT32 sf_file_size_get(SF_CHAR *filePath,UINT32 *pFileSize); BOOL sf_check_auto_thumb_file(VOID); UINT8 sf_get_send_file_list(char *sendfileList, UINT8 *fileTotal); +UINT8 sf_get_send_file_total(void); #ifdef __cplusplus #if __cplusplus } diff --git a/code/application/source/sf_app/code/include/sf_ftp.h b/code/application/source/sf_app/code/include/sf_ftp.h index 99100e85f..a046de45c 100644 --- a/code/application/source/sf_app/code/include/sf_ftp.h +++ b/code/application/source/sf_app/code/include/sf_ftp.h @@ -214,5 +214,6 @@ SINT32 sf_simcom_ftp_send(UINT8 mode); SINT32 sf_4g_module_ota_ftp(void); UINT32 sf_connect_ftps_server(void); UINT32 sf_camera_ota_ftp(void); +SINT32 sf_concentrated_ftp_send(void); #endif /*_SF_FTP_H_*/ diff --git a/code/application/source/sf_app/code/include/sf_param_enum.h b/code/application/source/sf_app/code/include/sf_param_enum.h index f35231d94..4bbc53452 100644 --- a/code/application/source/sf_app/code/include/sf_param_enum.h +++ b/code/application/source/sf_app/code/include/sf_param_enum.h @@ -483,7 +483,7 @@ typedef enum sf_WIFI_MESSAGE_TYPE_E SF_WIFI_CMD_START = 0x1A00, SF_WIFI_CMD_STOP = 0x1B00, SF_WIFI_CMD_RESTART = 0x1C00, - + SF_WIFI_CMD_CAPTURE = 0x1D00, }SF_WIFI_MESSAGE_TYPE_E; diff --git a/code/application/source/sf_app/code/include/sf_service.h b/code/application/source/sf_app/code/include/sf_service.h index f6bd78d32..e96404ca4 100644 --- a/code/application/source/sf_app/code/include/sf_service.h +++ b/code/application/source/sf_app/code/include/sf_service.h @@ -49,7 +49,7 @@ SINT32 app_file_subscrible_check(SF_REPORT_FILE_ATTR_S *pDtsReportFileAttr,SF_RE SINT32 app_RegisterNet_start(void); void app_FileSend_start(void); SINT32 app_t110(void); - +SINT32 sf_app_to_cardv_capture(void); #ifdef __cplusplus #if __cplusplus } diff --git a/code/application/source/sf_app/code/include/sf_sms.h b/code/application/source/sf_app/code/include/sf_sms.h index 8582f20f0..171360d75 100644 --- a/code/application/source/sf_app/code/include/sf_sms.h +++ b/code/application/source/sf_app/code/include/sf_sms.h @@ -259,5 +259,6 @@ SINT32 sf_power_off_check_fw_update(void); SINT32 sf_power_off_check_module_sleep(void); SINT32 sf_power_off_check_camera_restart(void); SINT32 sf_power_off_check_ui_para_sava(void); +UINT8 sf_sms_check_send(void); #endif /*_SF_SMS_H_*/ diff --git a/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c b/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c index f96809766..4d105a206 100644 --- a/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c @@ -4070,7 +4070,7 @@ UINT32 sf_sim_qsclk(UINT8 mode) //mode = 2, gprsmode = 1 printf("[%s:%d] s\n", __FUNCTION__, __LINE__); - if(SUCCESS != app_ttyusb_IsOpen()) + /*if(SUCCESS != app_ttyusb_IsOpen()) { printf("%s:%d tty usb err", __FUNCTION__, __LINE__); @@ -4078,9 +4078,7 @@ UINT32 sf_sim_qsclk(UINT8 mode) //mode = 2, gprsmode = 1 { return ret; } - } - - sf_gsm_para_buff_clear(); + }*/ while(sf_app_while_flag()) { @@ -4190,45 +4188,95 @@ void sf_4g_module_sleep(void) Return: N/A Others: N/A *************************************************/ -void sf_4g_set_module_minimun_fun(void) +SINT32 sf_4g_set_module_minimun_fun(void) { - UIMenuStoreInfo *pPara = sf_app_ui_para_get(); - UINT8 time = 25; - UINT8 responseOk = 0; + SINT32 ret = 0; //0:start; 1:success; 2:timeout; 3:fail; + UINT8 time = 0; + UINT8 calltime = 0; + SF_SIM_E eSmsLocation = SMS_SIM_INIT_DTRUP; + int ttyRet = 0; + UIMenuStoreInfo *pPara = sf_app_ui_para_get(); - printf("%s", __FUNCTION__); + printf("%s\n", __FUNCTION__); if(/*(pPara->GpsSwitch) && */(pPara->NeedTimeSyncStartUp == 1) || pPara->FristSendDailyAndGps) { - return; + return ret; } - - SF_STRCPY(gsmPara, "AT+CGATT=0\r"); - sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara)); - while(time--) + sf_gsm_para_buff_clear(); + + strcpy((char *)gsmPara, "AT+CGATT=0\r"); + ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara)); + + while(sf_app_while_flag()) { - sf_hal_ttyusb2_read(gsmPara, 200); + time++; - if(SF_STRSTR(gsmPara, "OK")) + if(time >= 100) { - printf("set CGATT=%s\n", gsmPara); - responseOk = 1; - break; + ret = SF_SIM_ERROR_AT_TIMEOUT; + sprintf((char *)logStr, "ReadMsg Wait Init Timeout.\n[ERROR]eSmsLocation=%d", eSmsLocation); + SLOGE(logStr); + time = 0; + return ret; + } + + sf_gsm_para_buff_clear(); + + sf_hal_ttyusb2_read(gsmPara, 200); + if(gsmPara[0] != '\0') + { + printf("[%s:%d]eSmsLocation:%d\ngsmPara:%s\n", __FUNCTION__, __LINE__, eSmsLocation, gsmPara); + } + switch(eSmsLocation) + { + case SMS_SIM_INIT_DTRUP: + + if(strstr((const char *)gsmPara, "OK")) + { + strcpy((char *)gsmPara, "AT+CFUN=0\r"); //sleep + ttyRet = sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara)); + SF_CHECK_RETURN(ttyRet, SF_SIM_ERROR_AT_TIMEOUT); + eSmsLocation = SMS_SIM_INIT_EXIT; + } + else if(strstr((const char *)gsmPara, "ERROR")) + { + goto SF_FUN_RETURN; + } + + break; + + case SMS_SIM_INIT_EXIT: + + if(strstr((const char *)gsmPara, "OK")) + { + goto SF_FUN_RETURN; + } + else + { + calltime++; + + if(calltime > 20) + { + ret = SF_SIM_ERROR_AT_TIMEOUT; + sprintf((char *)logStr, "[%s:%d]ErrorCode=0x%08x,AT+QSCLK Timeout.", __FUNCTION__, __LINE__, ret); + SLOGE(logStr); + goto SF_FUN_RETURN; + } + } + + break; + + default: + break; } } - if(responseOk) - { - SF_STRCPY(gsmPara, "AT+CFUN=0\r"); - sf_hal_ttyusb2_write(gsmPara, strlen(gsmPara)); - sf_hal_ttyusb2_read(gsmPara, 200); - printf("set minimun_fun=%s\n", gsmPara); - } - else - { - printf("AT+CGATT timeout\n"); - } + SF_FUN_RETURN: + + printf("[%s:%d] ret:%d\n", __FUNCTION__, __LINE__, ret); + return ret; } diff --git a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c index c59649d2e..6f200376e 100644 --- a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c @@ -43,7 +43,7 @@ extern "C" { #include "sf_ftp.h" #include "sf_fileMng.h" #include "sf_file.h" - +#include "sf_storeMng.h" /************************************************************************** * C O N S T A N T S * **************************************************************************/ @@ -3295,6 +3295,130 @@ UINT32 sf_camera_ota_ftp(void) } +/************************************************* + Function: sf_concentrated_ftp_send + Description: ftp send. + Input: 1:send pic/video. 2:send dr. + Output: N/A + Return: 0:success; else:fail; + Others: N/A +*************************************************/ +SINT32 sf_concentrated_ftp_send(void) +{ + SINT32 ret1 = SF_SUCCESS; //0:success; else:fail; + SINT32 ret2 = SF_SUCCESS; //0:success; else:fail; + UINT8 ssl = 0; + UINT8 gprsMode = 0; + UINT8 timeout = 100; + UINT8 piccount = 0; + UINT8 SendFileTotal = 0; + UINT8 battery = 0; + UIMenuStoreInfo *pPara = sf_app_ui_para_get(); + SF_PDT_PARAM_STATISTICS_S *pSifarPara = sf_statistics_param_get(); + + SF_SRCFILE_ATTR_S *pThumbFileCfg = sf_file_thumb_cfg_get(); + + printf("[%s:%d] s\n", __FUNCTION__, __LINE__); + SendFileTotal = sf_get_send_file_total(); + ssl = ((2 == pPara->FtpSwitch) ? 1 : 0); + gprsMode = 0;//puiPara->GprsMode; + printf("[%s:%d] ssl:%d,GprsMode:%d SendFileTotal:%d\n", __FUNCTION__, __LINE__, ssl, gprsMode, SendFileTotal); + + UINT8 ftpFileName[64] = { 0 }; + UINT8 filePath[64] = { 0 }; + UINT8 CamNameStr[64] = {0}; + char cameraID[64] = { 0 }; + + SINT32 ret = SF_SUCCESS; + + UINT8 csqlevel = 0; + + + sf_custom_str_get(CamNameStr); + sf_4G_signal_level_get(pPara->NetGeneration,sf_get_cq_signal(),&csqlevel); + + ret1 = sf_ftp_config(ssl, gprsMode, timeout); + + if(SF_SUCCESS == ret1) + { + while((sf_app_while_flag()) && (((piccount+1) <= SendFileTotal) && ((pSifarPara->picSendMax < pPara->SendMaxNum) || (pPara->SendMaxNum == 0)))) + { + snprintf((char *)ftpFileName, sizeof(ftpFileName), "%s", pThumbFileCfg->stfileattr[piccount].thumbfileName); + snprintf((char *)filePath, sizeof(filePath), "%s", pThumbFileCfg->stfileattr[piccount].thumbfilePath); + + sf_set_del_flag(FALSE); + ret1 = sf_quectel_upload_file_to_module(filePath, ftpFileName); + + if(SF_UPLOAD_ERROR_RETRY == ret1) + { + printf("[%s:%d] PIC SF_UPLOAD_ERROR_RETRY\n", __FUNCTION__, __LINE__); + ret1 = sf_ftp_config(ssl, gprsMode, timeout); + + if(ret1 == SF_SUCCESS) + { + ret1 = sf_quectel_upload_file_to_module(filePath, ftpFileName); + } + } + battery = sf_app_get_battery(); + memset(cameraID, '\0', sizeof(cameraID)); + memset(ftpFileName, '\0', sizeof(ftpFileName)); + memset(filePath, '\0', sizeof(filePath)); + + snprintf(cameraID, sizeof(cameraID), "%s-%d-%d-%s-", pPara->ModuleImei, battery, csqlevel, CamNameStr); + if(SF_FILE_TYPE_PIC_VIDEO == pThumbFileCfg->stfileattr[piccount].enFileTye){ + snprintf((char *)ftpFileName, sizeof(ftpFileName), "%sV-%s", cameraID, pThumbFileCfg->stfileattr[piccount].thumbfileName); + }else{ + snprintf((char *)ftpFileName, sizeof(ftpFileName), "%s%s", cameraID, pThumbFileCfg->stfileattr[piccount].thumbfileName); + } + snprintf((char *)filePath, sizeof(filePath), "UFS:/%s", pThumbFileCfg->stfileattr[piccount].thumbfileName); + + printf("%s:%d ftpFileName:%s filePath:%s\n", __FUNCTION__, __LINE__, ftpFileName, filePath); + + if(ret1 == SF_SUCCESS) + { + ret1 = sf_ftp_send(ftpFileName, filePath, timeout); + if(SF_SUCCESS != ret1) + { + printf("%s:%d err ret: [0x%08X] ftpFileName:%s filePath:%s\n", __FUNCTION__, __LINE__, ret, ftpFileName, filePath); + goto SF_CONCENTRATED_END; + } + else { + piccount++; + } + } + if(battery <= 0) + { + goto SF_CONCENTRATED_END; + } + } + } + +SF_CONCENTRATED_END: + if(!(((piccount+1) <= SendFileTotal) && ((pSifarPara->picSendMax < pPara->SendMaxNum) || (pPara->SendMaxNum == 0)))) + { + sf_delete_send_flie_list(); + } + + if(ret1 != SF_FTP_ERROR_TERM) + { + ret2 = sf_ftp_stop(ssl, gprsMode); + } + + #if SF_TEST_ERROR_CODE + sf_set_code_err_flag(0); + #endif + printf("[%s:%d]ret1:[0x%08X],ret2:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret1, ret2); + + if(ret1 != SF_SUCCESS) + { + return ret1; + } + else + { + return ret2; + } +} + #ifdef __cplusplus #if __cplusplus } diff --git a/code/application/source/sf_app/code/source/4gMng/sf_sms.c b/code/application/source/sf_app/code/source/4gMng/sf_sms.c index 496c8d2af..93083533e 100644 --- a/code/application/source/sf_app/code/source/4gMng/sf_sms.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_sms.c @@ -1752,11 +1752,11 @@ SINT32 sf_check_message(void) if(SUCCESS != app_ttyusb_IsOpen()) { - printf("%s:%d tty usb err", __FUNCTION__, __LINE__); + printf("%s:%d tty usb err\n", __FUNCTION__, __LINE__); if(sf_ttyusb_restart() != SUCCESS) { - printf("%s:%d restart tty usb err", __FUNCTION__, __LINE__); + printf("%s:%d restart tty usb err\n", __FUNCTION__, __LINE__); return ret; } } @@ -1787,13 +1787,13 @@ SINT32 sf_check_message(void) if(gsmPara[0] != '\0') { - SLOGI("gsmPara:%s", gsmPara); + SLOGI("gsmPara:%s\n", gsmPara); } if(strstr((const char *)gsmPara, "ERROR")) { SLOGE(gsmPara); - sprintf(logStr, "[ERROR] ReadMsg MMC_location=%d ", location); + sprintf(logStr, "[ERROR] ReadMsg MMC_location=%d \n", location); SLOGE(logStr); errcode++; time = 0; @@ -2216,7 +2216,7 @@ SINT32 sf_simcom_check_need_send(void) printf("[%s:%d]sf_get_pic()=%d,puiPara->NetGeneration=%d\n", __FUNCTION__, __LINE__, sf_get_pic(), puiPara->NetGeneration); if((sf_get_sim_insert()) && ((sf_get_mode_flag() == 1) || (PowerOnMode == PWR_ON_PIR) || (PowerOnMode == PWR_ON_TIMELAPSE) || (sf_get_pic() == SF_TRUE)) - && (((puiPara->CamMode == SF_CAM_MODE_VIDEO) && (puiPara->SendVideoSwitch == 1) && (puiPara->NetGeneration == 4)))) + && ((puiPara->SendPhotoSwitch == 1) || ((puiPara->CamMode == SF_CAM_MODE_VIDEO) && (puiPara->SendVideoSwitch == 1) && (puiPara->NetGeneration == 4)))) { if((sf_check_ftp_send(1) == SF_SUCCESS)) { @@ -2242,7 +2242,7 @@ SINT32 sf_power_off_check_sms(void) SINT32 sendFlag = SF_FAILURE; UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); /*instant, hybrid mode*/ - if((sf_get_signal_ready()) && (sf_get_sim_insert()) && (sf_app_while_flag())) + if((!sf_get_signal_ready_flag()) && (sf_get_sim_insert()) && (sf_app_while_flag())) { if(puiPara->GprsMode) { @@ -2675,3 +2675,19 @@ SINT32 sf_power_off_check_ui_para_sava(void) return 0; } +/************************************************* + Function: sf_power_off_check_camera_restart + Description: sf power off . + Input: N/A + Output: N/A + Return: 0:SUCCESS, errcode:FAIL + Others: N/A +*************************************************/ +UINT8 sf_sms_check_send(void) +{ + if((CameraCmd.getLog) ||(CameraCmd.sendVideo) || (CameraCmd.sendHD) || sf_get_pic()) + { + return 1; + } + return 0; +} diff --git a/code/application/source/sf_app/code/source/app/sf_device.c b/code/application/source/sf_app/code/source/app/sf_device.c index d1b5b2b03..21eaf942a 100644 --- a/code/application/source/sf_app/code/source/app/sf_device.c +++ b/code/application/source/sf_app/code/source/app/sf_device.c @@ -58,13 +58,14 @@ static char* usb_host_drivers[] = { "kernel/drivers/usb/host/ehci-hcd.ko", "kernel/drivers/net/mii.ko", "kernel/drivers/net/usb/usbnet.ko", + "extra/net/GobiNet/drv_gobi_net.ko", + "kernel/drivers/net/usb/cdc_ether.ko", + "kernel/drivers/net/usb/rndis_host.ko", "kernel/drivers/usb/serial/usbserial.ko", "kernel/drivers/usb/serial/usb_wwan.ko", "kernel/drivers/usb/serial/option.ko", - "kernel/drivers/net/usb/cdc_ether.ko", "kernel/drivers/usb/class/cdc-wdm.ko", "kernel/drivers/net/usb/qmi_wwan.ko", - "extra/net/GobiNet/drv_gobi_net.ko", NULL }; diff --git a/code/application/source/sf_app/code/source/app/sf_service.c b/code/application/source/sf_app/code/source/app/sf_service.c index bda821e51..31182b9e3 100644 --- a/code/application/source/sf_app/code/source/app/sf_service.c +++ b/code/application/source/sf_app/code/source/app/sf_service.c @@ -1,54 +1,58 @@ -#include -#include -#include -#include -#include -#include +#include "sf_log.h" +#include "sf_qrcode.h" #include -#include +#include +#include #include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include -#include -#include +#include +#include #include -#include -#include -#include -#include "sf_log.h" -#include "sf_qrcode.h" +#include + -#include "sf_hal_ttyusb.h" #include "sf_dev_usb.h" #include "sf_fileMng.h" +#include "sf_hal_ttyusb.h" #include "sf_ledmng.h" -#include "sf_systemMng.h" + #include "sf_storeMng.h" +#include "sf_systemMng.h" + #if defined(CFG_LIVE_ENBLE) #include "sf_liveMng.h" #endif #include "sf_dataMng.h" -#include "sf_module.h" -#include "sf_keymng.h" -#include "sf_otamng.h" #include "sf_datahttp.h" +#include "sf_keymng.h" +#include "sf_module.h" +#include "sf_otamng.h" + -#include "sf_message_queue.h" -#include "sf_device.h" -#include "sf_system.h" -#include "sf_service.h" -#include "sf_param_common.h" -#include "sf_eg91_sim.h" -#include "sf_ftp.h" -#include "sf_commu_mcu_reg.h" -#include "sf_file.h" #include "sf_commMng.h" +#include "sf_commu_mcu_reg.h" +#include "sf_device.h" +#include "sf_eg91_sim.h" +#include "sf_file.h" +#include "sf_ftp.h" +#include "sf_message_queue.h" +#include "sf_param_common.h" +#include "sf_service.h" #include "sf_sms.h" +#include "sf_system.h" + #ifdef __cplusplus #if __cplusplus @@ -60,1029 +64,985 @@ extern SF_PARA_TIME_S rtcTime; extern pthread_mutex_t Param_mutexLock; extern pthread_mutex_t GPIO_mutexLock; -static SF_THREAD_S RegisterNetTskParam = -{ +static SF_THREAD_S RegisterNetTskParam = { .IsRun = 0, .TskId = -1, }; -SF_THREAD_S ThumbSend = -{ +SF_THREAD_S ThumbSend = { .IsRun = 0, .TskId = -1, }; UINT32 FtpOpenOk = FAIL; - SINT32 app_ttyusb_IsOpen(void) -{ - int retryTime = 0; - int retryFlag = 0; - SINT32 s32ret = 0; - MLOGD("ttyUSB has not been init, will init ttyUSB!\n"); - while ((s32ret = sf_hal_ttyusb2_init()) < 0) - { - retryTime++; - if((0 == retryFlag) && (retryTime >=100) && (retryTime%100 == 0))//200ms*100 = 20s - { - MLOGE("-------ttyUSB init fail, clos usb mux.\n"); - sf_usb_mux_s(0); - sleep(5); - sf_usb_mux_s(1); - retryFlag = 1; - } - else if((1 == retryFlag) && (retryTime >=50) && (retryTime%50 == 0))//200ms*25 = 5s - { - MLOGE("-------ttyUSB retry init fail!\n"); - s32ret = SF_TTY_ERROR_OPEN; - break; - } - } - - return s32ret; -} - -SINT32 sf_ttyusb_restart(void) -{ - SINT32 ret = 0; - ret = sf_hal_ttyusb2_deinit(); - if(ret != 0) +SINT32 app_ttyusb_IsOpen(void) { + int retryTime = 0; + int retryFlag = 0; + SINT32 s32ret = 0; + MLOGD("ttyUSB has not been init, will init ttyUSB!\n"); + while ((s32ret = sf_hal_ttyusb2_init()) < 0) { + retryTime++; + if ((0 == retryFlag) && (retryTime >= 100) && + (retryTime % 100 == 0)) // 200ms*100 = 20s { - MLOGE("-------ttyUSB deinit fail!\n"); - } - else + MLOGE("-------ttyUSB init fail, clos usb mux.\n"); + sf_usb_mux_s(0); + sleep(5); + sf_usb_mux_s(1); + retryFlag = 1; + } else if ((1 == retryFlag) && (retryTime >= 50) && + (retryTime % 50 == 0)) // 200ms*25 = 5s { - sf_mcu_reg_set(SF_MCU_RESET_MODULE, 0); - sleep(5); - ret = app_ttyusb_IsOpen(); + MLOGE("-------ttyUSB retry init fail!\n"); + s32ret = SF_TTY_ERROR_OPEN; + break; } - return ret; -} -SF_BOOL app_disconnect_4g_module(void) -{ - if((sf_usb_IsInsert()) || (sf_poweroff_type_get())) - { - return SF_TRUE; - } - else - { - return SF_FALSE; - } + } + + return s32ret; } -#if SF_QLOG_ENABLE -static SINT16 app_Qlog_procress(void) -{ - SINT16 s32ret = SF_SUCCESS; +SINT32 sf_ttyusb_restart(void) { + SINT32 ret = 0; + ret = sf_hal_ttyusb2_deinit(); + if (ret != 0) { + MLOGE("-------ttyUSB deinit fail!\n"); + } else { + sf_mcu_reg_set(SF_MCU_RESET_MODULE, 0); + sleep(5); + ret = app_ttyusb_IsOpen(); + } + return ret; +} +SF_BOOL app_disconnect_4g_module(void) { + if ((sf_usb_IsInsert()) || (sf_poweroff_type_get())) { + return SF_TRUE; + } else { + return SF_FALSE; + } +} - char qlogPath[128] = {0}; - char qlogDirCmd[128]={0}; - time_t timep; - struct tm *p; - time(&timep); - p = gmtime(&timep); - if(access("/mnt/sd/qlog", F_OK) != 0) - { - s32ret = mkdir("/mnt/sd/qlog", 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); - MLOGD("%s\n", qlogDirCmd); - s32ret = system(qlogDirCmd); - - return s32ret; +#if SF_QLOG_ENABLE +static SINT16 app_Qlog_procress(void) { + SINT16 s32ret = SF_SUCCESS; + + char qlogPath[128] = {0}; + char qlogDirCmd[128] = {0}; + time_t timep; + struct tm *p; + time(&timep); + p = gmtime(&timep); + if (access("/mnt/sd/qlog", F_OK) != 0) { + s32ret = mkdir("/mnt/sd/qlog", 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); + MLOGD("%s\n", qlogDirCmd); + s32ret = system(qlogDirCmd); + + return s32ret; } #endif -SINT32 sf_USB_net_init(void) -{ - static UINT8 flag = 0; - SF_CHAR cmdStr[128] = {0}; - int ret = SF_FAILURE; - //SF_PDT_PARAM_STATISTICS_S *sfPara = sf_statistics_param_get(); - if(flag == 0) - { - flag = 1; - /*if(strstr(sfPara->ApnGPRS, V_MODULE_APN)) - { - sprintf(cmdStr, "/usr/bin/quectel-CM -n %d&", V_PDP_INDEX); - } - else if(strstr(sfPara->ApnGPRS, A_MODULE_APN)) - { - sprintf(cmdStr, "/usr/bin/quectel-CM -n %d&", A_PDP_INDEX); - } - else*/ - - { - sprintf(cmdStr, "/usr/bin/quectel-CM -n %d&", E_PDP_INDEX); - } - } - - for(UINT8 i = 0; i < 40; i++) - { - if(access("/dev/qcqmi0", F_OK) == SF_SUCCESS) - { - ret = SF_SUCCESS; - printf("usb net ko exist!\r\n"); - break; - } - else - { - usleep(100*1000); - } - } - - if(ret == SF_SUCCESS) - { - system(cmdStr); - if(sf_poweron_type_get() == SF_MCU_STARTUP_RING) - { - sleep(2); - } - else - { - sleep(5); - } - return ret; - } - - printf("usb net ko no exist!\r\n"); - return ret; - +SINT32 sf_USB_net_init(void) { + static UINT8 flag = 0; + SF_CHAR cmdStr[128] = {0}; + int ret = SF_FAILURE; + // SF_PDT_PARAM_STATISTICS_S *sfPara = sf_statistics_param_get(); + if (flag == 0) { + flag = 1; + /*if(strstr(sfPara->ApnGPRS, V_MODULE_APN)) + { + sprintf(cmdStr, "/usr/bin/quectel-CM -n %d&", V_PDP_INDEX); + } + else if(strstr(sfPara->ApnGPRS, A_MODULE_APN)) + { + sprintf(cmdStr, "/usr/bin/quectel-CM -n %d&", A_PDP_INDEX); + } + else*/ + + { sprintf(cmdStr, "/usr/bin/quectel-CM -n %d&", E_PDP_INDEX); } + } + + for (UINT8 i = 0; i < 40; i++) { + if (access("/dev/qcqmi0", F_OK) == SF_SUCCESS) { + ret = SF_SUCCESS; + printf("usb net ko exist!\r\n"); + break; + } else { + usleep(100 * 1000); + } + } + + if (ret == SF_SUCCESS) { + system(cmdStr); + if (sf_poweron_type_get() == SF_MCU_STARTUP_RING) { + sleep(2); + } else { + sleep(5); + } + return ret; + } + + printf("usb net ko no exist!\r\n"); + return ret; } -SINT32 app_gps_map_update(SF_FN_PARAM_S *pfnParam) -{ - SINT16 ret = SF_SUCCESS; - UINT8 Isupdate; - SF_PDT_PARAM_CFG_S *pstParam = pfnParam->pstParam; - SF_PDT_PARAM_STATISTICS_S *pStaticParam = pfnParam->pstaticParam; -// SF_PARA_TIME_S stnowtime = {0}; -// SF_PARA_TIME_S stnowtime1 = {0}; - - MLOGD("GPSFlag:%d\n",pstParam->GPSFlag); - if(pstParam->GPSFlag == 0) - return SF_SUCCESS; -// ret = sf_4G_http_config(pfnParam, 1, 1); -// SF_APPCOMM_CHECK_RETURN(ret,SF_APP_ERROR_QIACT); - -// ret = sf_4G_gps_greendate_Get(pfnParam,&stnowtime); -// SF_APPCOMM_CHECK_RETURN(ret,SF_APP_ERROR_QIACT); - -// memcpy(&stnowtime1,&stnowtime,sizeof(SF_PARA_TIME_S)); - ret = sf_4G_gps_Isupdate(pfnParam,&Isupdate,&pStaticParam->httpTime,5); - SF_APPCOMM_CHECK_RETURN(ret,SF_APP_ERROR_QIACT); - - SLOGD("Isupdate = %d\n",Isupdate); - pstParam->GPSMapeUpdateFlag = Isupdate; - if(Isupdate == 1) - { - ret = sf_4G_gps_search(pfnParam,&pStaticParam->httpTime,0); - SF_APPCOMM_CHECK_RETURN(ret,SF_APP_ERROR_QIACT); +SINT32 app_gps_map_update(SF_FN_PARAM_S *pfnParam) { + SINT16 ret = SF_SUCCESS; + UINT8 Isupdate; + SF_PDT_PARAM_CFG_S *pstParam = pfnParam->pstParam; + SF_PDT_PARAM_STATISTICS_S *pStaticParam = pfnParam->pstaticParam; + // SF_PARA_TIME_S stnowtime = {0}; + // SF_PARA_TIME_S stnowtime1 = {0}; - } - ret = sf_4G_gps_preconfig(pfnParam); - SF_APPCOMM_CHECK_RETURN(ret,SF_APP_ERROR_QIACT); - - - - return ret; + MLOGD("GPSFlag:%d\n", pstParam->GPSFlag); + if (pstParam->GPSFlag == 0) + return SF_SUCCESS; + // ret = sf_4G_http_config(pfnParam, 1, 1); + // SF_APPCOMM_CHECK_RETURN(ret,SF_APP_ERROR_QIACT); + + // ret = sf_4G_gps_greendate_Get(pfnParam,&stnowtime); + // SF_APPCOMM_CHECK_RETURN(ret,SF_APP_ERROR_QIACT); + + // memcpy(&stnowtime1,&stnowtime,sizeof(SF_PARA_TIME_S)); + ret = sf_4G_gps_Isupdate(pfnParam, &Isupdate, &pStaticParam->httpTime, 5); + SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_QIACT); + + SLOGD("Isupdate = %d\n", Isupdate); + pstParam->GPSMapeUpdateFlag = Isupdate; + if (Isupdate == 1) { + ret = sf_4G_gps_search(pfnParam, &pStaticParam->httpTime, 0); + SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_QIACT); + } + ret = sf_4G_gps_preconfig(pfnParam); + SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_QIACT); + + return ret; } -SINT32 app_gps_info_get(SF_FN_PARAM_S *pfnParam) -{ - SINT16 ret = SF_SUCCESS; - SF_PDT_PARAM_CFG_S *pstParam = pfnParam->pstParam; - SF_PDT_PARAM_STATISTICS_S *pStaticParam = pfnParam->pstaticParam; - MLOGD("GPSFlag:%d\n",pstParam->GPSFlag); - - pstParam->GPSMapeUpdateFlag = 0; - - if(pstParam->GPSFlag == 0) - return SF_SUCCESS; - - ret = sf_4G_gps_search_result(pfnParam); - if(ret == SF_SUCCESS) { -// pstParam->ParaSync = 1; - pStaticParam->GPSInfoGetFailed = 0; - - } - else - { - pStaticParam->GPSInfoGetFailed++;/* how to sure sequence or no sequence failed Added by MaxLi 2022/06/17--10:42:9*/ - if(pStaticParam->GPSInfoGetFailed < 5) - { -// pstParam->GPSWaitRestartFlag = 1; - } +SINT32 app_gps_info_get(SF_FN_PARAM_S *pfnParam) { + SINT16 ret = SF_SUCCESS; + SF_PDT_PARAM_CFG_S *pstParam = pfnParam->pstParam; + SF_PDT_PARAM_STATISTICS_S *pStaticParam = pfnParam->pstaticParam; + MLOGD("GPSFlag:%d\n", pstParam->GPSFlag); - } - pstParam->ParaSync = 1; - return SF_SUCCESS; + pstParam->GPSMapeUpdateFlag = 0; + if (pstParam->GPSFlag == 0) + return SF_SUCCESS; + + ret = sf_4G_gps_search_result(pfnParam); + if (ret == SF_SUCCESS) { + // pstParam->ParaSync = 1; + pStaticParam->GPSInfoGetFailed = 0; + + } else { + pStaticParam + ->GPSInfoGetFailed++; /* how to sure sequence or no sequence failed + Added by MaxLi 2022/06/17--10:42:9*/ + if (pStaticParam->GPSInfoGetFailed < 5) { + // pstParam->GPSWaitRestartFlag = 1; + } + } + pstParam->ParaSync = 1; + return SF_SUCCESS; } -SINT32 app_gps_anti_theft(SF_FN_PARAM_S *pfnParam) -{ - SINT32 ret = SF_SUCCESS; -// UINT8 Isupdate; - SF_PDT_PARAM_CFG_S *pstParam = pfnParam->pstParam; -// SF_PARA_TIME_S stnowtime = {0}; - - - MLOGD("GPSFlag:%d\n",pstParam->GPSFlag); - MLOGD("GPSAntitheftFlag:%d\n",pstParam->GPSAntitheftFlag); - - if(pstParam->GPSFlag == 0) - return SF_SUCCESS; - if((sf_poweron_type_get() != SF_MCU_STARTUP_TIMELAPSE && sf_poweron_type_get() != SF_MCU_STARTUP_PIR) \ - || (pstParam->GPSAntitheftFlag == 1)) - { - ret = app_gps_map_update(pfnParam); - } - else - { -// { -// ret = sf_4G_http_config(pfnParam, 1, 1); -// SF_APPCOMM_CHECK_RETURN(ret,SF_APP_ERROR_QIACT); -// -// ret = sf_4G_gps_greendate_Get(pfnParam,&stnowtime); -// SF_APPCOMM_CHECK_RETURN(ret,SF_APP_ERROR_QIACT); -// -// ret = sf_4G_gps_Isupdate(pfnParam,&Isupdate,&stnowtime,1); -// SF_APPCOMM_CHECK_RETURN(ret,SF_APP_ERROR_QIACT); -// -// MLOGD("Isupdate = %d\n",Isupdate); -// if(Isupdate == 1) -// { -// pstParam->GPSWaitRestartFlag = 2; -// } -// -// } +SINT32 app_gps_anti_theft(SF_FN_PARAM_S *pfnParam) { + SINT32 ret = SF_SUCCESS; + // UINT8 Isupdate; + SF_PDT_PARAM_CFG_S *pstParam = pfnParam->pstParam; + // SF_PARA_TIME_S stnowtime = {0}; - } - return ret; - + MLOGD("GPSFlag:%d\n", pstParam->GPSFlag); + MLOGD("GPSAntitheftFlag:%d\n", pstParam->GPSAntitheftFlag); + + if (pstParam->GPSFlag == 0) + return SF_SUCCESS; + if ((sf_poweron_type_get() != SF_MCU_STARTUP_TIMELAPSE && + sf_poweron_type_get() != SF_MCU_STARTUP_PIR) || + (pstParam->GPSAntitheftFlag == 1)) { + ret = app_gps_map_update(pfnParam); + } else { + // { + // ret = sf_4G_http_config(pfnParam, 1, 1); + // SF_APPCOMM_CHECK_RETURN(ret,SF_APP_ERROR_QIACT); + // + // ret = sf_4G_gps_greendate_Get(pfnParam,&stnowtime); + // SF_APPCOMM_CHECK_RETURN(ret,SF_APP_ERROR_QIACT); + // + // ret = + //sf_4G_gps_Isupdate(pfnParam,&Isupdate,&stnowtime,1); + // SF_APPCOMM_CHECK_RETURN(ret,SF_APP_ERROR_QIACT); + // + // MLOGD("Isupdate = %d\n",Isupdate); + // if(Isupdate == 1) + // { + // pstParam->GPSWaitRestartFlag = 2; + // } + // + // } + } + return ret; } -SINT32 app_server_querystatus(SF_CMD_TYPE_E enCmdType,SF_FN_PARAM_S *pfnParam,SF_VOID *Param) -{ - SINT16 s16Ret = SF_SUCCESS; - SF_DATA_ATTR_S stDatapacket = {0}; - switch(enCmdType) - { - case SF_CMD_LOGIN_IN: - s16Ret = sf_data_grouping_login(&stDatapacket, pfnParam); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_data_analysis_login(&stDatapacket,pfnParam); - SF_APPCOMM_CHECK_RETURN(s16Ret,SF_FAILURE); - if(SF_TRUE == sf_sys_rtc_time_check(&rtcTime)) - sf_sys_rtc_time_set(&rtcTime); - else - sf_sys_rtc_time_reset(); - sf_sys_rtoscmd_set(LINUX2RTK_CMD_SET_RTCTIME, NULL); - break; - #if !defined(CFG_TRANSDATA_AT) - case SF_CMD_SYNC_CFG: - s16Ret = sf_data_grouping_sync_cfg(&stDatapacket, pfnParam); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_data_analysis_sync_cfg(&stDatapacket, pfnParam); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - break; - #endif - case SF_CMD_REPORT_STATE: - MLOGE("NO PARAM EXCUTE!!!\n"); - break; - case SF_CMD_PHOTO_RESULT: - s16Ret = sf_data_grouping_fileresult(&stDatapacket, pfnParam,Param); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_data_analysis_fileresult(&stDatapacket); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - break; - #if defined(CFG_TRANSDATA_AT) - case SF_CMD_QUERYPENDING_CMD: - s16Ret = sf_data_grouping_query_cmd(&stDatapacket); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_data_analysis_query_cmd(&stDatapacket); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - break; - case SF_CMD_QUERYPENDING_PARAM: - s16Ret = sf_data_grouping_query_cmd_param(&stDatapacket); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_data_analysis_query_cmd_param(&stDatapacket,pfnParam); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - break; - case SF_CMD_REPORT_RESULT: - s16Ret = sf_data_grouping_cmd_report(&stDatapacket, pfnParam,(SF_FILE_ATTR_S *)Param); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_data_analysis_cmd_report(&stDatapacket); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - - break; - case SF_CMD_TRIGGER: - memset(&stDatapacket.databuf, '\0', SF_TTYUSB_RECV_MAX); - memcpy(&stDatapacket.databuf, &pfnParam->arrttyData, SF_TTYUSB_RECV_MAX); - s16Ret = sf_data_analysis_trigger(&stDatapacket,pfnParam); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - break; - case SF_CMD_DISCON_SEND: - s16Ret = sf_data_grouping_disconnection(&stDatapacket,(UINT8*)Param); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 0); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - break; - case SF_CMD_QUERYPENDING_BIND_ACCOUNT: - s16Ret = sf_data_grouping_get_bind_account(&stDatapacket, pfnParam); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_data_analysis_bind_account(&stDatapacket,pfnParam); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - break; - #endif - case SF_CMD_DISCON_SEND: - s16Ret = sf_data_grouping_disconnection(&stDatapacket,(UINT8*)Param); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - s16Ret = sf_4G_acm_tcp_server_transferdata(&stDatapacket, pfnParam, 0); - SF_APPCOMM_CHECK_RETURN(s16Ret,s16Ret); - break; - default: - MLOGE("Unsupport Common ParamType[%d]\n\n",enCmdType); - return SF_FAILURE; - - } - return s16Ret; +SINT32 app_server_querystatus(SF_CMD_TYPE_E enCmdType, SF_FN_PARAM_S *pfnParam, + SF_VOID *Param) { + SINT16 s16Ret = SF_SUCCESS; + SF_DATA_ATTR_S stDatapacket = {0}; + switch (enCmdType) { + case SF_CMD_LOGIN_IN: + s16Ret = sf_data_grouping_login(&stDatapacket, pfnParam); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_data_analysis_login(&stDatapacket, pfnParam); + SF_APPCOMM_CHECK_RETURN(s16Ret, SF_FAILURE); + if (SF_TRUE == sf_sys_rtc_time_check(&rtcTime)) + sf_sys_rtc_time_set(&rtcTime); + else + sf_sys_rtc_time_reset(); + sf_sys_rtoscmd_set(LINUX2RTK_CMD_SET_RTCTIME, NULL); + break; +#if !defined(CFG_TRANSDATA_AT) + case SF_CMD_SYNC_CFG: + s16Ret = sf_data_grouping_sync_cfg(&stDatapacket, pfnParam); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_data_analysis_sync_cfg(&stDatapacket, pfnParam); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + break; +#endif + case SF_CMD_REPORT_STATE: + MLOGE("NO PARAM EXCUTE!!!\n"); + break; + case SF_CMD_PHOTO_RESULT: + s16Ret = sf_data_grouping_fileresult(&stDatapacket, pfnParam, Param); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_data_analysis_fileresult(&stDatapacket); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + break; +#if defined(CFG_TRANSDATA_AT) + case SF_CMD_QUERYPENDING_CMD: + s16Ret = sf_data_grouping_query_cmd(&stDatapacket); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_data_analysis_query_cmd(&stDatapacket); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + break; + case SF_CMD_QUERYPENDING_PARAM: + s16Ret = sf_data_grouping_query_cmd_param(&stDatapacket); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_data_analysis_query_cmd_param(&stDatapacket, pfnParam); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + break; + case SF_CMD_REPORT_RESULT: + s16Ret = sf_data_grouping_cmd_report(&stDatapacket, pfnParam, + (SF_FILE_ATTR_S *)Param); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_data_analysis_cmd_report(&stDatapacket); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + + break; + case SF_CMD_TRIGGER: + memset(&stDatapacket.databuf, '\0', SF_TTYUSB_RECV_MAX); + memcpy(&stDatapacket.databuf, &pfnParam->arrttyData, SF_TTYUSB_RECV_MAX); + s16Ret = sf_data_analysis_trigger(&stDatapacket, pfnParam); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + break; + case SF_CMD_DISCON_SEND: + s16Ret = sf_data_grouping_disconnection(&stDatapacket, (UINT8 *)Param); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 0); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + break; + case SF_CMD_QUERYPENDING_BIND_ACCOUNT: + s16Ret = sf_data_grouping_get_bind_account(&stDatapacket, pfnParam); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_4G_server_transferdata(&stDatapacket, pfnParam, 1); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_data_analysis_bind_account(&stDatapacket, pfnParam); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + break; +#endif + case SF_CMD_DISCON_SEND: + s16Ret = sf_data_grouping_disconnection(&stDatapacket, (UINT8 *)Param); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + s16Ret = sf_4G_acm_tcp_server_transferdata(&stDatapacket, pfnParam, 0); + SF_APPCOMM_CHECK_RETURN(s16Ret, s16Ret); + break; + default: + MLOGE("Unsupport Common ParamType[%d]\n\n", enCmdType); + return SF_FAILURE; + } + return s16Ret; } -SINT16 app_server_Iskeepconnect(SF_FN_PARAM_S *pfnParam,UINT8 GprsMode) -{ - SINT16 s32ret = SF_SUCCESS; - if(GprsMode < 10) - { +SINT16 app_server_Iskeepconnect(SF_FN_PARAM_S *pfnParam, UINT8 GprsMode) { + SINT16 s32ret = SF_SUCCESS; + if (GprsMode < 10) { - - UINT8 bIsKeepConnect = 1; - s32ret = app_server_querystatus(SF_CMD_DISCON_SEND,pfnParam,&bIsKeepConnect); - sf_4G_qsclk_set(pfnParam); - - } - else - { - UINT8 bIsKeepConnect = 0; - s32ret = app_server_querystatus(SF_CMD_DISCON_SEND,pfnParam,&bIsKeepConnect); - s32ret |= sf_4G_acm_tcp_server_close(pfnParam); - - } - return s32ret; + UINT8 bIsKeepConnect = 1; + s32ret = + app_server_querystatus(SF_CMD_DISCON_SEND, pfnParam, &bIsKeepConnect); + sf_4G_qsclk_set(pfnParam); + + } else { + UINT8 bIsKeepConnect = 0; + s32ret = + app_server_querystatus(SF_CMD_DISCON_SEND, pfnParam, &bIsKeepConnect); + s32ret |= sf_4G_acm_tcp_server_close(pfnParam); + } + return s32ret; } -static SINT32 sf_file_sub_send(SF_FN_PARAM_S *pfnParam, SF_REPORT_FILE_ATTR_S *pReportFileAttr ) -{ - SINT32 ret = 0; - //UINT8 tryModuleReboot = 0; - SF_FILE_ATTR_S stfileAttr = { 0 }; - UINT8 sendFileTotal = 0; - UINT8 sendJpegCnt = 0; - //UINT16 sendSuccessFlag = 0; - SF_PDT_PARAM_STATISTICS_S *pStatisParam = pfnParam->pstaticParam; +static SINT32 sf_file_sub_send(SF_FN_PARAM_S *pfnParam, + SF_REPORT_FILE_ATTR_S *pReportFileAttr) { + SINT32 ret = 0; + // UINT8 tryModuleReboot = 0; + SF_FILE_ATTR_S stfileAttr = {0}; + UINT8 sendFileTotal = 0; + UINT8 sendJpegCnt = 0; + // UINT16 sendSuccessFlag = 0; + SF_PDT_PARAM_STATISTICS_S *pStatisParam = pfnParam->pstaticParam; - pStatisParam->SendDailyOriginalCnt++; - pStatisParam->SendDailyCnt++; - sendFileTotal = pReportFileAttr->filecnt; + pStatisParam->SendDailyOriginalCnt++; + pStatisParam->SendDailyCnt++; + sendFileTotal = pReportFileAttr->filecnt; - SLOGD("filecnt:%d\n", pReportFileAttr->filecnt); - SLOGD("[0]enFileTye:%d, SubFileName:%s\n", pReportFileAttr->stSendFileAttr[0].enFileTye, pReportFileAttr->stSendFileAttr[0].SubFileName); - for(sendJpegCnt = 0; sendJpegCnt < sendFileTotal; sendJpegCnt++) - { - ret = sf_file_subscribe_check(&stfileAttr, &pReportFileAttr->stSendFileAttr[sendJpegCnt]); - if(ret != SF_SUCCESS) { - pReportFileAttr->stSendFileAttr[sendJpegCnt].SendRet = ret; - memset(pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileName, '\0', sizeof(pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileName)); - pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileSize = 0; - ret = SF_SUCCESS; - continue; - } - sf_mcu_wdg_set(5); - ret = app_file_upload(&stfileAttr, pfnParam); - if(ret == SF_SUCCESS) { - pStatisParam->SendSuccessOriginalCnt++; - } - memset(pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileName, '\0', sizeof(pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileName)); - sprintf(pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileName, "%s", stfileAttr.thumbfileName); - pReportFileAttr->stSendFileAttr[sendJpegCnt].enFileTye = stfileAttr.enFileTye; - pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileSize = stfileAttr.thumbfileSize; - pReportFileAttr->stSendFileAttr[sendJpegCnt].SendRet = ret; - - } - - SLOGD("SendDailyCnt:%d\n", pStatisParam->SendDailyCnt); - SLOGD("SendSuccessThumbCnt:%d\n", pStatisParam->SendSuccessOriginalCnt); - return ret; + SLOGD("filecnt:%d\n", pReportFileAttr->filecnt); + SLOGD("[0]enFileTye:%d, SubFileName:%s\n", + pReportFileAttr->stSendFileAttr[0].enFileTye, + pReportFileAttr->stSendFileAttr[0].SubFileName); + for (sendJpegCnt = 0; sendJpegCnt < sendFileTotal; sendJpegCnt++) { + ret = sf_file_subscribe_check( + &stfileAttr, &pReportFileAttr->stSendFileAttr[sendJpegCnt]); + if (ret != SF_SUCCESS) { + pReportFileAttr->stSendFileAttr[sendJpegCnt].SendRet = ret; + memset(pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileName, '\0', + sizeof(pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileName)); + pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileSize = 0; + ret = SF_SUCCESS; + continue; + } + sf_mcu_wdg_set(5); + ret = app_file_upload(&stfileAttr, pfnParam); + if (ret == SF_SUCCESS) { + pStatisParam->SendSuccessOriginalCnt++; + } + memset(pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileName, '\0', + sizeof(pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileName)); + sprintf(pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileName, "%s", + stfileAttr.thumbfileName); + pReportFileAttr->stSendFileAttr[sendJpegCnt].enFileTye = + stfileAttr.enFileTye; + pReportFileAttr->stSendFileAttr[sendJpegCnt].SendFileSize = + stfileAttr.thumbfileSize; + pReportFileAttr->stSendFileAttr[sendJpegCnt].SendRet = ret; + } + + SLOGD("SendDailyCnt:%d\n", pStatisParam->SendDailyCnt); + SLOGD("SendSuccessThumbCnt:%d\n", pStatisParam->SendSuccessOriginalCnt); + return ret; } -static SINT32 app_upgrade_ota_execute(void) -{ - SINT32 s32ret = SF_SUCCESS; - - - SF_RTOSINFO_S stRtosData = {0}; - sf_sys_rtosdata_get(&stRtosData); - MLOGI("bat:%d\n", stRtosData.BatPer); - if(stRtosData.BatPer < 40) { - SLOGE("Battery capacity is too low\n"); - goto _ERROR_; - } - if(!(sf_sd_status_get() == SF_SD_OK || sf_sd_status_get() == SF_SD_FULL)) { - SLOGE("SD is not exsited ,please check it !!!"); - goto _ERROR_; - } - s32ret = sf_upgrade_ota_init(); - if(s32ret != SF_SUCCESS) { - goto _ERROR_; - } - - s32ret = sf_upgrade_ota_download(); - if(s32ret != SF_SUCCESS) { - goto _ERROR_; - } - s32ret = sf_upgrade_ota_filecheck(); - if(s32ret != SF_SUCCESS) { - goto _ERROR_; - } - s32ret = sf_upgrade_ota_reset(); - if(s32ret != SF_SUCCESS) { - goto _ERROR_; - } - s32ret = sf_upgrade_ota_param_bak(); - if(s32ret != SF_SUCCESS) { - goto _ERROR_; - } - s32ret = sf_upgrade_ota_env_set(); - if(s32ret != SF_SUCCESS) { - goto _ERROR_; - } - sleep(2); - - s32ret = sf_upgrade_ota_deinit(); - if(s32ret != SF_SUCCESS) { - goto _ERROR_; - } - sf_mcu_wdg_off(); - sleep(2); - -// if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) - { - SF_MESSAGE_BUF_S stMessageBuf = {0}; - stMessageBuf.arg1 = SF_POWEROFF_SYNC_PARAM; - stMessageBuf.cmdId = CMD_POWEROFF; - sf_com_message_send_to_app(&stMessageBuf); - } +static SINT32 app_upgrade_ota_execute(void) { + SINT32 s32ret = SF_SUCCESS; - return s32ret; + SF_RTOSINFO_S stRtosData = {0}; + sf_sys_rtosdata_get(&stRtosData); + MLOGI("bat:%d\n", stRtosData.BatPer); + if (stRtosData.BatPer < 40) { + SLOGE("Battery capacity is too low\n"); + goto _ERROR_; + } + if (!(sf_sd_status_get() == SF_SD_OK || sf_sd_status_get() == SF_SD_FULL)) { + SLOGE("SD is not exsited ,please check it !!!"); + goto _ERROR_; + } + s32ret = sf_upgrade_ota_init(); + if (s32ret != SF_SUCCESS) { + goto _ERROR_; + } + + s32ret = sf_upgrade_ota_download(); + if (s32ret != SF_SUCCESS) { + goto _ERROR_; + } + s32ret = sf_upgrade_ota_filecheck(); + if (s32ret != SF_SUCCESS) { + goto _ERROR_; + } + s32ret = sf_upgrade_ota_reset(); + if (s32ret != SF_SUCCESS) { + goto _ERROR_; + } + s32ret = sf_upgrade_ota_param_bak(); + if (s32ret != SF_SUCCESS) { + goto _ERROR_; + } + s32ret = sf_upgrade_ota_env_set(); + if (s32ret != SF_SUCCESS) { + goto _ERROR_; + } + sleep(2); + + s32ret = sf_upgrade_ota_deinit(); + if (s32ret != SF_SUCCESS) { + goto _ERROR_; + } + sf_mcu_wdg_off(); + sleep(2); + + // if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) + { + SF_MESSAGE_BUF_S stMessageBuf = {0}; + stMessageBuf.arg1 = SF_POWEROFF_SYNC_PARAM; + stMessageBuf.cmdId = CMD_POWEROFF; + sf_com_message_send_to_app(&stMessageBuf); + } + + return s32ret; _ERROR_: - sf_upgrade_status_set(SF_UPGRADE_FAIL); - if(!app_upgrade_ota_restore_IsRun()) - app_upgrade_ota_restore_start(); - return SF_SUCCESS; - + sf_upgrade_status_set(SF_UPGRADE_FAIL); + if (!app_upgrade_ota_restore_IsRun()) + app_upgrade_ota_restore_start(); + return SF_SUCCESS; } - SINT32 app_file_subscrible_check(SF_REPORT_FILE_ATTR_S *pDtsReportFileAttr,SF_REPORT_FILE_ATTR_S *pSrcReportFileAttr) -{ - SINT8 srcdex = 0; - SINT8 dtsdex = 0; - SF_REPORT_FILE_ATTR_S stReportFileAttr = {0}; - - memset(&stReportFileAttr, 0, sizeof(SF_REPORT_FILE_ATTR_S)); - - for( dtsdex = 0; dtsdex < pDtsReportFileAttr->filecnt; dtsdex++) { - for(srcdex = 0;srcdex filecnt;srcdex++) { - if(!strncmp(pSrcReportFileAttr->stSendFileAttr[srcdex].SubFileName+14, \ - pDtsReportFileAttr->stSendFileAttr[dtsdex].SubFileName+14,12)) { - pDtsReportFileAttr->stSendFileAttr[dtsdex].SameFlag = 1; - } - } - if(pDtsReportFileAttr->stSendFileAttr[dtsdex].SameFlag == 1) - continue; - memcpy(&stReportFileAttr.stSendFileAttr[stReportFileAttr.filecnt], - &pDtsReportFileAttr->stSendFileAttr[dtsdex],sizeof(SF_SEND_FILE_ATTR_S)); - MLOGI("filecnt:%d,filetype:%d,main:[%s],sub:[%s]\n",\ - stReportFileAttr.filecnt,\ - stReportFileAttr.stSendFileAttr[stReportFileAttr.filecnt].enFileTye,\ - stReportFileAttr.stSendFileAttr[stReportFileAttr.filecnt].SubFileName,\ - stReportFileAttr.stSendFileAttr[stReportFileAttr.filecnt].SendFileName); - stReportFileAttr.filecnt += 1; - } - - memset(sf_get_sub_report_file_attr(), 0, sizeof(SF_REPORT_FILE_ATTR_S)); - memcpy(sf_get_sub_report_file_attr(),&stReportFileAttr, sizeof(SF_REPORT_FILE_ATTR_S)); - - return SF_SUCCESS; +SINT32 app_file_subscrible_check(SF_REPORT_FILE_ATTR_S *pDtsReportFileAttr, + SF_REPORT_FILE_ATTR_S *pSrcReportFileAttr) { + SINT8 srcdex = 0; + SINT8 dtsdex = 0; + SF_REPORT_FILE_ATTR_S stReportFileAttr = {0}; + + memset(&stReportFileAttr, 0, sizeof(SF_REPORT_FILE_ATTR_S)); + + for (dtsdex = 0; dtsdex < pDtsReportFileAttr->filecnt; dtsdex++) { + for (srcdex = 0; srcdex < pSrcReportFileAttr->filecnt; srcdex++) { + if (!strncmp(pSrcReportFileAttr->stSendFileAttr[srcdex].SubFileName + 14, + pDtsReportFileAttr->stSendFileAttr[dtsdex].SubFileName + 14, + 12)) { + pDtsReportFileAttr->stSendFileAttr[dtsdex].SameFlag = 1; + } + } + if (pDtsReportFileAttr->stSendFileAttr[dtsdex].SameFlag == 1) + continue; + memcpy(&stReportFileAttr.stSendFileAttr[stReportFileAttr.filecnt], + &pDtsReportFileAttr->stSendFileAttr[dtsdex], + sizeof(SF_SEND_FILE_ATTR_S)); + MLOGI( + "filecnt:%d,filetype:%d,main:[%s],sub:[%s]\n", stReportFileAttr.filecnt, + stReportFileAttr.stSendFileAttr[stReportFileAttr.filecnt].enFileTye, + stReportFileAttr.stSendFileAttr[stReportFileAttr.filecnt].SubFileName, + stReportFileAttr.stSendFileAttr[stReportFileAttr.filecnt].SendFileName); + stReportFileAttr.filecnt += 1; + } + + memset(sf_get_sub_report_file_attr(), 0, sizeof(SF_REPORT_FILE_ATTR_S)); + memcpy(sf_get_sub_report_file_attr(), &stReportFileAttr, + sizeof(SF_REPORT_FILE_ATTR_S)); + + return SF_SUCCESS; } -static SINT32 app_file_subscrible_execute(SF_FN_PARAM_S *pfnParam) -{ - SINT32 s32ret = SF_SUCCESS; - - MLOGD("Query HD pic or video\n"); - SF_REPORT_FILE_ATTR_S stReportFileAttr = {0}; - - do { - - MLOGD("filecnt:%d\n", sf_get_sub_report_file_attr()->filecnt); - memset(&stReportFileAttr, 0, sizeof(SF_REPORT_FILE_ATTR_S)); - - s32ret = sf_file_sub_send(pfnParam, sf_get_sub_report_file_attr()); - SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_NO_SUPPOET); - - memcpy(&stReportFileAttr,sf_get_sub_report_file_attr(), sizeof(SF_REPORT_FILE_ATTR_S)); - memset(sf_get_sub_report_file_attr(), 0, sizeof(SF_REPORT_FILE_ATTR_S)); +static SINT32 app_file_subscrible_execute(SF_FN_PARAM_S *pfnParam) { + SINT32 s32ret = SF_SUCCESS; - s32ret = sf_4G_server_open(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_NO_SUPPOET); - - s32ret = app_server_querystatus(SF_CMD_PHOTO_RESULT, pfnParam, &stReportFileAttr); - if(s32ret != SF_SUCCESS ) { - s32ret = app_server_querystatus(SF_CMD_LOGIN_IN, pfnParam,SF_NULL); - SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_NO_SUPPOET); - - s32ret = app_server_querystatus(SF_CMD_PHOTO_RESULT, pfnParam, &stReportFileAttr); -// s32ret = app_file_subscrible_check(sf_get_sub_report_file_attr(),&stReportFileAttr); - - } - s32ret = sf_4G_server_close(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_NO_SUPPOET); - - }while(sf_get_sub_report_file_attr()->filecnt > 0); + MLOGD("Query HD pic or video\n"); + SF_REPORT_FILE_ATTR_S stReportFileAttr = {0}; - return s32ret; + do { + + MLOGD("filecnt:%d\n", sf_get_sub_report_file_attr()->filecnt); + memset(&stReportFileAttr, 0, sizeof(SF_REPORT_FILE_ATTR_S)); + + s32ret = sf_file_sub_send(pfnParam, sf_get_sub_report_file_attr()); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_NO_SUPPOET); + + memcpy(&stReportFileAttr, sf_get_sub_report_file_attr(), + sizeof(SF_REPORT_FILE_ATTR_S)); + memset(sf_get_sub_report_file_attr(), 0, sizeof(SF_REPORT_FILE_ATTR_S)); + + s32ret = sf_4G_server_open(pfnParam); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_NO_SUPPOET); + + s32ret = app_server_querystatus(SF_CMD_PHOTO_RESULT, pfnParam, + &stReportFileAttr); + if (s32ret != SF_SUCCESS) { + s32ret = app_server_querystatus(SF_CMD_LOGIN_IN, pfnParam, SF_NULL); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_NO_SUPPOET); + + s32ret = app_server_querystatus(SF_CMD_PHOTO_RESULT, pfnParam, + &stReportFileAttr); + // s32ret = + //app_file_subscrible_check(sf_get_sub_report_file_attr(),&stReportFileAttr); + } + s32ret = sf_4G_server_close(pfnParam); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_NO_SUPPOET); + + } while (sf_get_sub_report_file_attr()->filecnt > 0); + + return s32ret; } -SINT32 app_server_excute_cmd(SF_FN_PARAM_S *pfnParam) -{ - SINT32 ret = SF_SUCCESS; - SF_PDT_PARAM_CFG_S *pParam = (SF_PDT_PARAM_CFG_S*)pfnParam->pstParam; - //SF_PDT_PARAM_STATISTICS_S *pstaticParam = (SF_PDT_PARAM_STATISTICS_S*)pfnParam->pstaticParam; - - - if(sf_get_login_reponse()->synConfigCommand == 1) { - - pParam->ParaSync = 0; - - ret = sf_4G_server_open(pfnParam); - SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); - - ret = app_server_querystatus(SF_CMD_SYNC_CFG, pfnParam, SF_NULL); - SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); - - ret = sf_4G_server_close(pfnParam); - } - - if(pParam->ParaSync) { - ret = sf_4G_server_open(pfnParam); - SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); - - ret = app_server_querystatus(SF_CMD_SYNC_CFG, pfnParam, SF_NULL); - SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); - - ret = sf_4G_server_close(pfnParam); - } +SINT32 app_server_excute_cmd(SF_FN_PARAM_S *pfnParam) { + SINT32 ret = SF_SUCCESS; + SF_PDT_PARAM_CFG_S *pParam = (SF_PDT_PARAM_CFG_S *)pfnParam->pstParam; + // SF_PDT_PARAM_STATISTICS_S *pstaticParam = + // (SF_PDT_PARAM_STATISTICS_S*)pfnParam->pstaticParam; - if(sf_get_sub_report_file_attr()->filecnt > 0 ) { - ret = app_file_subscrible_execute(pfnParam); - } - - if(sf_get_login_reponse()->otaCommand == 1) - { - ret = app_upgrade_ota_execute(); - sf_get_login_reponse()->otaCommand = 0; - } - - if(sf_get_login_reponse()->sdFormatCommand == 1) { - - if(sf_sd_status_get() != SF_SD_OUT) { - system("echo format > /tmp/cardv_fifo"); - sleep(2); - } - else { - sf_get_login_reponse()->sdFormatCommand = 0; - } - - ret = sf_4G_server_open(pfnParam); - SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); - pParam->ParaSync = 1; - ret = app_server_querystatus(SF_CMD_SYNC_CFG, pfnParam, SF_NULL); - SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); - - ret = sf_4G_server_close(pfnParam); - } + if (sf_get_login_reponse()->synConfigCommand == 1) { - if(sf_get_login_reponse()->devResetCommand == 1) { + pParam->ParaSync = 0; - ret = sf_4G_server_open(pfnParam); - SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); - pParam->ParaSync = 1; - ret = app_server_querystatus(SF_CMD_SYNC_CFG, pfnParam, SF_NULL); - SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); - - ret = sf_4G_server_close(pfnParam); - - sf_all_param_reset(); - - SF_MESSAGE_BUF_S stMessageBuf = {0}; - stMessageBuf.arg1 = SF_POWEROFF_SYNC_PARAM; - stMessageBuf.cmdId = CMD_POWEROFF; - sf_com_message_send_to_app(&stMessageBuf); - } - - return ret; -} + ret = sf_4G_server_open(pfnParam); + SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); -SINT32 app_realtime_resetlimited(SF_PDT_PARAM_STATISTICS_S *pstaticparam,UINT8 GprsMode) -{ - SINT16 s32ret = SF_SUCCESS; - if(sf_poweron_type_get() == SF_MCU_STARTUP_RESET) - pstaticparam->u8ResetLimited++; - - SLOGD("u8ResetLimited:%x\n", pstaticparam->u8ResetLimited); - return s32ret; -} + ret = app_server_querystatus(SF_CMD_SYNC_CFG, pfnParam, SF_NULL); + SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); -SINT16 app_http_IsAuthenrequst(SF_FN_PARAM_S *pfnParam) -{ - SINT16 s32ret = SF_SUCCESS; - SF_CHAR tempIccic[22] = { 0 }; - SF_PDT_PARAM_STATISTICS_S *pstaticparam = (SF_PDT_PARAM_STATISTICS_S *)pfnParam->pstaticParam; - sf_4G_iccid_get(tempIccic,pfnParam); - MLOGD("Sim changed. old:%s, new:%s\n", pstaticparam->SimID, tempIccic); - if(!(strstr(pstaticparam->SimID, tempIccic))||pstaticparam->u8ResetLimited > 3 || pstaticparam->AcmIP[0] == '\0') - { - pstaticparam->u8ResetLimited = 0; -// s32ret = sf_4G_http_config(pfnParam, 1, 1); - s32ret |= sf_4G_http_authenrequst(pfnParam); - } - return s32ret; -} + ret = sf_4G_server_close(pfnParam); + } -SINT16 sf_send_pic_num_check(void) -{ - static UINT8 doFirst = 1; - SF_PARA_TIME_S date; - SF_PDT_PARAM_STATISTICS_S *sim_info_t2 = sf_statistics_param_get(); - SF_PDT_PARAM_CFG_S *sim_info_t = sf_customer_param_get(); + if (pParam->ParaSync) { + ret = sf_4G_server_open(pfnParam); + SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); - sf_sys_rtc_time_get(&date); - MLOGD("rtc date: %04d/%02d/%02d %02d:%02d:%02d\n", date.Year, date.Mon, date.Day, date.Hour, date.Min, date.Sec); - MLOGD("reocrd date: %04d/%02d/%02d\n", sim_info_t2->Year, sim_info_t2->Mon, sim_info_t2->Day); - if(doFirst) // avoid called twice nearly 00:00 - { - doFirst = 0; - if((date.Year != sim_info_t2->Year) || (date.Mon != sim_info_t2->Mon) || (date.Day != sim_info_t2->Day)) - { - MLOGD("new day, refresh counter!\n"); - sim_info_t2->SendPicDayCnt = 0; + ret = app_server_querystatus(SF_CMD_SYNC_CFG, pfnParam, SF_NULL); + SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); - sim_info_t2->Year = date.Year; - sim_info_t2->Mon = date.Mon; - sim_info_t2->Day = date.Day; - } + ret = sf_4G_server_close(pfnParam); + } + + if (sf_get_sub_report_file_attr()->filecnt > 0) { + ret = app_file_subscrible_execute(pfnParam); + } + + if (sf_get_login_reponse()->otaCommand == 1) { + ret = app_upgrade_ota_execute(); + sf_get_login_reponse()->otaCommand = 0; + } + + if (sf_get_login_reponse()->sdFormatCommand == 1) { + + if (sf_sd_status_get() != SF_SD_OUT) { + system("echo format > /tmp/cardv_fifo"); + sleep(2); + } else { + sf_get_login_reponse()->sdFormatCommand = 0; } - MLOGD("SendMaxNum:%d, SendPicDayCnt:%d\n",sim_info_t->SendMaxNum, sim_info_t2->SendPicDayCnt); - if(sim_info_t->SendMaxNum == 0)/* unlimit*/ - { - sim_info_t2->Year = date.Year; - sim_info_t2->Mon = date.Mon; - sim_info_t2->Day = date.Day; - return SF_SUCCESS; - } - else - { - if(sim_info_t2->SendPicDayCnt SendMaxNum) - { - return SF_SUCCESS; - } - else if((sf_poweron_type_get() == SF_MCU_STARTUP_PIR) || (sf_poweron_type_get() == SF_MCU_STARTUP_TIMELAPSE)) - { - return SF_FAILURE; - } - } + ret = sf_4G_server_open(pfnParam); + SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); + pParam->ParaSync = 1; + ret = app_server_querystatus(SF_CMD_SYNC_CFG, pfnParam, SF_NULL); + SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); + + ret = sf_4G_server_close(pfnParam); + } + + if (sf_get_login_reponse()->devResetCommand == 1) { + + ret = sf_4G_server_open(pfnParam); + SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); + pParam->ParaSync = 1; + ret = app_server_querystatus(SF_CMD_SYNC_CFG, pfnParam, SF_NULL); + SF_APPCOMM_CHECK_RETURN(ret, SF_APP_ERROR_NO_SUPPOET); + + ret = sf_4G_server_close(pfnParam); + + sf_all_param_reset(); + + SF_MESSAGE_BUF_S stMessageBuf = {0}; + stMessageBuf.arg1 = SF_POWEROFF_SYNC_PARAM; + stMessageBuf.cmdId = CMD_POWEROFF; + sf_com_message_send_to_app(&stMessageBuf); + } + + return ret; } -SINT32 app_file_send_check( SF_PDT_PARAM_STATISTICS_S *pstaticparam) -{ - SINT16 ret = 0; - - if(!sf_4G_sim_IsInsert()) - return SF_FAILURE; - MLOGI("Apn = [%s]\n,WebIP = [%s]\n,AcmIP = [%s]\n",pstaticparam->ApnGPRS,pstaticparam->WebIP,pstaticparam->AcmIP); - if((pstaticparam->ApnGPRS[0] != '\0')&& \ - (pstaticparam->WebIP[0] != '\0') && \ - (pstaticparam->AcmIP[0] != '\0')) - { - ret = sf_send_pic_num_check(); - return ret; - } - else - { - return SF_FAILURE; - } +SINT32 app_realtime_resetlimited(SF_PDT_PARAM_STATISTICS_S *pstaticparam, + UINT8 GprsMode) { + SINT16 s32ret = SF_SUCCESS; + if (sf_poweron_type_get() == SF_MCU_STARTUP_RESET) + pstaticparam->u8ResetLimited++; + SLOGD("u8ResetLimited:%x\n", pstaticparam->u8ResetLimited); + return s32ret; } -SINT16 sf_thumb_file_creat(void) -{ - - SF_CHAR sysCmd[256] = { 0 }; - SF_CHAR dirKeyStr[4] = { 0 }; - SF_CHAR fileKeyStr[10] = { 0 }; - SF_CHAR filePathStr[128] = { 0 }; - SINT16 fileIndex = 0; - SF_SRCFILE_ATTR_S* fileCfg = sf_file_thumb_cfg_get(); - - for(fileIndex = 0; fileIndex < fileCfg->filecnt; fileIndex++) - { - if(strstr(fileCfg->stfileattr[fileIndex].thumbfileName, SF_DCF_EXT_PHOTO)) - { - 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, dirKeyStr, SF_DCF_DIR_NAME_SUFFIX, SF_DCF_FILE_NAME_PREFIX, fileKeyStr); - MLOGD("fileKeyStr:%s\n", filePathStr); - //check if pic exist - if(sf_file_IsExsit(filePathStr) == SF_TRUE) - { - sprintf(sysCmd, "/customer/bin/ffmpeg -i %s -v quiet -y -s 640*360 %s", filePathStr, fileCfg->stfileattr[fileIndex].thumbfilePath); - MLOGD("[%s,%d]cmd: %s\n", __FUNCTION__, __LINE__, sysCmd); - system(sysCmd); - break; - } - } - } - - return SF_SUCCESS; +SINT16 app_http_IsAuthenrequst(SF_FN_PARAM_S *pfnParam) { + SINT16 s32ret = SF_SUCCESS; + SF_CHAR tempIccic[22] = {0}; + SF_PDT_PARAM_STATISTICS_S *pstaticparam = + (SF_PDT_PARAM_STATISTICS_S *)pfnParam->pstaticParam; + sf_4G_iccid_get(tempIccic, pfnParam); + MLOGD("Sim changed. old:%s, new:%s\n", pstaticparam->SimID, tempIccic); + if (!(strstr(pstaticparam->SimID, tempIccic)) || + pstaticparam->u8ResetLimited > 3 || pstaticparam->AcmIP[0] == '\0') { + pstaticparam->u8ResetLimited = 0; + // s32ret = sf_4G_http_config(pfnParam, 1, 1); + s32ret |= sf_4G_http_authenrequst(pfnParam); + } + return s32ret; } +SINT16 sf_send_pic_num_check(void) { + static UINT8 doFirst = 1; + SF_PARA_TIME_S date; + SF_PDT_PARAM_STATISTICS_S *sim_info_t2 = sf_statistics_param_get(); + SF_PDT_PARAM_CFG_S *sim_info_t = sf_customer_param_get(); -SINT32 app_file_upload(SF_FILE_ATTR_S *pstFileAttr, SF_FN_PARAM_S *pfnParam) -{ - SINT32 s32ret = SF_FAILURE; - SINT32 fileSize = 0; - SF_PDT_PARAM_STATISTICS_S *sfParam = pfnParam->pstaticParam; - -// if(sf_data_transfer_mode_get() != SF_UPLOAD_AMZ) { -// MLOGE("file transfer mode [%d] is SF_UPLOAD_AMZ\n",sf_data_transfer_mode_get()); -// SF_APPCOMM_CHECK_RETURN(SF_FAILURE,SF_APP_ERROR_NO_SUPPOET); -// } - s32ret = app_http_time_by_timezone_set(); + sf_sys_rtc_time_get(&date); + MLOGD("rtc date: %04d/%02d/%02d %02d:%02d:%02d\n", date.Year, date.Mon, + date.Day, date.Hour, date.Min, date.Sec); + MLOGD("reocrd date: %04d/%02d/%02d\n", sim_info_t2->Year, sim_info_t2->Mon, + sim_info_t2->Day); + if (doFirst) // avoid called twice nearly 00:00 + { + doFirst = 0; + if ((date.Year != sim_info_t2->Year) || (date.Mon != sim_info_t2->Mon) || + (date.Day != sim_info_t2->Day)) { + MLOGD("new day, refresh counter!\n"); + sim_info_t2->SendPicDayCnt = 0; - s32ret = sf_file_http_header_add(pstFileAttr, sfParam); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_WRITE); - - s32ret = sf_file_txt_fill(pstFileAttr); - if(s32ret != SF_SUCCESS) - sf_file_remove(pstFileAttr->txtfilePath); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_WRITE); - - s32ret = sf_4G_file_transfer(pstFileAttr->txtfilePath, &fileSize, pstFileAttr->enFileTye); - if(s32ret == SF_FAILURE) - { - SLOGE("upload file to 4G module fail!\n"); - sf_file_remove(pstFileAttr->txtfilePath); - return SF_APP_ERROR_FILE_SEND; + sim_info_t2->Year = date.Year; + sim_info_t2->Mon = date.Mon; + sim_info_t2->Day = date.Day; } + } - s32ret = sf_4G_http_pushfile(pstFileAttr, pfnParam); - s32ret |= sf_file_remove(pstFileAttr->txtfilePath); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_FILE_SEND); - SLOGD("HTTP UPLOAD Complete.s32ret=%d\n", s32ret); - - return s32ret; + MLOGD("SendMaxNum:%d, SendPicDayCnt:%d\n", sim_info_t->SendMaxNum, + sim_info_t2->SendPicDayCnt); + if (sim_info_t->SendMaxNum == 0) /* unlimit*/ + { + sim_info_t2->Year = date.Year; + sim_info_t2->Mon = date.Mon; + sim_info_t2->Day = date.Day; + return SF_SUCCESS; + } else { + if (sim_info_t2->SendPicDayCnt < sim_info_t->SendMaxNum) { + return SF_SUCCESS; + } else if ((sf_poweron_type_get() == SF_MCU_STARTUP_PIR) || + (sf_poweron_type_get() == SF_MCU_STARTUP_TIMELAPSE)) { + return SF_FAILURE; + } + } } -SINT32 app_file_thumbsend(SF_FN_PARAM_S *pfnParam) -{ - SINT16 fileIndex = 0; - SINT32 s32ret = SF_SUCCESS; - SINT16 startMode = 0; - - SF_SRCFILE_ATTR_S* pfileCfg = sf_file_thumb_cfg_get(); - - SF_PDT_PARAM_CFG_S *pCustomerParam = (SF_PDT_PARAM_CFG_S*)pfnParam->pstParam; - SF_PDT_PARAM_STATISTICS_S *pStaticParam = (SF_PDT_PARAM_STATISTICS_S*)pfnParam->pstaticParam; - #if !defined(CFG_TRANSDATA_AT) - SF_REPORT_FILE_ATTR_S *pThmReportFileAttr = sf_get_thm_report_file_attr(); - pThmReportFileAttr->filecnt = 0; - #endif - startMode = sf_poweron_type_get(); +SINT32 app_file_send_check(SF_PDT_PARAM_STATISTICS_S *pstaticparam) { + SINT16 ret = 0; - SF_COMM_CHECK_POINTER(pfileCfg,SF_FAILURE); - - /*if no pic,return*/ - if(pfileCfg->filecnt == 0) - { - SLOGE("fileCnt:[%d]\n", pfileCfg->filecnt); - return SF_FAILURE; + if (!sf_4G_sim_IsInsert()) + return SF_FAILURE; + MLOGI("Apn = [%s]\n,WebIP = [%s]\n,AcmIP = [%s]\n", pstaticparam->ApnGPRS, + pstaticparam->WebIP, pstaticparam->AcmIP); + if ((pstaticparam->ApnGPRS[0] != '\0') && (pstaticparam->WebIP[0] != '\0') && + (pstaticparam->AcmIP[0] != '\0')) { + ret = sf_send_pic_num_check(); + return ret; + } else { + return SF_FAILURE; + } +} + +SINT16 sf_thumb_file_creat(void) { + + SF_CHAR sysCmd[256] = {0}; + SF_CHAR dirKeyStr[4] = {0}; + SF_CHAR fileKeyStr[10] = {0}; + SF_CHAR filePathStr[128] = {0}; + SINT16 fileIndex = 0; + SF_SRCFILE_ATTR_S *fileCfg = sf_file_thumb_cfg_get(); + + for (fileIndex = 0; fileIndex < fileCfg->filecnt; fileIndex++) { + if (strstr(fileCfg->stfileattr[fileIndex].thumbfileName, + SF_DCF_EXT_PHOTO)) { + 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, + dirKeyStr, SF_DCF_DIR_NAME_SUFFIX, SF_DCF_FILE_NAME_PREFIX, + fileKeyStr); + MLOGD("fileKeyStr:%s\n", filePathStr); + // check if pic exist + if (sf_file_IsExsit(filePathStr) == SF_TRUE) { + sprintf(sysCmd, "/customer/bin/ffmpeg -i %s -v quiet -y -s 640*360 %s", + filePathStr, fileCfg->stfileattr[fileIndex].thumbfilePath); + MLOGD("[%s,%d]cmd: %s\n", __FUNCTION__, __LINE__, sysCmd); + system(sysCmd); + break; + } } - - MLOGI("fileCnt:[%d]\n", pfileCfg->filecnt); - for(fileIndex = 0; fileIndex < pfileCfg->filecnt; fileIndex++) - { - SLOGD("SendMaxNum:[%d],fileIndex:[%d]\n", pCustomerParam->SendMaxNum,fileIndex); - SLOGI("fileCnt:[%d]\n", pfileCfg->filecnt); - if((startMode == SF_MCU_STARTUP_TIMELAPSE) || (startMode == SF_MCU_STARTUP_PIR)) - { - if((pCustomerParam->SendMaxNum > 0) && \ - (pStaticParam->SendPicDayCnt >= pCustomerParam->SendMaxNum)) - { - MLOGW("SendMaxNum:[%d] is equal to SendPicDayCnt[%d]\n", pCustomerParam->SendMaxNum, pStaticParam->SendPicDayCnt); - if(pThmReportFileAttr->filecnt <= 0) - return SF_SUCCESS; - break; - } - } - - switch(startMode) - { - case SF_MCU_STARTUP_OFF: - break; - case SF_MCU_STARTUP_ONKEY: - if(pCustomerParam->CamMode != SF_CAMMODE_PV) - fileIndex = pfileCfg->filecnt - 1;//if set up mode,only send the latest pic - break; - - case SF_MCU_STARTUP_RING: - case SF_MCU_STARTUP_TIMELAPSE: - case SF_MCU_STARTUP_PIR: - case SF_MCU_STARTUP_NORMAL: - case SF_MCU_STARTUP_WARNING: - case SF_MCU_STARTUP_SERVER: - case SF_MCU_STARTUP_DP: - case SF_MCU_STARTUP_USB: - case SF_MCU_STARTUP_RESET: - case SF_MCU_STARTUP_SYN_PARAM: - case SF_MCU_STARTUP_BATCH_SEND: - MLOGI("CamMode :%d\n",pCustomerParam->CamMode); - if(pCustomerParam->CamMode == SF_CAMMODE_PIC) - { - if(pCustomerParam->Multishot > 1) - pfileCfg->filecnt = 1; - } - if(pCustomerParam->CamMode == SF_CAMMODE_PV) - { - fileIndex = fileIndex < 1 ? fileIndex : pCustomerParam->Multishot; - pfileCfg->filecnt = 2; - } - break; - default: - break; - } - - s32ret |= app_file_upload(&pfileCfg->stfileattr[fileIndex],pfnParam); - if(s32ret != SF_SUCCESS) { - sf_file_remove(pfileCfg->stfileattr[fileIndex].thumbfilePath); - continue; - } - - { - pStaticParam->SendPicDayCnt++; - pStaticParam->SendSuccessThumbCnt++; - SLOGD("SendPicDayCnt:%d\n", pStaticParam->SendPicDayCnt); + } - /*file send success, copy file info to report file cfg*/ - memset(pThmReportFileAttr->stSendFileAttr[pThmReportFileAttr->filecnt].SendFileName, '\0', sizeof(pThmReportFileAttr->stSendFileAttr[0].SendFileName)); - memset(pThmReportFileAttr->stSendFileAttr[pThmReportFileAttr->filecnt].SubFileName, '\0', sizeof(pThmReportFileAttr->stSendFileAttr[0].SubFileName)); + return SF_SUCCESS; +} - sprintf(pThmReportFileAttr->stSendFileAttr[pThmReportFileAttr->filecnt].SendFileName, "%s", pfileCfg->stfileattr[fileIndex].thumbfileName); - pThmReportFileAttr->stSendFileAttr[pThmReportFileAttr->filecnt].enFileTye = pfileCfg->stfileattr[fileIndex].enFileTye; - pThmReportFileAttr->stSendFileAttr[pThmReportFileAttr->filecnt].SendFileSize = pfileCfg->stfileattr[fileIndex].thumbfileSize; - pThmReportFileAttr->stSendFileAttr[pThmReportFileAttr->filecnt].SendRet = 0; - pThmReportFileAttr->filecnt += 1; - } - sf_file_remove(pfileCfg->stfileattr[fileIndex].thumbfilePath); +SINT32 app_file_upload(SF_FILE_ATTR_S *pstFileAttr, SF_FN_PARAM_S *pfnParam) { + SINT32 s32ret = SF_FAILURE; + SINT32 fileSize = 0; + SF_PDT_PARAM_STATISTICS_S *sfParam = pfnParam->pstaticParam; + + // if(sf_data_transfer_mode_get() != SF_UPLOAD_AMZ) { + // MLOGE("file transfer mode [%d] is + //SF_UPLOAD_AMZ\n",sf_data_transfer_mode_get()); + // SF_APPCOMM_CHECK_RETURN(SF_FAILURE,SF_APP_ERROR_NO_SUPPOET); + // } + s32ret = app_http_time_by_timezone_set(); + + s32ret = sf_file_http_header_add(pstFileAttr, sfParam); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_WRITE); + + s32ret = sf_file_txt_fill(pstFileAttr); + if (s32ret != SF_SUCCESS) + sf_file_remove(pstFileAttr->txtfilePath); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_WRITE); + + s32ret = sf_4G_file_transfer(pstFileAttr->txtfilePath, &fileSize, + pstFileAttr->enFileTye); + if (s32ret == SF_FAILURE) { + SLOGE("upload file to 4G module fail!\n"); + sf_file_remove(pstFileAttr->txtfilePath); + return SF_APP_ERROR_FILE_SEND; + } + + s32ret = sf_4G_http_pushfile(pstFileAttr, pfnParam); + s32ret |= sf_file_remove(pstFileAttr->txtfilePath); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_FILE_SEND); + SLOGD("HTTP UPLOAD Complete.s32ret=%d\n", s32ret); + + return s32ret; +} + +SINT32 app_file_thumbsend(SF_FN_PARAM_S *pfnParam) { + SINT16 fileIndex = 0; + SINT32 s32ret = SF_SUCCESS; + SINT16 startMode = 0; + + SF_SRCFILE_ATTR_S *pfileCfg = sf_file_thumb_cfg_get(); + + SF_PDT_PARAM_CFG_S *pCustomerParam = (SF_PDT_PARAM_CFG_S *)pfnParam->pstParam; + SF_PDT_PARAM_STATISTICS_S *pStaticParam = + (SF_PDT_PARAM_STATISTICS_S *)pfnParam->pstaticParam; +#if !defined(CFG_TRANSDATA_AT) + SF_REPORT_FILE_ATTR_S *pThmReportFileAttr = sf_get_thm_report_file_attr(); + pThmReportFileAttr->filecnt = 0; +#endif + startMode = sf_poweron_type_get(); + + SF_COMM_CHECK_POINTER(pfileCfg, SF_FAILURE); + + /*if no pic,return*/ + if (pfileCfg->filecnt == 0) { + SLOGE("fileCnt:[%d]\n", pfileCfg->filecnt); + return SF_FAILURE; + } + + MLOGI("fileCnt:[%d]\n", pfileCfg->filecnt); + for (fileIndex = 0; fileIndex < pfileCfg->filecnt; fileIndex++) { + SLOGD("SendMaxNum:[%d],fileIndex:[%d]\n", pCustomerParam->SendMaxNum, + fileIndex); + SLOGI("fileCnt:[%d]\n", pfileCfg->filecnt); + if ((startMode == SF_MCU_STARTUP_TIMELAPSE) || + (startMode == SF_MCU_STARTUP_PIR)) { + if ((pCustomerParam->SendMaxNum > 0) && + (pStaticParam->SendPicDayCnt >= pCustomerParam->SendMaxNum)) { + MLOGW("SendMaxNum:[%d] is equal to SendPicDayCnt[%d]\n", + pCustomerParam->SendMaxNum, pStaticParam->SendPicDayCnt); + if (pThmReportFileAttr->filecnt <= 0) + return SF_SUCCESS; + break; + } } - if(pThmReportFileAttr->filecnt <= 0) { - sf_file_thumb_cfg_clear(); - return s32ret; - } - - s32ret = sf_4G_server_open(pfnParam); - if(s32ret != SF_SUCCESS) { - SLOGE("Error Code: [0x%08X]\n\n", s32ret); - goto exception_handling; - } - - s32ret = app_server_querystatus(SF_CMD_PHOTO_RESULT, pfnParam, pThmReportFileAttr); - if(s32ret != SF_SUCCESS) { - s32ret = app_server_querystatus(SF_CMD_LOGIN_IN,pfnParam,SF_NULL); - if(s32ret != SF_SUCCESS) { - MLOGE("Error Code: [0x%08X]\n\n", s32ret); - goto exception_handling; - } - if(pStaticParam->PicPlan == 1) { - s32ret = app_server_querystatus(SF_CMD_PHOTO_RESULT, pfnParam, pThmReportFileAttr); - if(s32ret != SF_SUCCESS) { - MLOGE("Error Code: [0x%08X]\n\n", s32ret); - goto exception_handling; - } - } - } - - pThmReportFileAttr->filecnt = 0; - sf_file_thumb_cfg_clear(); + switch (startMode) { + case SF_MCU_STARTUP_OFF: + break; + case SF_MCU_STARTUP_ONKEY: + if (pCustomerParam->CamMode != SF_CAMMODE_PV) + fileIndex = + pfileCfg->filecnt - 1; // if set up mode,only send the latest pic + break; + + case SF_MCU_STARTUP_RING: + case SF_MCU_STARTUP_TIMELAPSE: + case SF_MCU_STARTUP_PIR: + case SF_MCU_STARTUP_NORMAL: + case SF_MCU_STARTUP_WARNING: + case SF_MCU_STARTUP_SERVER: + case SF_MCU_STARTUP_DP: + case SF_MCU_STARTUP_USB: + case SF_MCU_STARTUP_RESET: + case SF_MCU_STARTUP_SYN_PARAM: + case SF_MCU_STARTUP_BATCH_SEND: + MLOGI("CamMode :%d\n", pCustomerParam->CamMode); + if (pCustomerParam->CamMode == SF_CAMMODE_PIC) { + if (pCustomerParam->Multishot > 1) + pfileCfg->filecnt = 1; + } + if (pCustomerParam->CamMode == SF_CAMMODE_PV) { + fileIndex = fileIndex < 1 ? fileIndex : pCustomerParam->Multishot; + pfileCfg->filecnt = 2; + } + break; + default: + break; + } + + s32ret |= app_file_upload(&pfileCfg->stfileattr[fileIndex], pfnParam); + if (s32ret != SF_SUCCESS) { + sf_file_remove(pfileCfg->stfileattr[fileIndex].thumbfilePath); + continue; + } + + { + pStaticParam->SendPicDayCnt++; + pStaticParam->SendSuccessThumbCnt++; + SLOGD("SendPicDayCnt:%d\n", pStaticParam->SendPicDayCnt); + + /*file send success, copy file info to report file cfg*/ + memset(pThmReportFileAttr->stSendFileAttr[pThmReportFileAttr->filecnt] + .SendFileName, + '\0', sizeof(pThmReportFileAttr->stSendFileAttr[0].SendFileName)); + memset(pThmReportFileAttr->stSendFileAttr[pThmReportFileAttr->filecnt] + .SubFileName, + '\0', sizeof(pThmReportFileAttr->stSendFileAttr[0].SubFileName)); + + sprintf(pThmReportFileAttr->stSendFileAttr[pThmReportFileAttr->filecnt] + .SendFileName, + "%s", pfileCfg->stfileattr[fileIndex].thumbfileName); + pThmReportFileAttr->stSendFileAttr[pThmReportFileAttr->filecnt] + .enFileTye = pfileCfg->stfileattr[fileIndex].enFileTye; + pThmReportFileAttr->stSendFileAttr[pThmReportFileAttr->filecnt] + .SendFileSize = pfileCfg->stfileattr[fileIndex].thumbfileSize; + pThmReportFileAttr->stSendFileAttr[pThmReportFileAttr->filecnt].SendRet = + 0; + pThmReportFileAttr->filecnt += 1; + } + sf_file_remove(pfileCfg->stfileattr[fileIndex].thumbfilePath); + } + + if (pThmReportFileAttr->filecnt <= 0) { + sf_file_thumb_cfg_clear(); + return s32ret; + } + + s32ret = sf_4G_server_open(pfnParam); + if (s32ret != SF_SUCCESS) { + SLOGE("Error Code: [0x%08X]\n\n", s32ret); + goto exception_handling; + } + + s32ret = + app_server_querystatus(SF_CMD_PHOTO_RESULT, pfnParam, pThmReportFileAttr); + if (s32ret != SF_SUCCESS) { + s32ret = app_server_querystatus(SF_CMD_LOGIN_IN, pfnParam, SF_NULL); + if (s32ret != SF_SUCCESS) { + MLOGE("Error Code: [0x%08X]\n\n", s32ret); + goto exception_handling; + } + if (pStaticParam->PicPlan == 1) { + s32ret = app_server_querystatus(SF_CMD_PHOTO_RESULT, pfnParam, + pThmReportFileAttr); + if (s32ret != SF_SUCCESS) { + MLOGE("Error Code: [0x%08X]\n\n", s32ret); + goto exception_handling; + } + } + } + + pThmReportFileAttr->filecnt = 0; + sf_file_thumb_cfg_clear(); exception_handling: - s32ret = sf_4G_server_close(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_NO_SUPPOET); + s32ret = sf_4G_server_close(pfnParam); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_NO_SUPPOET); - return s32ret; - + return s32ret; } -SINT16 app_file_transfer_Error_return_server(SF_FN_PARAM_S *pfnParam) -{ - SINT32 s32ret = 0; - SF_MESSAGE_BUF_S stMessageBuf = {0}; - - - stMessageBuf.cmdId = CMD_LED; - stMessageBuf.arg1 = LED_STATUS_SLOWFLASH_ON; - stMessageBuf.arg2 = LED_GROUP_ACCOUNT; - stMessageBuf.arg3 = LED_TYPE_RED; - sf_com_message_send_to_app(&stMessageBuf); - - s32ret = sf_4G_server_close(pfnParam); - sf_4G_status_set(SF_4G_FREE); - - stMessageBuf.arg1 = (sf_poweron_type_get() == SF_MCU_STARTUP_RING)?SF_POWEROFF_SYNC_PARAM:SF_POWEROFF_NOT; - stMessageBuf.cmdId = CMD_POWEROFF; - sf_com_message_send_to_app(&stMessageBuf); +SINT16 app_file_transfer_Error_return_server(SF_FN_PARAM_S *pfnParam) { + SINT32 s32ret = 0; + SF_MESSAGE_BUF_S stMessageBuf = {0}; - return s32ret; + stMessageBuf.cmdId = CMD_LED; + stMessageBuf.arg1 = LED_STATUS_SLOWFLASH_ON; + stMessageBuf.arg2 = LED_GROUP_ACCOUNT; + stMessageBuf.arg3 = LED_TYPE_RED; + sf_com_message_send_to_app(&stMessageBuf); + + s32ret = sf_4G_server_close(pfnParam); + sf_4G_status_set(SF_4G_FREE); + + stMessageBuf.arg1 = (sf_poweron_type_get() == SF_MCU_STARTUP_RING) + ? SF_POWEROFF_SYNC_PARAM + : SF_POWEROFF_NOT; + stMessageBuf.cmdId = CMD_POWEROFF; + sf_com_message_send_to_app(&stMessageBuf); + + return s32ret; } -static SINT32 app_file_transfer(SF_FN_PARAM_S *pfnParam) -{ - SINT32 s32ret = 0; - //SF_MESSAGE_BUF_S stMessageBuf = {0}; - //UIMenuStoreInfo *pCustomerParam = pfnParam->pstParam; - //SF_PDT_PARAM_STATISTICS_S *pStaticParam = pfnParam->pstaticParam; - //UIMenuStoreInfo *pCustomerParam = pfnParam->pstParam; - UIMenuStoreInfo *pCustomerParam = sf_app_ui_para_get(); - if(sf_usb_IsInsert()) - return SF_SUCCESS; - - sf_4G_status_set(SF_4G_SENDING); - SLOGD("STARTUP:[%d]\n",sf_poweron_type_get()); - if(sf_get_cq_signal() == 0) - { - SLOGD("no csq signal\n"); - return SF_SUCCESS; - } +static SINT32 app_file_transfer(SF_FN_PARAM_S *pfnParam) { + SINT32 s32ret = 0; + // SF_MESSAGE_BUF_S stMessageBuf = {0}; + // UIMenuStoreInfo *pCustomerParam = pfnParam->pstParam; + // SF_PDT_PARAM_STATISTICS_S *pStaticParam = pfnParam->pstaticParam; + // UIMenuStoreInfo *pCustomerParam = pfnParam->pstParam; + UIMenuStoreInfo *pCustomerParam = sf_app_ui_para_get(); + if (sf_usb_IsInsert()) + return SF_SUCCESS; - switch(sf_poweron_type_get()) - { - case SF_MCU_STARTUP_OFF: - break; - case SF_MCU_STARTUP_ONKEY: - if(sf_get_signal_ready()) - { - sf_sys_status_led_set(SF_LED_SYS_STATE_SENDING); + sf_4G_status_set(SF_4G_SENDING); + SLOGD("STARTUP:[%d]\n", sf_poweron_type_get()); + if (sf_get_cq_signal() == 0) { + SLOGD("no csq signal\n"); + return SF_SUCCESS; + } - //sf_thumb_file_creat(); - - s32ret = sf_simcom_ftp_send(1); - - if(s32ret == SF_SUCCESS) { - sf_sys_status_led_set(SF_LED_SYS_STATE_SEND_SUCCESS); - } - else { - //FtpOpenOk = FAIL; - sf_sys_status_led_set(SF_LED_SYS_STATE_SEND_FAIL); - } - } - //sf_file_thumb_cfg_clear(); - //sf_share_mem_file_down(1); - sf_set_upload_to_module_flag(0);//test + switch (sf_poweron_type_get()) { + case SF_MCU_STARTUP_OFF: + break; + case SF_MCU_STARTUP_ONKEY: + if (sf_get_signal_ready()) { + sf_sys_status_led_set(SF_LED_SYS_STATE_SENDING); - break; + // sf_thumb_file_creat(); - case SF_MCU_STARTUP_TIMELAPSE: - case SF_MCU_STARTUP_PIR: - //sf_share_mem_file_init(); - if(TRUE == sf_check_auto_thumb_file()){ - s32ret = sf_simcom_ftp_send(1); - } + s32ret = sf_simcom_ftp_send(1); - break; - case SF_MCU_STARTUP_BATCH_SEND: - - break; + if (s32ret == SF_SUCCESS) { + sf_sys_status_led_set(SF_LED_SYS_STATE_SEND_SUCCESS); + } else { + // FtpOpenOk = FAIL; + sf_sys_status_led_set(SF_LED_SYS_STATE_SEND_FAIL); + } + } + // sf_file_thumb_cfg_clear(); + // sf_share_mem_file_down(1); + + break; + + case SF_MCU_STARTUP_TIMELAPSE: + case SF_MCU_STARTUP_PIR: + // sf_share_mem_file_init(); + if (TRUE == sf_check_auto_thumb_file()) { + s32ret = sf_simcom_ftp_send(1); + } + + break; + case SF_MCU_STARTUP_BATCH_SEND: + if (TRUE == sf_check_auto_thumb_file()) { + s32ret = sf_concentrated_ftp_send(); + } + break; #if 0 case SF_MCU_STARTUP_NORMAL: case SF_MCU_STARTUP_RING: @@ -1110,426 +1070,447 @@ static SINT32 app_file_transfer(SF_FN_PARAM_S *pfnParam) case SF_MCU_STARTUP_USB: case SF_MCU_STARTUP_RESET: - #endif - case SF_MCU_STARTUP_SYN_PARAM: - if(pCustomerParam->GpsSendFlag){ - s32ret = sf_simcom_ftp_send(2); - } - SLOGD("GpsSendFlag:%d\n", pCustomerParam->GpsSendFlag); - break; - default: - break; - } - SLOGD("s32ret:%x\n", s32ret); + case SF_MCU_STARTUP_RING: + if (sf_get_pic()) { + s32ret = sf_simcom_ftp_send(1); + } + break; + case SF_MCU_STARTUP_SYN_PARAM: + if (pCustomerParam->GpsSendFlag) { + s32ret = sf_simcom_ftp_send(2); + pCustomerParam->GpsSendFlag = 0; + } + if (sf_get_pic()) { + s32ret = sf_simcom_ftp_send(1); + } + SLOGD("GpsSendFlag:%d\n", pCustomerParam->GpsSendFlag); + break; + default: + break; + } + SLOGD("s32ret:%x\n", s32ret); sf_4G_status_set(SF_4G_FREE); return s32ret; - } -SINT32 app_FileSend_thread(void) -{ - SINT32 s32ret = 0; - SF_FN_PARAM_S stpfncallback = { 0 }; - stpfncallback.pstParam = sf_customer_param_get(); +SINT32 app_FileSend_thread(void) { + SINT32 s32ret = 0; + SF_FN_PARAM_S stpfncallback = {0}; + stpfncallback.pstParam = sf_customer_param_get(); stpfncallback.pstaticParam = sf_app_ui_para_get(); - //stpfncallback.pstaticParam = sf_statistics_param_get(); - stpfncallback.pfn_AT_instruction_exit = (void *)app_disconnect_4g_module; - - pthread_detach(pthread_self()); - + // stpfncallback.pstaticParam = sf_statistics_param_get(); + stpfncallback.pfn_AT_instruction_exit = (void *)app_disconnect_4g_module; + + pthread_detach(pthread_self()); + sf_share_mem_file_init(); - //s32ret = app_file_send_check(stpfncallback.pstaticParam); + // s32ret = app_file_send_check(stpfncallback.pstaticParam); s32ret = sf_check_ftp_send(1); - if(s32ret != SF_SUCCESS) - { - MLOGE("ERROR:%#x\n", s32ret); - ThumbSend.IsRun = 0; + if (s32ret != SF_SUCCESS) { + MLOGE("ERROR:%#x\n", s32ret); + ThumbSend.IsRun = 0; sf_file_thumb_cfg_clear(); sf_share_mem_file_down(1, s32ret); - return s32ret; - } + return s32ret; + } - s32ret = app_file_transfer(&stpfncallback); - if(s32ret != SF_SUCCESS) - { + s32ret = app_file_transfer(&stpfncallback); + if (s32ret != SF_SUCCESS) { sf_set_gprs_errno(s32ret); } - // app_file_transfer_Error_return_server(&stpfncallback); - ThumbSend.IsRun = 0; + // app_file_transfer_Error_return_server(&stpfncallback); + ThumbSend.IsRun = 0; sf_file_thumb_cfg_clear(); sf_share_mem_file_down(1, s32ret); - return s32ret; - - -} -static SINT32 app_Register_Net_Error_return_setup(SF_FN_PARAM_S *pfnParam,SINT32 s32ret) -{ - //SF_PDT_PARAM_STATISTICS_S *pStaticParam = pfnParam->pstaticParam; - - SLOGD("s32ret:%x\n", s32ret); - //SLOGD("bind flag:%x\n", pStaticParam->bindFlag); - if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) - { - if(SF_TRUE == sf_sys_rtc_time_check(&rtcTime)) - { - sf_sys_rtc_time_set(&rtcTime); - } - - app_led_net_reg_stop(s32ret); - }else{ + + if ((sf_poweron_type_get() != SF_MCU_STARTUP_ONKEY) && (sf_sms_check_send())) { sf_power_off(); - RegisterNetTskParam.IsRun = 0; - } - //pStaticParam->u8ResetLimited = 0; - sf_4G_status_set(SF_4G_FREE); - - return SF_SUCCESS; - + } + return s32ret; } -static SINT32 app_Register_Net_Error_return_init(SF_FN_PARAM_S *pfnParam) -{ - if(sf_poweron_type_get() != SF_MCU_STARTUP_ONKEY) - { - sf_power_off(); - } +static SINT32 app_Register_Net_Error_return_setup(SF_FN_PARAM_S *pfnParam, + SINT32 s32ret) { + // SF_PDT_PARAM_STATISTICS_S *pStaticParam = pfnParam->pstaticParam; - RegisterNetTskParam.IsRun = 0; - return SF_SUCCESS; + SLOGD("s32ret:%x\n", s32ret); + // SLOGD("bind flag:%x\n", pStaticParam->bindFlag); + if (sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) { + if (SF_TRUE == sf_sys_rtc_time_check(&rtcTime)) { + sf_sys_rtc_time_set(&rtcTime); + } -} - -static SINT32 app_Register_Net_Error_return_server(SF_FN_PARAM_S *pfnParam,SINT32 s32ret) -{ - SLOGE("s32ret:%#x\n", s32ret); - //SLOGD("bind flag:%x\n", pStaticParam->bindFlag); - if(sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) - { - if(SF_TRUE == sf_sys_rtc_time_check(&rtcTime)) - { - sf_sys_rtc_time_set(&rtcTime); - sf_sys_rtoscmd_set(4, NULL); //SET RTC time to rtos - } - - app_led_net_reg_stop(s32ret); - } - else - { + app_led_net_reg_stop(s32ret); + } + else if (!sf_sms_check_send()) { sf_power_off(); - } - RegisterNetTskParam.IsRun = 0; - - sf_4G_status_set(SF_4G_FREE); - return SF_SUCCESS; - -} -static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) -{ - SINT32 s32ret = 0; - //UINT8 timeCnt = 0; - //UINT8 bIsKeepConnect = 0; - //SF_CHAR version[12] = {0}; - //SF_MESSAGE_BUF_S stMessageBuf = {0}; - - //SF_PDT_PARAM_CFG_S *pCustomerParam = pfnParam->pstParam; - //SF_PDT_PARAM_STATISTICS_S *pStaticParam = pfnParam->pstaticParam; - UIMenuStoreInfo *pCustomerParam = sf_app_ui_para_get(); - sf_log_Level_set(SF_LOG_LEVEL_DEBUG); - - if(sf_usb_IsInsert()) - return SF_SUCCESS; - - sf_4G_status_set(SF_4G_SEARCHING); - - switch(sf_poweron_type_get()) - { - case SF_MCU_STARTUP_OFF: - break; - - case SF_MCU_STARTUP_ONKEY: - - #ifdef SF_HARDWARE_TEST - break; - #endif - - #ifdef SF_GPS_TEST - sf_commu_set_mcu(19, 1); - sf_commu_set_mcu(20 ,1); - sf_commu_set_mcu(84 ,1); - #endif - app_led_net_reg_start(); - - s32ret = app_ttyusb_IsOpen(); - SF_APPCOMM_CHECK_RETURN(s32ret,s32ret); - - s32ret = sf_4G_sim_init(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret,s32ret); - -// sf_sys_software_version_get(version); -// s32ret = sf_qrcode_create(pStaticParam->IMEI,pStaticParam->SimID ,version); - - s32ret = sf_4G_register_net_manual(pfnParam); - sf_share_mem_customer_down(1); - SF_APPCOMM_CHECK_RETURN(s32ret,s32ret); - - #ifdef SF_GPS_TEST - s32ret = app_gps_map_update(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_NO_SUPPOET); - - s32ret = app_gps_info_get(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_NO_SUPPOET); - - break; - #endif - - s32ret = sf_get_utc(); - if((s32ret == SF_SIM_ERROR_UTC) || (SF_ON == pCustomerParam->GpsSwitch)) - { - s32ret = sf_get_ntp(s32ret); - } - SF_APPCOMM_CHECK_RETURN(s32ret,s32ret); - - break; - - case SF_MCU_STARTUP_NORMAL: - break; - - case SF_MCU_STARTUP_RING: - - s32ret = sf_4G_sim_IsInsert(); - if(!s32ret) { - SF_APPCOMM_CHECK_RETURN(SF_FAILURE,SF_APP_ERROR_REQUEST); - } - - s32ret = app_ttyusb_IsOpen(); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - #if SF_QLOG_ENABLE - if(pCustomerParam->QLogSwitch == 1) - app_Qlog_procress(); - #endif - - s32ret = sf_4G_sim_init(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - s32ret = sf_4G_register_net_auto(pfnParam); - sf_share_mem_customer_down(1); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - s32ret = sf_read_message(); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - break; - - case SF_MCU_STARTUP_TIMELAPSE: - case SF_MCU_STARTUP_PIR: - - #ifdef SF_HARDWARE_TEST - app_system_poweroff(SF_POWEROFF_NOT); - break; - #endif - - - s32ret = sf_4G_sim_IsInsert(); - if(!s32ret) { - SF_APPCOMM_CHECK_RETURN(SF_FAILURE,SF_APP_ERROR_REQUEST); - } - - s32ret = app_ttyusb_IsOpen(); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - #if SF_QLOG_ENABLE - if(pCustomerParam->DebugMode == 1) - app_Qlog_procress(); - #endif - - s32ret = sf_4G_sim_init(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - s32ret = sf_4G_register_net_auto(pfnParam); - sf_share_mem_customer_down(1); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - //sf_thumb_file_creat(); - - //sf_4G_usb_net_apn_cfg(pfnParam); - //sf_USB_net_init(); - - //s32ret = app_http_IsAuthenrequst(pfnParam); - //SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - s32ret = app_FileSend_thread(); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - break; - case SF_MCU_STARTUP_WARNING: - - break; - case SF_MCU_STARTUP_SERVER: - - break; - case SF_MCU_STARTUP_DP: - - s32ret = app_ttyusb_IsOpen(); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - #if SF_QLOG_ENABLE - if(pCustomerParam->QLogSwitch == 1) - app_Qlog_procress(); - #endif - s32ret = sf_4G_sim_init(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - s32ret = sf_4G_register_net_manual(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - s32ret = sf_get_utc(); - if((s32ret == SF_SIM_ERROR_UTC) || (SF_ON == pCustomerParam->GpsSwitch)) - { - s32ret = sf_get_ntp(s32ret); - } - if(1 == pCustomerParam->NeedTimeSyncStartUp) - { - printf("[%s:%d]8 between A and B,no reg net again,no reset time sync.\n", __FUNCTION__, __LINE__); - sf_set_dr_reset_time_sys_flag(1); - } - - if(0 != sf_get_cq_signal()){ - pCustomerParam->NeedTimeSyncStartUp = 1; - } - if(pCustomerParam->DailyReportSwitch) - { - pCustomerParam->GpsSendFlag = 1;//indicate need send dp file in b power on. - } - sf_dailyReport_set(); - sf_share_mem_customer_down(1); - - break; - case SF_MCU_STARTUP_USB: - - break; - case SF_MCU_STARTUP_RESET: - - s32ret = app_ttyusb_IsOpen(); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - #if SF_QLOG_ENABLE - if(pCustomerParam->QLogSwitch == 1) - app_Qlog_procress(); - #endif - - s32ret = sf_4G_sim_init(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - s32ret = sf_4G_register_net_manual(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - s32ret = sf_get_utc(); - if((s32ret == SF_SIM_ERROR_UTC) || (SF_ON == pCustomerParam->GpsSwitch)) - { - s32ret = sf_get_ntp(s32ret); - } - if(0 != sf_get_cq_signal()){ - pCustomerParam->GpsSendFlag = 0; - pCustomerParam->NeedTimeSyncStartUp = 1; - //avoid always A mode power on - pCustomerParam->NetWorkNeedSearch = 0; - //printf("[%s:%d]NeedTimeSyncStartUp=%d\n", __FUNCTION__, __LINE__, pCustomerParam->NeedTimeSyncStartUp); - } - sf_dailyReport_set(); - sf_share_mem_customer_down(1); - break; - case SF_MCU_STARTUP_SYN_PARAM: - - s32ret = app_ttyusb_IsOpen(); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - s32ret = sf_4G_sim_init(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - s32ret = sf_4G_register_net_auto(pfnParam); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - s32ret = app_FileSend_thread(); - SF_APPCOMM_CHECK_RETURN(s32ret,SF_APP_ERROR_REQUEST); - - pCustomerParam->NetWorkNeedSearch = 0; - pCustomerParam->NeedTimeSyncStartUp = 0; - sf_share_mem_customer_down(1); - break; - case SF_MCU_STARTUP_BATCH_SEND: - - break; - default: - break; - } - - return s32ret; -} -void app_Register_Net_thread(void) -{ - SINT32 s32ret = 0; - SF_FN_PARAM_S stpfncallback = { 0 }; - stpfncallback.pstParam = sf_customer_param_get(); - stpfncallback.pstaticParam = sf_app_ui_para_get(); - //stpfncallback.pstaticParam = sf_statistics_param_get(); - stpfncallback.pfn_AT_instruction_exit = (void *)app_disconnect_4g_module; - - pthread_detach(pthread_self()); - s32ret = app_Register_Net_startup_mode(&stpfncallback); - switch(s32ret) - { - case SF_APP_ERROR_REQUEST: - app_Register_Net_Error_return_init(&stpfncallback); - break; - case SF_APP_ERROR_NO_SUPPOET: - app_Register_Net_Error_return_server(&stpfncallback,s32ret); - break; - default: - app_Register_Net_Error_return_setup(&stpfncallback,s32ret); - break; - } - return; -} - -void app_FileSend_start(void) -{ - - MLOGI("ThumbSend.IsRun:%d\n", ThumbSend.IsRun); - if(!ThumbSend.IsRun) - { - pthread_create(&ThumbSend.TskId, NULL, (void*)app_FileSend_thread, NULL); - ThumbSend.IsRun = 1; - SF_MUTEX_INIT_LOCK(ThumbSend.mutexLock); } + RegisterNetTskParam.IsRun = 0; + // pStaticParam->u8ResetLimited = 0; + sf_4G_status_set(SF_4G_FREE); + + return SF_SUCCESS; +} +static SINT32 app_Register_Net_Error_return_init(SF_FN_PARAM_S *pfnParam) { + if ((sf_poweron_type_get() != SF_MCU_STARTUP_ONKEY) && (!sf_sms_check_send())) { + sf_power_off(); + } + + RegisterNetTskParam.IsRun = 0; + return SF_SUCCESS; } -SINT32 app_RegisterNet_start(void) -{ - MLOGD("RegisterNetTskParams.IsRun:%d\n", RegisterNetTskParam.IsRun); - if(!RegisterNetTskParam.IsRun) - { - pthread_create(&RegisterNetTskParam.TskId, NULL, (void*)app_Register_Net_thread, NULL); - RegisterNetTskParam.IsRun = 1; - SF_MUTEX_INIT_LOCK(RegisterNetTskParam.mutexLock); +static SINT32 app_Register_Net_Error_return_server(SF_FN_PARAM_S *pfnParam, + SINT32 s32ret) { + SLOGE("s32ret:%#x\n", s32ret); + // SLOGD("bind flag:%x\n", pStaticParam->bindFlag); + if (sf_poweron_type_get() == SF_MCU_STARTUP_ONKEY) { + if (SF_TRUE == sf_sys_rtc_time_check(&rtcTime)) { + sf_sys_rtc_time_set(&rtcTime); + sf_sys_rtoscmd_set(4, NULL); // SET RTC time to rtos + } + + app_led_net_reg_stop(s32ret); } - return SF_SUCCESS; - + else if (!sf_sms_check_send()) { + sf_power_off(); + } + + RegisterNetTskParam.IsRun = 0; + + sf_4G_status_set(SF_4G_FREE); + return SF_SUCCESS; } -SINT32 app_t110(void) -{ - - SINT8 halvalue = 0; - SF_MUTEX_LOCK(GPIO_mutexLock); - sf_hal_gpio_init(SF_KEY_PIN_SYNC,GPIO_DIR_IN); - sf_hal_gpio_get(SF_KEY_PIN_SYNC,&halvalue); - SF_MUTEX_UNLOCK(GPIO_mutexLock); -// sf_hal_gpio_deinit(SF_KEY_PIN_SYNC); - MLOGI("halvalue: %d\n",halvalue); - if(halvalue == 0) - return SF_SUCCESS; - - app_RegisterNet_start(); - return SF_SUCCESS; - +static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) { + SINT32 s32ret = 0; + // UINT8 timeCnt = 0; + // UINT8 bIsKeepConnect = 0; + // SF_CHAR version[12] = {0}; + // SF_MESSAGE_BUF_S stMessageBuf = {0}; + + // SF_PDT_PARAM_CFG_S *pCustomerParam = pfnParam->pstParam; + // SF_PDT_PARAM_STATISTICS_S *pStaticParam = pfnParam->pstaticParam; + UIMenuStoreInfo *pCustomerParam = sf_app_ui_para_get(); + sf_log_Level_set(SF_LOG_LEVEL_DEBUG); + + if (sf_usb_IsInsert()) + return SF_SUCCESS; + + sf_4G_status_set(SF_4G_SEARCHING); + + switch (sf_poweron_type_get()) { + case SF_MCU_STARTUP_OFF: + break; + + case SF_MCU_STARTUP_ONKEY: + +#ifdef SF_HARDWARE_TEST + break; +#endif + +#ifdef SF_GPS_TEST + sf_commu_set_mcu(19, 1); + sf_commu_set_mcu(20, 1); + sf_commu_set_mcu(84, 1); +#endif + app_led_net_reg_start(); + + s32ret = app_ttyusb_IsOpen(); + SF_APPCOMM_CHECK_RETURN(s32ret, s32ret); + +#if SF_QLOG_ENABLE + if (pCustomerParam->QLogSwitch == 1) + app_Qlog_procress(); +#endif + + s32ret = sf_4G_sim_init(pfnParam); + SF_APPCOMM_CHECK_RETURN(s32ret, s32ret); + + // sf_sys_software_version_get(version); + // s32ret = sf_qrcode_create(pStaticParam->IMEI,pStaticParam->SimID + //,version); + + s32ret = sf_4G_register_net_manual(pfnParam); + sf_share_mem_customer_down(1); + SF_APPCOMM_CHECK_RETURN(s32ret, s32ret); + +#ifdef SF_GPS_TEST + s32ret = app_gps_map_update(pfnParam); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_NO_SUPPOET); + + s32ret = app_gps_info_get(pfnParam); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_NO_SUPPOET); + + break; +#endif + + s32ret = sf_get_utc(); + if ((s32ret == SF_SIM_ERROR_UTC) || (SF_ON == pCustomerParam->GpsSwitch)) { + s32ret = sf_get_ntp(s32ret); + } + SF_APPCOMM_CHECK_RETURN(s32ret, s32ret); + + break; + + case SF_MCU_STARTUP_NORMAL: + break; + + case SF_MCU_STARTUP_RING: + + s32ret = sf_4G_sim_IsInsert(); + if (!s32ret) { + SF_APPCOMM_CHECK_RETURN(SF_FAILURE, SF_APP_ERROR_REQUEST); + } + + s32ret = app_ttyusb_IsOpen(); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + +#if SF_QLOG_ENABLE + if (pCustomerParam->QLogSwitch == 1) + app_Qlog_procress(); +#endif + + s32ret = sf_4G_sim_init(pfnParam); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + + s32ret = sf_4G_register_net_auto(pfnParam); + sf_share_mem_customer_down(1); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + + s32ret = sf_read_message(); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + if (sf_get_pic()) { + sf_app_to_cardv_capture(); + } + break; + + case SF_MCU_STARTUP_TIMELAPSE: + case SF_MCU_STARTUP_PIR: + if (pCustomerParam->SendType != 0) { + break; + } + + case SF_MCU_STARTUP_BATCH_SEND: +#ifdef SF_HARDWARE_TEST + app_system_poweroff(SF_POWEROFF_NOT); + break; +#endif + + s32ret = sf_4G_sim_IsInsert(); + if (!s32ret) { + SF_APPCOMM_CHECK_RETURN(SF_FAILURE, SF_APP_ERROR_REQUEST); + } + + s32ret = app_ttyusb_IsOpen(); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + +#if SF_QLOG_ENABLE + if (pCustomerParam->QLogSwitch == 1) + app_Qlog_procress(); +#endif + + s32ret = sf_4G_sim_init(pfnParam); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + + s32ret = sf_4G_register_net_auto(pfnParam); + if (s32ret != SF_SUCCESS) { + sf_set_signal_ready_flag(TRUE); + } + sf_share_mem_customer_down(1); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + + s32ret = app_FileSend_thread(); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + + break; + case SF_MCU_STARTUP_WARNING: + + break; + case SF_MCU_STARTUP_SERVER: + + break; + case SF_MCU_STARTUP_DP: + + s32ret = app_ttyusb_IsOpen(); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + +#if SF_QLOG_ENABLE + if (pCustomerParam->QLogSwitch == 1) + app_Qlog_procress(); +#endif + s32ret = sf_4G_sim_init(pfnParam); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + + s32ret = sf_4G_register_net_manual(pfnParam); + if (s32ret != SF_SUCCESS) { + sf_set_signal_ready_flag(TRUE); + } + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + + s32ret = sf_get_utc(); + if ((s32ret == SF_SIM_ERROR_UTC) || (SF_ON == pCustomerParam->GpsSwitch)) { + s32ret = sf_get_ntp(s32ret); + } + if (1 == pCustomerParam->NeedTimeSyncStartUp) { + printf("[%s:%d]8 between A and B,no reg net again,no reset time sync.\n", + __FUNCTION__, __LINE__); + sf_set_dr_reset_time_sys_flag(1); + } + + if (0 != sf_get_cq_signal()) { + pCustomerParam->NeedTimeSyncStartUp = 1; + } + if (pCustomerParam->DailyReportSwitch) { + pCustomerParam->GpsSendFlag = + 1; // indicate need send dp file in b power on. + } + sf_dailyReport_set(); + sf_share_mem_customer_down(1); + + break; + case SF_MCU_STARTUP_USB: + + break; + case SF_MCU_STARTUP_RESET: + + s32ret = app_ttyusb_IsOpen(); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); +#if SF_QLOG_ENABLE + if (pCustomerParam->QLogSwitch == 1) + app_Qlog_procress(); +#endif + + s32ret = sf_4G_sim_init(pfnParam); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + + s32ret = sf_4G_register_net_manual(pfnParam); + if (s32ret != SF_SUCCESS) { + sf_set_signal_ready_flag(TRUE); + } + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + + s32ret = sf_get_utc(); + if ((s32ret == SF_SIM_ERROR_UTC) || (SF_ON == pCustomerParam->GpsSwitch)) { + s32ret = sf_get_ntp(s32ret); + } + if (0 != sf_get_cq_signal()) { + pCustomerParam->GpsSendFlag = 0; + pCustomerParam->NeedTimeSyncStartUp = 1; + // avoid always A mode power on + pCustomerParam->NetWorkNeedSearch = 0; + // printf("[%s:%d]NeedTimeSyncStartUp=%d\n", __FUNCTION__, __LINE__, + // pCustomerParam->NeedTimeSyncStartUp); + } + sf_dailyReport_set(); + sf_share_mem_customer_down(1); + break; + case SF_MCU_STARTUP_SYN_PARAM: + + s32ret = app_ttyusb_IsOpen(); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + +#if SF_QLOG_ENABLE + if (pCustomerParam->QLogSwitch == 1) + app_Qlog_procress(); +#endif + s32ret = sf_4G_sim_init(pfnParam); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + + s32ret = sf_4G_register_net_auto(pfnParam); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + + s32ret = app_FileSend_thread(); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + + pCustomerParam->NetWorkNeedSearch = 0; + pCustomerParam->NeedTimeSyncStartUp = 0; + + s32ret = sf_read_message(); + SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST); + if (sf_get_pic()) { + sf_app_to_cardv_capture(); + } + + sf_share_mem_customer_down(1); + break; + + default: + break; + } + + return s32ret; +} +void app_Register_Net_thread(void) { + SINT32 s32ret = 0; + SF_FN_PARAM_S stpfncallback = {0}; + stpfncallback.pstParam = sf_customer_param_get(); + stpfncallback.pstaticParam = sf_app_ui_para_get(); + // stpfncallback.pstaticParam = sf_statistics_param_get(); + stpfncallback.pfn_AT_instruction_exit = (void *)app_disconnect_4g_module; + + pthread_detach(pthread_self()); + s32ret = app_Register_Net_startup_mode(&stpfncallback); + switch (s32ret) { + case SF_APP_ERROR_REQUEST: + app_Register_Net_Error_return_init(&stpfncallback); + break; + case SF_APP_ERROR_NO_SUPPOET: + app_Register_Net_Error_return_server(&stpfncallback, s32ret); + break; + default: + app_Register_Net_Error_return_setup(&stpfncallback, s32ret); + break; + } + return; +} + +void app_FileSend_start(void) { + + MLOGI("ThumbSend.IsRun:%d\n", ThumbSend.IsRun); + if (!ThumbSend.IsRun) { + pthread_create(&ThumbSend.TskId, NULL, (void *)app_FileSend_thread, NULL); + ThumbSend.IsRun = 1; + SF_MUTEX_INIT_LOCK(ThumbSend.mutexLock); + } +} + +SINT32 app_RegisterNet_start(void) { + MLOGD("RegisterNetTskParams.IsRun:%d\n", RegisterNetTskParam.IsRun); + if (!RegisterNetTskParam.IsRun) { + pthread_create(&RegisterNetTskParam.TskId, NULL, + (void *)app_Register_Net_thread, NULL); + RegisterNetTskParam.IsRun = 1; + SF_MUTEX_INIT_LOCK(RegisterNetTskParam.mutexLock); + } + return SF_SUCCESS; +} +SINT32 app_t110(void) { + + SINT8 halvalue = 0; + SF_MUTEX_LOCK(GPIO_mutexLock); + sf_hal_gpio_init(SF_KEY_PIN_SYNC, GPIO_DIR_IN); + sf_hal_gpio_get(SF_KEY_PIN_SYNC, &halvalue); + SF_MUTEX_UNLOCK(GPIO_mutexLock); + // sf_hal_gpio_deinit(SF_KEY_PIN_SYNC); + MLOGI("halvalue: %d\n", halvalue); + if (halvalue == 0) + return SF_SUCCESS; + + app_RegisterNet_start(); + return SF_SUCCESS; +} + +SINT32 sf_app_to_cardv_capture(void) { + SINT32 s32ret = 0; + // UINT8 timeCnt = 0; + // UINT8 bIsKeepConnect = 0; + // SF_CHAR version[12] = {0}; + SF_MESSAGE_BUF_S stMessageBuf = {0}; + stMessageBuf.arg1 = SF_WIFI_CMD_CAPTURE; + stMessageBuf.cmdId = CMD_WIFI; + sf_com_message_send_to_cardv(&stMessageBuf); + + return s32ret; } #ifdef __cplusplus @@ -1537,4 +1518,3 @@ SINT32 app_t110(void) } #endif #endif - diff --git a/code/application/source/sf_app/code/source/app/sf_system.c b/code/application/source/sf_app/code/source/app/sf_system.c index e80af0192..4c80cddf0 100644 --- a/code/application/source/sf_app/code/source/app/sf_system.c +++ b/code/application/source/sf_app/code/source/app/sf_system.c @@ -680,7 +680,18 @@ SINT32 app_system_param_update(void) SINT32 app_system_poweroff(SF_POWEROFF_TYPE_E enType ) { + UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); + sf_poweroff_type_set(enType); + #if SF_QLOG_ENABLE + if(puiPara->QLogSwitch) + { + system("killall qlog"); + } + #endif + if((puiPara->DebugMode) || (puiPara->QLogSwitch)){ + sync(); + } sf_mcu_reg_set(SF_MCU_POWEROFF,sf_poweroff_type_get()); /* SF_STORE_ATTR_S storeattrs = {0}; @@ -914,7 +925,7 @@ void sf_power_off(void) sf_power_off_check_module_sleep(); sf_power_off_check_camera_restart(); - + sf_power_off_check_ui_para_sava(); sf_statistics_param_save(psfPara); @@ -923,6 +934,7 @@ void sf_power_off(void) stMessageBuf.arg1 = SF_EVENT_KEY_SHORT_CLICK; stMessageBuf.arg2 = SF_KEY_PIN_AOTU_MODE_POWOFF;//auto mode powoff sf_com_message_send_to_cardv(&stMessageBuf); + printf("[%s:%d] e\n", __FUNCTION__, __LINE__); } #ifdef __cplusplus diff --git a/code/application/source/sf_app/code/source/devMng/sf_ledmng.c b/code/application/source/sf_app/code/source/devMng/sf_ledmng.c index 9650e66d2..ba36bb381 100644 --- a/code/application/source/sf_app/code/source/devMng/sf_ledmng.c +++ b/code/application/source/sf_app/code/source/devMng/sf_ledmng.c @@ -584,7 +584,7 @@ void sf_sys_status_led_set(LedSysState_t ledSysStateId) { if((SF_MCU_STARTUP_ONKEY != sf_poweron_type_get())) return; - if((ledSysStateId != SF_LED_SYS_STATE_PIR_DETECT) && (ledSysStateId != SF_LED_SYS_STATE_PIR_NOT_DETECT)) + //if((ledSysStateId != SF_LED_SYS_STATE_PIR_DETECT) && (ledSysStateId != SF_LED_SYS_STATE_PIR_NOT_DETECT)) printf("SYS LED SET %d\n", ledSysStateId); switch(ledSysStateId) { diff --git a/code/application/source/sf_app/code/source/fileMng/sf_file.c b/code/application/source/sf_app/code/source/fileMng/sf_file.c index e88ea1f23..7e16b9932 100644 --- a/code/application/source/sf_app/code/source/fileMng/sf_file.c +++ b/code/application/source/sf_app/code/source/fileMng/sf_file.c @@ -296,7 +296,7 @@ SINT32 sf_quectel_upload_file_to_module(UINT8 *fileAbsolutePath, UINT8 *uploadFn //UINT8 sdFname[64] = {0}; //UINT8 gsmPara[GPRS_INFO_LINE_MAX] = {0}; SF_QUECTEL_UPLOAD_E enUploadLocation = QUECTEL_UPLOAD_FRIST; - + sf_set_upload_to_module_flag(0); // test if(sf_get_del_flag() == FALSE) { sf_set_del_flag(TRUE); diff --git a/code/application/source/sf_app/code/source/fileMng/sf_fileMng.c b/code/application/source/sf_app/code/source/fileMng/sf_fileMng.c index a93592a69..d04169081 100644 --- a/code/application/source/sf_app/code/source/fileMng/sf_fileMng.c +++ b/code/application/source/sf_app/code/source/fileMng/sf_fileMng.c @@ -670,6 +670,11 @@ void sf_file_thumb_cfg_clear(void) pThumbFileCfg->filecnt = 0; } +UINT8 sf_get_send_file_total(void) +{ + return SendFileTotal; +} + BOOL sf_check_auto_thumb_file(VOID) { @@ -789,7 +794,7 @@ UINT8 sf_get_send_file_list(char *sendfileList, UINT8 *fileTotal) //oldFileKey = 1000003; //for debug if((oldFileKey >= 1000001) && (oldFileKey <= 9999999)) //W1000001.JPG W9999999.JPG { - sprintf(oldFileName, "W%ld.JPG", oldFileKey); + snprintf(oldFileName, sizeof(oldFileName), "W%ld.JPG", oldFileKey); printf("last send file:%s\n", oldFileName); pFileHasSend = strstr(sendfileList, oldFileName); //MAX spend time <= 310ms if(pFileHasSend != NULL) diff --git a/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c b/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c index 5cecb1f93..64585f469 100644 --- a/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c +++ b/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c @@ -67,6 +67,7 @@ static UINT8 drNoResetTimeSync = SF_FALSE; //0:reset; 1:no reset; static UINT8 SetMcuRtcFlag = 0; static UINT8 ModuleUpdating = 0; static UINT8 FwUpdate = 0; +static BOOL SignalReadyFlag = FALSE; UINT8 sf_mcu_read(UINT32 reg, UINT8 *data) @@ -384,12 +385,10 @@ unsigned char sf_mcu_reg_set(MCUParam_t attrId, unsigned char val) { paraSyncFlag = 1; } - + sf_sys_rtc_time_get(&date); if(SetMcuRtcFlag) { - sf_sys_rtc_time_get(&date); - MLOGI("set mcu rtc: %04d/%02d/%02d %02d:%02d:%02d\n", - date.Year, date.Mon, date.Day, date.Hour, date.Min, date.Sec); + MLOGI("set mcu rtc: %04d/%02d/%02d %02d:%02d:%02d\n", date.Year, date.Mon, date.Day, date.Hour, date.Min, date.Sec); mcuReg[i] = SF_RTC_YEAR; mcuData[i++] = date.Year-2000; mcuReg[i] = SF_RTC_MONTH; @@ -710,7 +709,7 @@ unsigned char sf_mcu_reg_set(MCUParam_t attrId, unsigned char val) temp |= 0x40; } - if((puiPara->GprsMode) && (val == 1)) + if((puiPara->GprsSwitch) && (val == 1)) { temp |= 0x80; } @@ -751,7 +750,7 @@ unsigned char sf_mcu_reg_set(MCUParam_t attrId, unsigned char val) temp |= 0x40; } - if((puiPara->GprsMode) && (simCardInsert)) + if((puiPara->GprsSwitch) && (simCardInsert)) { temp |= 0x80; } @@ -1373,6 +1372,33 @@ SINT32 sf_get_gprs_errno(void) { return GPRS_ERRNO; } +/************************************************* + Function: sf_get_signal_ready_flag + Description: + Input: N/A + Output: N/A + Return: N/A + Others: N/A +*************************************************/ +BOOL sf_get_signal_ready_flag(void) +{ + printf("%s:%d SignalReadyFlag:%d\n", __FUNCTION__, __LINE__, SignalReadyFlag); + return SignalReadyFlag; +} + +/************************************************* + Function: sf_set_signal_ready_flag + Description: + Input: N/A + Output: N/A + Return: N/A + Others: N/A +*************************************************/ +void sf_set_signal_ready_flag(BOOL Flag) +{ + SignalReadyFlag = Flag; + printf("%s:%d SignalReadyFlag:%d\n", __FUNCTION__, __LINE__, SignalReadyFlag); +} #ifdef __cplusplus #if __cplusplus } diff --git a/code/application/source/sf_app/code/source/ttyusb/sf_hal_ttyusb.c b/code/application/source/sf_app/code/source/ttyusb/sf_hal_ttyusb.c index 0c2106080..e1291d236 100644 --- a/code/application/source/sf_app/code/source/ttyusb/sf_hal_ttyusb.c +++ b/code/application/source/sf_app/code/source/ttyusb/sf_hal_ttyusb.c @@ -335,7 +335,7 @@ SINT32 sf_hal_ttyusb2_init(void) SINT32 ret = SF_FAILURE; if(TtyUSB2Fd > 0) { - MLOGE("[/dev/ttyUSB2] has already inited !!!\n"); + MLOGI("[/dev/ttyUSB2] has already inited !!!\n"); return SF_SUCCESS; } diff --git a/code/application/source/sf_app/code/source/wifi/sf_data_transfer.c b/code/application/source/sf_app/code/source/wifi/sf_data_transfer.c index 63689f1c3..d0d6975b7 100644 --- a/code/application/source/sf_app/code/source/wifi/sf_data_transfer.c +++ b/code/application/source/sf_app/code/source/wifi/sf_data_transfer.c @@ -38,8 +38,8 @@ #include "sf_data_transfer.h" #include "sf_svr_send.h" #include "sf_system.h" -#include "sf_common.h" - +#include "sf_common.h" +#include "sf_log.h" //#include "sf_customer_app.h" //#include "sf_4g_common.h" @@ -183,7 +183,7 @@ static clientContext_t* DeleteClientContext( clientContext_t **ppClientHead, static clientContext_t* AddClientContextToList( clientContext_t *pClientHead, clientContext_t *pClient) { - printf("data client add \n"); + MLOGI("data client add \n"); pthread_mutex_lock(&gAppDataSvrMutex); //printf("data client add m\n"); @@ -201,7 +201,7 @@ void dataClientListPrint(void) clientContext_t *pClient = pDataClientHead; while ( pClient != NULL ) { - printf("data key:%d,fun:%d, fd:%d, %s\n",pClient->map.key,pClient->map.function,pClient->map.fd,pClient->map.fileName); + MLOGI("data key:%d,fun:%d, fd:%d, %s\n",pClient->map.key,pClient->map.function,pClient->map.fd,pClient->map.fileName); pClient = pClient->p_next; } //printf("list end\n"); @@ -245,7 +245,7 @@ U8 dataTransErrCodeSet(U32 port, U8 errCode) p = p->pNext; if(p->errCode != CMD_SUCCESS) { - printf("port:%d,errCode:%d\n",p->port,p->errCode); + MLOGI("port:%d,errCode:%d\n",p->port,p->errCode); } } #endif @@ -318,7 +318,7 @@ U8 sf_DataMapSet(U32 key, U8 function, S8 *fileName, U32 FileSize) U32 err; U32 i = 0; - printf("[sf_DataMapSet],key:%d,fileName:%s\n",key,fileName); + MLOGI(" key:%d,fileName:%s\n",key,fileName); if(fileName == NULL) return CMD_ERR; @@ -331,7 +331,7 @@ U8 sf_DataMapSet(U32 key, U8 function, S8 *fileName, U32 FileSize) err = pthread_mutex_lock(&gAppDataSvrMutex); if(err != SUCCESS) { - printf("Map set error!\n"); + MLOGE("Map set error!\n"); return DATA_CMD_ADD_TO_FLOW_ERR; } @@ -344,7 +344,7 @@ U8 sf_DataMapSet(U32 key, U8 function, S8 *fileName, U32 FileSize) { if((pClient->map.function == 1 || pClient->map.function == 2) && (function)) { - printf("[ERROR]file data is still transfer!\n"); + MLOGE("[ERROR]file data is still transfer!\n"); pthread_mutex_unlock(&gAppDataSvrMutex); return DATA_CMD_PORT_IS_USED; } @@ -364,7 +364,7 @@ U8 sf_DataMapSet(U32 key, U8 function, S8 *fileName, U32 FileSize) { usleep(20*1000); i++; - printf("function2=%d\n",pClient->map.function); + MLOGI("function2=%d\n",pClient->map.function); if(i >= 50) { pthread_mutex_unlock(&gAppDataSvrMutex); @@ -407,7 +407,7 @@ void *sf_DataSvrTransferThread(void *addr) U32 sendSizeTemp = 0; //U32 i = 0;; /*U8 tmpbuf[100];*/ - printf("new data thread = %p\n",addr); + MLOGI("new data thread = %p\n",addr); if(addr == 0) { sleep(3); @@ -428,7 +428,7 @@ void *sf_DataSvrTransferThread(void *addr) //printf("[Error][sf_DataSvrTransferThread] Error: %d,socket:%d.\n",nErr,pClient->socket ); if(nErr != 11)//EAGAIN/EINTR { - printf("Socket:%d, errno: %d,key:%d,fd:%d\n",pClient->socket,errno,pClient->map.key,pClient->map.fd ); + MLOGE("Socket:%d, errno: %d,key:%d,fd:%d\n",pClient->socket,errno,pClient->map.key,pClient->map.fd ); perror("Error:"); sf_DataMapClear(pClient); //fdClears(pClient->socket,&rdfds,&wrfds,&errfds); @@ -438,7 +438,7 @@ void *sf_DataSvrTransferThread(void *addr) //pDataClientHead = NULL ; } dataClientListPrint(); - printf("[Error][thread_destroy] end\n"); + MLOGE("[Error] end\n"); //forbuild sp5kHostMsgSend(APP_UI_MSG_DATA_THREAD_DEL, pthread); pthread_exit(NULL); } @@ -447,7 +447,7 @@ void *sf_DataSvrTransferThread(void *addr) } else if(nbytes == 0) { - printf("client close socket:%d, key:%d, errno: %d.\n",pClient->socket,pClient->map.key , errno ); + MLOGI("client close socket:%d, key:%d, errno: %d.\n",pClient->socket,pClient->map.key , errno ); sf_DataMapClear(pClient); pClient = DeleteClientContext(&pDataClientHead,pClient); dataClientListPrint(); @@ -459,7 +459,7 @@ void *sf_DataSvrTransferThread(void *addr) if(pClient->map.function != 3) { - printf("function=%d,name=%s\n",pClient->map.function,pClient->map.fileName); + MLOGI("function=%d,name=%s\n",pClient->map.function,pClient->map.fileName); //printf("socket=%d,key=%d,C_port=%d\n",pClient->socket,pClient->map.key,ntohs(pClient->ClientAddr.sin_port)); } //pClient->map.fileName[47]=0; @@ -486,18 +486,18 @@ void *sf_DataSvrTransferThread(void *addr) if(pClient->map.fd == 0) { //creat file failed. - printf("fd=0\n"); + //printf("fd=0\n"); sf_DataMapClear(pClient); dataTransErrCodeSet(pClient->map.key, DATA_UP_CREAT_FILE_FAIL); continue; } //pClient->map.fileSize = sp5kFsFileSizeGet(pClient->map.fd); //pClient->map.transferSize = 0; - printf("data filesize=%d\n",pClient->map.fileSize); + MLOGI("data filesize=%d\n",pClient->map.fileSize); } else { - printf("err\n"); + MLOGE("err\n"); sf_DataMapClear(pClient); dataTransErrCodeSet(pClient->map.key, DATA_UP_NO_FILE_NAME); continue; @@ -515,7 +515,7 @@ void *sf_DataSvrTransferThread(void *addr) else if(oldTime != CurrTime) { countByte += nbytes; - printf("receive speed=% 3dKB/s, %d\n",countByte/1024,countByte); + MLOGI("receive speed=% 3dKB/s, %d\n",countByte/1024,countByte); countByte = 0; oldTime = CurrTime; } @@ -532,7 +532,7 @@ void *sf_DataSvrTransferThread(void *addr) usleep(25*1000); /* ms */ if(pClient->map.count > 200) { - printf("receive time out\n"); + MLOGE("receive time out\n"); sf_DataMapClear(pClient); dataTransErrCodeSet(pClient->map.key, DATA_UP_TIME_OUT); } @@ -546,7 +546,7 @@ void *sf_DataSvrTransferThread(void *addr) ret = write(pClient->map.fd, pClient->szBuffer, nbytes); if(ret <= 0) { - printf("wirte error ! ret=%d\n",ret); + MLOGE("wirte error ! ret=%d\n",ret); usleep(25*1000); /* ms */ sf_DataMapClear(pClient); dataTransErrCodeSet(pClient->map.key, DATA_UP_WRITE_FILE_ERR); @@ -555,7 +555,7 @@ void *sf_DataSvrTransferThread(void *addr) pClient->map.transferSize += ret; if(pClient->map.transferSize >= pClient->map.fileSize) { - printf("receive success! Tsize=%d,Fsize=%d\n", pClient->map.transferSize,pClient->map.fileSize); + MLOGI("receive success! Tsize=%d,Fsize=%d\n", pClient->map.transferSize,pClient->map.fileSize); sf_DataMapClear(pClient); dataTransErrCodeSet(pClient->map.key, CMD_SUCCESS); } @@ -584,7 +584,7 @@ void *sf_DataSvrTransferThread(void *addr) } else { - printf("ssdfeef\n"); + //printf("ssdfeef\n"); sf_DataMapClear(pClient); //dataTransErrCodeSet(pClient->map.key, DATA_DOWN_NO_FILE_NAME);//remove,because APP not use continue; @@ -612,7 +612,7 @@ void *sf_DataSvrTransferThread(void *addr) } else if(writedsize > readSize) { - printf("[ERROR] send size > read size\n"); + MLOGE("[ERROR] send size > read size\n"); sf_DataMapClear(pClient); //dataTransErrCodeSet(pClient->map.key, DATA_DOWN_SEND_DATA_ERR);//remove,because APP not use } @@ -625,7 +625,7 @@ void *sf_DataSvrTransferThread(void *addr) { readSize -= writedsize; sendSizeTemp += writedsize; - printf("send left =%d,index:%d\n",readSize,sendSizeTemp); + MLOGI("send left =%d,index:%d\n",readSize,sendSizeTemp); usleep(30*1000); /* ms */ //sp5kFsFileSeek(pClient->map.fd, ret-readSize, SP5K_FS_SEEK_CUR); seek function has a bug } @@ -653,7 +653,7 @@ void *sf_DataSvrTransferThread(void *addr) else if(oldTime != CurrTime) { countByte += writedsize; - printf("send speed=% 3dKB/s, %d\n",countByte/1024,countByte); + MLOGI("send speed=% 3dKB/s, %d\n",countByte/1024,countByte); countByte = 0; oldTime = CurrTime; } @@ -668,7 +668,7 @@ void *sf_DataSvrTransferThread(void *addr) sendSizeTemp = 0; //send time out. //printf("time out == 30\n"); - printf("timeOut sendSize=%d,filesize=%d\n",pClient->map.transferSize,pClient->map.fileSize); + MLOGI("timeOut sendSize=%d,filesize=%d\n",pClient->map.transferSize,pClient->map.fileSize); sf_DataMapClear(pClient); //dataTransErrCodeSet(pClient->map.key, DATA_DOWN_TIME_OUT);//remove,because APP not use } @@ -677,7 +677,7 @@ void *sf_DataSvrTransferThread(void *addr) } else { - printf("[ERROR] read size = 0\n"); + MLOGE("[ERROR] read size = 0\n"); sf_DataMapClear(pClient); //dataTransErrCodeSet(pClient->map.key, DATA_DOWN_READ_FILE_ERR);//remove,because APP not use } @@ -717,10 +717,10 @@ void *sf_DataSvrThread(void *p) appDataSvrSocket = socket(AF_INET, SOCK_STREAM, 0); if (appDataSvrSocket < 0) { - printf("[Error][sf_DataSvrThread] socket,ret:%x\n",appDataSvrSocket); + MLOGI("[Error] socket,ret:%x\n",appDataSvrSocket); return NULL; } - printf("[sf_DataSvrThread],gAppSvrSocket:%d\n",appDataSvrSocket); + MLOGI(" gAppSvrSocket:%d\n",appDataSvrSocket); pthread_mutex_init(&gAppDataSvrMutex,NULL); pthread_mutex_init(&gDataErrCodeMutex,NULL); @@ -731,14 +731,14 @@ void *sf_DataSvrThread(void *p) ret = setsockopt(appDataSvrSocket, IPPROTO_TCP, SO_KEEPALIVE, &on, sizeof(on)); if ( ret < 0 ) { - printf("[Error][sf_DataSvrThread] setsockopt,ret:%x\n",ret); + MLOGE("[Error] setsockopt,ret:%x\n",ret); } ret = setsockopt( appDataSvrSocket, SOL_SOCKET, SO_REUSEADDR, &on, sizeof( on ) ); if( ret < 0 ) { - printf("[Error][sf_DataSvrThread] SO_REUSEADDR,ret:%d \n",ret); + MLOGE("[Error] SO_REUSEADDR,ret:%d \n",ret); //return -1; } int opt = 512*1024; @@ -752,14 +752,14 @@ void *sf_DataSvrThread(void *p) ret = bind(appDataSvrSocket, (struct sockaddr*)&addrSend, sizeof(addrSend)); if( ret < 0 ) { - printf("[Error][sf_DataSvrThread] bind:%d \n",ret); + MLOGE("[Error] bind:%d \n",ret); return NULL; } ret =listen(appDataSvrSocket, LISTEN_PARAM); if (ret < 0) { - printf("[Error][sf_DataSvrThread]listen:%d\n",ret); + MLOGE("[Error] listen:%d\n",ret); close(appDataSvrSocket); return NULL; } @@ -784,17 +784,17 @@ void *sf_DataSvrThread(void *p) //printf("[sf_DataSvrThread]select,rdfds:%d,errfds:%d\n",rdfds,errfds); //if (FD_ISSET(appDataSvrSocket, &rdfds)) { - printf("data accept wait\n"); + MLOGI("data accept wait\n"); new_fd = accept(appDataSvrSocket, (struct sockaddr *) &cliAddr, &clientLength); if (new_fd < 0) { - printf("[Error][sf_DataSvrThread]accept:%d\n",new_fd); + MLOGE("[Error]accept:%d\n",new_fd); continue; } else { - printf("\n\n[Port:8855]new data channel socket:%d --------oliver\n", new_fd); - printf("data channel.IP:%s, Port:%d\n\n\n", inet_ntoa(cliAddr.sin_addr), htons(cliAddr.sin_port)); + MLOGI("\n\n[Port:8855]new data channel socket:%d --------oliver\n", new_fd); + MLOGI("data channel.IP:%s, Port:%d\n\n\n", inet_ntoa(cliAddr.sin_addr), htons(cliAddr.sin_port)); /* if(SF_SUCCESS != sf_is_ip_in_list(inet_ntoa(cliAddr.sin_addr))) @@ -836,7 +836,7 @@ void *sf_DataSvrThread(void *p) } else { - printf("[Error][sf_DataSvrThread]nbytes %d,lwip_close\n", nbytes ); + MLOGE("[Error]nbytes %d,lwip_close\n", nbytes ); pClient = pDataClientHead ; while (pClient != NULL) { diff --git a/code/application/source/sf_app/code/source/wifi/sf_getapinfo.c b/code/application/source/sf_app/code/source/wifi/sf_getapinfo.c index fc18dafc2..a3b13846e 100644 --- a/code/application/source/sf_app/code/source/wifi/sf_getapinfo.c +++ b/code/application/source/sf_app/code/source/wifi/sf_getapinfo.c @@ -23,6 +23,7 @@ #include #include "sf_wifi_svr.h" #include "sf_led.h" +#include "sf_log.h" int iw_debug = 0; static int (*registered_handler)(struct nl_msg *, void *); static void *registered_handler_data; @@ -282,26 +283,26 @@ static int print_event(struct nl_msg *msg, void *arg) if (tb[NL80211_ATTR_IFINDEX] && tb[NL80211_ATTR_WIPHY]) { /* if_indextoname may fails on delete interface/wiphy event */ if (if_indextoname(nla_get_u32(tb[NL80211_ATTR_IFINDEX]), ifname)) - printf("%s (phy #%d): ", ifname, nla_get_u32(tb[NL80211_ATTR_WIPHY])); + MLOGI("%s (phy #%d): ", ifname, nla_get_u32(tb[NL80211_ATTR_WIPHY])); else - printf("phy #%d: ", nla_get_u32(tb[NL80211_ATTR_WIPHY])); + MLOGI("phy #%d: ", nla_get_u32(tb[NL80211_ATTR_WIPHY])); } else if (tb[NL80211_ATTR_WDEV] && tb[NL80211_ATTR_WIPHY]) { printf("wdev 0x%llx (phy #%d): ", (unsigned long long)nla_get_u64(tb[NL80211_ATTR_WDEV]), nla_get_u32(tb[NL80211_ATTR_WIPHY])); } else if (tb[NL80211_ATTR_IFINDEX]) { if_indextoname(nla_get_u32(tb[NL80211_ATTR_IFINDEX]), ifname); - printf("%s: ", ifname); + MLOGI("%s: ", ifname); } else if (tb[NL80211_ATTR_WDEV]) { - printf("wdev 0x%llx: ", (unsigned long long)nla_get_u64(tb[NL80211_ATTR_WDEV])); + MLOGI("wdev 0x%llx: ", (unsigned long long)nla_get_u64(tb[NL80211_ATTR_WDEV])); } else if (tb[NL80211_ATTR_WIPHY]) { - printf("phy #%d: ", nla_get_u32(tb[NL80211_ATTR_WIPHY])); + MLOGI("phy #%d: ", nla_get_u32(tb[NL80211_ATTR_WIPHY])); } switch (gnlh->cmd) { case NL80211_CMD_NEW_STATION: mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC])); - printf("new station %s\n", macbuf); + MLOGI("new station %s\n", macbuf); connectNum++; if(connectNum == 1) { @@ -313,7 +314,7 @@ static int print_event(struct nl_msg *msg, void *arg) break; case NL80211_CMD_DEL_STATION: mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC])); - printf("del station %s\n", macbuf); + MLOGI("del station %s\n", macbuf); connectNum--; if(connectNum < 0) connectNum = 0; @@ -328,7 +329,7 @@ static int print_event(struct nl_msg *msg, void *arg) break; default: - printf("unknown event %d\n", + MLOGE("unknown event %d\n", gnlh->cmd); break; } diff --git a/code/application/source/sf_app/code/source/wifi/sf_svr_send.c b/code/application/source/sf_app/code/source/wifi/sf_svr_send.c index 17e79c5a6..beccaee23 100644 --- a/code/application/source/sf_app/code/source/wifi/sf_svr_send.c +++ b/code/application/source/sf_app/code/source/wifi/sf_svr_send.c @@ -38,6 +38,7 @@ #include "sf_wifi_svr.h" #include "sf_data_transfer.h" #include "sf_svr_send.h" +#include "sf_log.h" //#include "sf_para.h" //#define TIME_MAP_PATH "/app/sd/timemap" @@ -54,7 +55,7 @@ extern sysMsg_t sendMsg; void appSvrStopSendFile(void) { - printf("stop send file\n"); + MLOGI("stop send file\n"); if(SendingFile == 1) { StopSendFile = 1; @@ -67,7 +68,7 @@ char *find_file_name(const char *name) int sep = '/'; if (NULL == name) { - printf("the path name is NULL\n"); + MLOGE("the path name is NULL\n"); return NULL; } name_start = strrchr(name, sep); @@ -92,11 +93,11 @@ UINT8 appSvrSendFile(UINT32 socket, const UINT8 *fname) struct tm mtime = {0};//, atime = {0}, ctime = {0}; APP_SVR_PACKET_T msgParse; - printf("[SEND FILE oliver]file:%s\n", fname); + MLOGI("[SEND FILE oliver]file:%s\n", fname); SendingFile = 1; if((socket == 0) || (fname == NULL)) { - printf("appSvrSendFile param ERROR!\n"); + MLOGE(" param ERROR!\n"); ret = FAIL; } else @@ -111,7 +112,7 @@ UINT8 appSvrSendFile(UINT32 socket, const UINT8 *fname) fd = open((char *)fname, O_RDONLY /*SP5K_FS_OPEN_RDONLY*/); if(fd == -1) { - printf("open file error: %s!", fname); + MLOGE("open file error: %s!", fname); ret = FAIL; } else @@ -123,7 +124,7 @@ UINT8 appSvrSendFile(UINT32 socket, const UINT8 *fname) //size = statbuff.st //forbuild sp5kFsFileTimeGet(fname, &atime, &mtime, &ctime); //sp5kFsFileAttrGet(); - printf("sp5kFsFileSizeGet:%d\n",size); + MLOGI("sp5kFsFileSizeGet:%d\n",size); /**********get file name and path***********/ strcpy((char *)tempName, (char *)fname); length = strlen((char *)tempName); @@ -140,7 +141,7 @@ UINT8 appSvrSendFile(UINT32 socket, const UINT8 *fname) } } } - printf("bufsize=%d,",PACKET_MAX_LEN); + MLOGI("bufsize=%d,",PACKET_MAX_LEN); /*******send file respons cmd********/ memset((void *)&msgParse, 0, sizeof(msgParse)); @@ -165,7 +166,7 @@ UINT8 appSvrSendFile(UINT32 socket, const UINT8 *fname) msgParse.msgBuf.rctrlFileTransferInfo.suffix = htons(MSG_END_FIX); /* add the magic + len total 2*2 bytes; */ temp = ntohs(msgParse.msglen); - printf("send file:"); + MLOGI("send file:"); //memdump((&msgParse), (temp + sizeof(UINT16)*2)); send( socket,(void *)(&msgParse), (temp + sizeof(UINT16)*2), 0); //printf("send cmd = 0\n", htons(msgParse.cmd)); @@ -173,7 +174,7 @@ UINT8 appSvrSendFile(UINT32 socket, const UINT8 *fname) if(ret != SUCCESS) { - printf("info error send fail!\n"); + MLOGE("info error send fail!\n"); StopSendFile = 0; SendingFile = 0; free(buff); @@ -196,11 +197,11 @@ UINT8 appSvrSendFile(UINT32 socket, const UINT8 *fname) memset(buff, 0, PACKET_MAX_LEN); size = read(fd, buff, PACKET_MAX_LEN); sendsize = send(socket, (void *)(buff), size, 0); - printf("writesize=%d,readsize=%d, i=%d-----",sendsize, size, i); + MLOGI("writesize=%d,readsize=%d, i=%d-----",sendsize, size, i); if(sendsize < 1) { - printf("send error"); + MLOGE("send error"); //forbuild sp5kFsFileSeek(fd, -size, SP5K_FS_SEEK_CUR); usleep(50*1000); count++; @@ -234,17 +235,17 @@ UINT8 appSvrSendFile(UINT32 socket, const UINT8 *fname) SendingFile = 0; //appTimeDelayMs(10000); - printf("fSize=%d,len=%d cnt=%d",fileTotalSize,length,count); - printf("send end,fSize=%d,len=%d\n",fileTotalSize,length); + MLOGI("fSize=%d,len=%d cnt=%d",fileTotalSize,length,count); + MLOGI("send end,fSize=%d,len=%d\n",fileTotalSize,length); #if 1 - printf("count=%d,size=%d,stopflag=%d\n", count, size, StopSendFile); + MLOGI("count=%d,size=%d,stopflag=%d\n", count, size, StopSendFile); if(length == fileTotalSize) { - printf("send file SUCCESS\n" ); + MLOGI("send file SUCCESS\n" ); } else { - printf("send file failed!\n"); + MLOGE("send file failed!\n"); } #endif return SUCCESS; @@ -265,13 +266,13 @@ void *appSvrSendThread(void *p) if(sendMsg.cmd == SEND_THUMB) { - printf("cmd: SEND_THUMB\n"); + MLOGI("cmd: SEND_THUMB\n"); socket = sendMsg.param; appSvrSendFile(socket, (UINT8 *)"D:\\DCIM\\100MEDIA\\DCAM0001.JPG"); } else if(sendMsg.cmd == SEND_TIME_MAP) { - printf("cmd: SEND_TIME_MAP\n"); + MLOGI("cmd: SEND_TIME_MAP\n"); socket = sendMsg.param; #if 0 sprintf((char *)fileName, "%s/%04d%02d%02d.txt", TIME_MAP_PATH, puiPara->timeMapToday.year, @@ -282,13 +283,13 @@ void *appSvrSendThread(void *p) else if(sendMsg.cmd == SEND_FILE) { extern UINT8 gFileName[]; - printf("cmd: SEND_FILE->%s\n",gFileName); + MLOGI("cmd: SEND_FILE->%s\n",gFileName); socket = sendMsg.param; appSvrSendFile(socket, gFileName); } else { - printf("cmd: send other\n"); + MLOGI("cmd: send other\n"); } } } @@ -300,7 +301,7 @@ SINT32 appSvrSendInit(void) s32Ret = sem_init(&gAppSvrSendQueue, 0, 0); if ( s32Ret != 0 /*ROS_SUCCESS*/) { - printf("[appSvrSendInit]Line %d, ret=0x%x\n", __LINE__, s32Ret); + MLOGI(" ret=0x%x\n", s32Ret); //HOST_ASSERT(0); return s32Ret; } diff --git a/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c b/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c index ec881a53f..0d0c10440 100644 --- a/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c +++ b/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c @@ -54,7 +54,7 @@ #include "NvtUser/NvtUser.h" #include "Mode/UIModePhoto.h" #include "Mode/UIModeMovie.h" - +#include "sf_log.h" #if SF_LPA_SDK #include "lpasdk/api/lpasdk_api.h" #include "sf_4g_lpa.h" @@ -220,9 +220,9 @@ static S32 sf_get_sd_info(UINT32 *pSDStatus, UINT32 *pSDFree, UINT32 *pSDTotalSi *pSDTotalSize = 0; } - printf("pSDStatus = %d\n", *pSDStatus); - printf("pSDFree = %d MB\n", *pSDFree); - printf("pSDTotalSize = %d MB\n", *pSDTotalSize); + MLOGI("pSDStatus = %d\n", *pSDStatus); + MLOGI("pSDFree = %d MB\n", *pSDFree); + MLOGI("pSDTotalSize = %d MB\n", *pSDTotalSize); return *pSDStatus; } @@ -234,7 +234,7 @@ static void sf_set_zoom(U32 nZoom) int nwidth = 2492; int nheight = 1400; - printf("[sf_set_zoom],nZoom:%d\n",nZoom); + MLOGI("[sf_set_zoom],nZoom:%d\n",nZoom); if(nZoom == 2) { nwidth = 1280; @@ -279,7 +279,7 @@ void sf_set_wifi_status(SF_WIFI_STATUS_E enStatus) if(enStatus < SF_WIFI_BUTT) WifiStatus = enStatus; else - printf("Type format error\n"); + MLOGE("Type format error\n"); return; } @@ -291,7 +291,7 @@ UINT32 sp5kFsFileSizeGet(const char *path) struct stat statbuff; if(stat(path, &statbuff) < 0) { - printf("failed path:%s size:%ld\n", path, (unsigned long int)statbuff.st_size); + MLOGE("failed path:%s size:%ld\n", path, (unsigned long int)statbuff.st_size); return filesize; } else @@ -366,7 +366,7 @@ void appThumbNameToKey(thumbType_t *fileType, UINT16 *dirKey, UINT16 *fileKey, S strncpy((char *)tempBuf, (char *)fileName, 3); tempBuf[3] = '\0'; *dirKey = atoi((char *)tempBuf); - printf("dirkey str:%s id:%d\n",tempBuf,*dirKey); + MLOGI("dirkey str:%s id:%d\n",tempBuf,*dirKey); strncpy((char *)tempBuf, (char *)fileName+3, 1); tempBuf[1] = '\0'; @@ -452,7 +452,7 @@ S8 *appThumbKeyToName(thumbSize_t imgSize, thumbType_t fileType, UINT16 dirKey, /****check floder and creat it if that is not exist***end****/ sprintf((char *)fileName, "%s/%03d%1d%04d.JPG", path, dirKey, fileType, fileKey); - printf("ThumbName:%s", fileName); + MLOGI("ThumbName:%s", fileName); return fileName; } @@ -541,7 +541,7 @@ static void cmdClientListPrint(clientContext_t *pHead) clientContext_t *pClient = pHead; while ( pClient != NULL ) { - printf("cmd socket:%d,port:%d,IP:%s\n",pClient->socket,htons(pClient->ClientAddr.sin_port),inet_ntoa(pClient->ClientAddr.sin_addr)); + MLOGI("cmd socket:%d,port:%d,IP:%s\n",pClient->socket,htons(pClient->ClientAddr.sin_port),inet_ntoa(pClient->ClientAddr.sin_addr)); pClient = pClient->p_next; } //printf("list end\n"); @@ -553,13 +553,13 @@ void appsvr_getFileList(UINT8 *dirPath, UINT8 *startFileKey) struct dirent *ptr = NULL; UINT32 nFileNums = 0; - printf("[appsvr_getFileList] dirPath:%s\n", dirPath); + MLOGI(" dirPath:%s\n", dirPath); if ((dir=opendir((char *)dirPath)) == NULL) { - printf("Open dir error..."); + MLOGE("Open dir error..."); return; } - printf("open success\n"); + MLOGI("open success\n"); while ((ptr=readdir(dir)) != NULL) { @@ -605,17 +605,17 @@ void appsvr_getDirList(UINT8* dirPath, UINT8 *startDirKey) UINT32 nFileNums = 0; DIR *dir = NULL; struct dirent *ptr = NULL; - printf("appsvr_getDirList:%s,startDirKey:%s\n", dirPath,startDirKey); + MLOGI(" %s,startDirKey:%s\n", dirPath,startDirKey); if ((dir=opendir((char *)dirPath)) == NULL) { - printf("Open dir error...\n"); - printf("dir path:%s\n", dirPath); + MLOGE("Open dir error...\n"); + MLOGE("dir path:%s\n", dirPath); return; } - printf("dir open success\n"); + MLOGI("dir open success\n"); while ((ptr=readdir(dir)) != NULL) { - printf("ptr != NULL ,ptr->d_name:---%s,Type:%d-----\n", ptr->d_name,ptr->d_type); + MLOGI("ptr != NULL ,ptr->d_name:---%s,Type:%d-----\n", ptr->d_name,ptr->d_type); if(strcmp(ptr->d_name,".")==0 || strcmp(ptr->d_name,"..")==0) ///current dir OR parrent dir continue; else if(ptr->d_type == 4) ///dir @@ -624,7 +624,7 @@ void appsvr_getDirList(UINT8* dirPath, UINT8 *startDirKey) if(strncmp((char *)&ptr->d_name, (char *)startDirKey, 3) >= 0) { strcpy((char *)gDevDirList[nFileNums].dirName, (char *)ptr->d_name); - printf("gDevDirList:%s\n", gDevDirList[nFileNums].dirName); + MLOGI("gDevDirList:%s\n", gDevDirList[nFileNums].dirName); nFileNums++; } #else @@ -642,7 +642,7 @@ void appsvr_getDirList(UINT8* dirPath, UINT8 *startDirKey) gDevDirListNums = nFileNums; closedir(dir); - printf("appsvr_getDirList e,gDevDirListNums:%d >>>>>\n",gDevDirListNums); + MLOGI(" e,gDevDirListNums:%d >>>>>\n",gDevDirListNums); } @@ -702,7 +702,7 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG UINT8 startFileKey[5] = {0}; UINT8 temp[5] = {0}; - printf("fileName:%s\n",fileName); + MLOGI("fileName:%s\n",fileName); if(fileName != NULL && fileName[0] != '\0' && fileName[0] != '0') { @@ -719,7 +719,7 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG memset(gDevFileList, 0, sizeof(gDevFileList)); gDevFileListNums = 0; - printf("get dir s\n"); + //printf("get dir s\n"); sprintf((char *)dirPath, "%s/", THUMB_PATH); @@ -730,7 +730,7 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG // while((gDevDirList[i].dirName[0] != '\0') && (i <= DCF_DIR_NUM_MAX)) { - printf("i=%d,dir:%s\n", i, gDevDirList[i].dirName); + MLOGI("i=%d,dir:%s\n", i, gDevDirList[i].dirName); // printf("get file s\n"); sprintf((char *)dirPath, "%s/%s", THUMB_PATH, gDevDirList[i].dirName); @@ -742,7 +742,7 @@ void appCreatThumbList(S8 *fileName)//start file name example: 10010032.JPG { appsvr_getFileList(dirPath, temp); } - printf("get file e\n"); + //printf("get file e\n"); i++; } @@ -771,14 +771,14 @@ static UINT32 sf_get_mac_addr(char *ifName, UINT8 *MacBuf) sock = socket(AF_INET, SOCK_STREAM, 0); if(sock < 0) { - printf("error sock"); + MLOGE("error sock"); return 2; } strcpy(ifreq.ifr_name, ifName); if(ioctl(sock,SIOCGIFHWADDR,&ifreq) < 0) { - printf("error ioctl"); + MLOGE("error ioctl"); return 3; } @@ -787,7 +787,7 @@ static UINT32 sf_get_mac_addr(char *ifName, UINT8 *MacBuf) sprintf((char *)MacBuf+3*i, "%02X:", (unsigned char)ifreq.ifr_hwaddr.sa_data[i]); } MacBuf[strlen((char *)MacBuf) - 1] = 0; - printf("MAC: %s\n", MacBuf); + MLOGI("MAC: %s\n", MacBuf); return 0; } @@ -796,22 +796,22 @@ void sf_app_Get_Camera_Info(MSG_DEV_INFO_Get_Rsp_T *camInfo) { UIMenuStoreInfo *puiPara = sf_ui_para_get(); - printf("camInfo:%x\n",camInfo->cmdRet); - printf("[sf_app_Get_Camera_Info],sf_get_sifar_param\n"); + MLOGI("camInfo:%x\n",camInfo->cmdRet); + //MLOGI("[sf_app_Get_Camera_Info],sf_get_sifar_param\n"); camInfo->cmdRet = 0; //strcpy((char *)camInfo->protocolVersion, "1.0"); - printf("[sf_app_Get_Camera_Info],protocolVersion\n"); + //printf("[sf_app_Get_Camera_Info],protocolVersion\n"); camInfo->devType = 0; //strcpy((char *)camInfo->devId, "1.0.0.1"); - printf("[sf_app_Get_Camera_Info],devId\n"); + // printf("[sf_app_Get_Camera_Info],devId\n"); camInfo->batLevel = sf_battery_level_get(); if(camInfo->batLevel < 1) camInfo->batLevel = 1; - printf("[sf_app_Get_Camera_Info],sf_get_Battery_Level\n"); + //printf("[sf_app_Get_Camera_Info],sf_get_Battery_Level\n"); //camInfo->batteryPercent = camInfo->batLevel * 20; camInfo->batteryPercent = sf_battery_value_get(sf_get_night_led_flag()); @@ -826,7 +826,7 @@ void sf_app_Get_Camera_Info(MSG_DEV_INFO_Get_Rsp_T *camInfo) camInfo->SDFree = htonl(SDFree); camInfo->SDTotalSize = htonl(SDTotalSize); - printf("[sf_app_Get_Camera_Info],get_sd_info\n"); + // printf("[sf_app_Get_Camera_Info],get_sd_info\n"); #ifdef SF_SK //camInfo->GpsLongitude = htonl(0); //camInfo->GpsLatitude = htonl(0); @@ -836,15 +836,15 @@ void sf_app_Get_Camera_Info(MSG_DEV_INFO_Get_Rsp_T *camInfo) //sf_get_sys_version(strTemp); strcpy((char *)camInfo->swVer, SF_BASE_VERSION); - printf("[sf_app_Get_Camera_Info],sf_get_sys_version\n"); + //printf("[sf_app_Get_Camera_Info],sf_get_sys_version\n"); //sf_get_sifar_version(strTemp); strcpy((char *)camInfo->swVer1, SF_BASE_VERSION_FEA); - printf("[sf_app_Get_Camera_Info],sf_get_sifar_version\n"); + //printf("[sf_app_Get_Camera_Info],sf_get_sifar_version\n"); //UINT8 mcuVersion=0, mcuSubVersion=0; //sf_mcu_ver_get(&mcuVersion, &mcuSubVersion); - printf("[sf_app_Get_Camera_Info],sf_mcu_version_get\n"); + //printf("[sf_app_Get_Camera_Info],sf_mcu_version_get\n"); //char mcuVer[10]= {0}; sf_mcu_version_get(camInfo->McuVer); @@ -857,11 +857,11 @@ void sf_app_Get_Camera_Info(MSG_DEV_INFO_Get_Rsp_T *camInfo) //UINT8 signalValue=0; //sf_get_signal_level(&signalValue); camInfo->signalLevel = sf_cardv_get_cq_signal(); - printf("[sf_app_Get_Camera_Info],sf_get_signal_level\n"); + //printf("[sf_app_Get_Camera_Info],sf_get_signal_level\n"); //char strIccid[32]= {0}; //sf_get_iccid(strIccid); - printf("[sf_app_Get_Camera_Info],sf_get_iccid\n"); + //printf("[sf_app_Get_Camera_Info],sf_get_iccid\n"); strcpy((char *)camInfo->SimICCID, puiPara->SimIccid); if(WIFI_TYPE_8189FS == sf_get_wifi_type()) @@ -873,7 +873,7 @@ void sf_app_Get_Camera_Info(MSG_DEV_INFO_Get_Rsp_T *camInfo) } camInfo->suffix = htons(0xFFEE); - printf("[sf_app_Get_Camera_Info],End\n"); + MLOGI(" End\n"); } void sf_app_Get_Camera_Para(MSG_DEV_Param_Get_Rsp_T *CamPara) @@ -902,7 +902,7 @@ void sf_app_Get_Camera_Para(MSG_DEV_Param_Get_Rsp_T *CamPara) CamPara->cameraMode = 0; } - printf("Camera Mode:%d\n", CamPara->cameraMode); + MLOGI("Camera Mode:%d\n", CamPara->cameraMode); //CamPara->cameraMode = puiPara->CamMode; @@ -923,7 +923,7 @@ void sf_app_Get_Camera_Para(MSG_DEV_Param_Get_Rsp_T *CamPara) CamPara->imageSize = 2; } - printf("Image Size:%d\n", CamPara->imageSize); + MLOGI("Image Size:%d\n", CamPara->imageSize); //CamPara->imageSize = puiPara->ImgSize; @@ -937,11 +937,11 @@ void sf_app_Get_Camera_Para(MSG_DEV_Param_Get_Rsp_T *CamPara) CamPara->timerStartMinute = puiPara->WorkTime[0].StartTime.Min; CamPara->timerEndHour = puiPara->WorkTime[0].StopTime.Hour; CamPara->timerEndMinute = puiPara->WorkTime[0].StopTime.Min; - printf("timer:%d\n", puiPara->WorkTime1Switch); - printf("TimerHstart[0]:%d\n", puiPara->WorkTime[0].StartTime.Hour); - printf("TimerMstart[0]:%d\n", puiPara->WorkTime[0].StartTime.Min); - printf("TimerHstop[0]:%d\n", puiPara->WorkTime[0].StopTime.Hour); - printf("TimerMstop[0]:%d\n", puiPara->WorkTime[0].StopTime.Min); + MLOGI("timer:%d\n", puiPara->WorkTime1Switch); + MLOGI("TimerHstart[0]:%d\n", puiPara->WorkTime[0].StartTime.Hour); + MLOGI("TimerMstart[0]:%d\n", puiPara->WorkTime[0].StartTime.Min); + MLOGI("TimerHstop[0]:%d\n", puiPara->WorkTime[0].StopTime.Hour); + MLOGI("TimerMstop[0]:%d\n", puiPara->WorkTime[0].StopTime.Min); CamPara->maxNum = puiPara->SendMaxNum;//MaxNumber CamPara->delay = puiPara->PirDelaySwitch;//DelayFlag @@ -996,7 +996,7 @@ void sf_camera_name_check(SF_CHAR* str) len = 4; } - printf("str:%s,len:%d\n", str, len); + MLOGI("str:%s,len:%d\n", str, len); for(i = 0; i < len; i++) { if((str[i] >= 'a') && (str[i] <= 'z')) @@ -1070,13 +1070,13 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) if(poweroff_mode == POWEROFF_COUNTDOWN) { - printf("Going power off, ignore cmd.\n"); + MLOGE("Going power off, ignore cmd.\n"); return FAIL; } if(NULL == pAppData || dataLen < 11) { - printf("ERROR:input para error in sf_svr_packet_proc() \n"); + MLOGE("ERROR:input para error in sf_svr_packet_proc() \n"); return -1; } @@ -1112,7 +1112,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) /*parse the msglen valid*/ if(dataLen < msgTotolLen)//(msgTotolLen != dataLen ) { - printf("[sf_svr_packet_proc]:recv the error length msg, just drop! t_len[%d] rcv_len[%d]\n",msgTotolLen, dataLen); + MLOGI(":recv the error length msg, just drop! t_len[%d] rcv_len[%d]\n",msgTotolLen, dataLen); for( j=0; jmsgBuf.getThumbList.fileName); - printf("[WIFI_GET_FILE_THUMBLIST],fileName:%s\n",fileName); + MLOGI("[WIFI_GET_FILE_THUMBLIST],fileName:%s\n",fileName); appCreatThumbList(fileName); memset((void *)&msgParse, 0, sizeof(msgParse)); @@ -1226,7 +1226,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) //memdump((&msgParse), (temp + sizeof(UINT16)*2)); sendSize = 0; fileListSize = gDevFileListNums*sizeof(MSG_DEV_THUMB_LIST_Get_Data_Rsp_T); - printf("start send fileList,sendSize:%d,gDevFileListNums:%d,fileListSize:%d\n",sendSize,gDevFileListNums,fileListSize); + MLOGI("start send fileList,sendSize:%d,gDevFileListNums:%d,fileListSize:%d\n",sendSize,gDevFileListNums,fileListSize); while(sendSize < fileListSize) { // printf("sending fileList,sendSize:%d\n",sendSize); @@ -1255,18 +1255,18 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) if(sendSize == fileListSize) { - printf("send success,fileSize=%d,sendSize=%d\n", fileListSize, sendSize); + MLOGI("send success,fileSize=%d,sendSize=%d\n", fileListSize, sendSize); } else { - printf("send failed, time out!fileSize=%d,sendSize=%d\n", fileListSize, sendSize); + MLOGE("send failed, time out!fileSize=%d,sendSize=%d\n", fileListSize, sendSize); } respFlag = 0; sleep(2); break; #if 1 case WIFI_GET_CAMERA_HD_FILE: // - printf("[WIFI_GET_CAMERA_HD_FILE],type:%d,dirName:%s\n",pMsgStruct->msgBuf.getHdFile.type,pMsgStruct->msgBuf.getHdFile.dirName); + MLOGI("[WIFI_GET_CAMERA_HD_FILE],type:%d,dirName:%s\n",pMsgStruct->msgBuf.getHdFile.type,pMsgStruct->msgBuf.getHdFile.dirName); if(pMsgStruct->msgBuf.getHdFile.type == 0) //thumbnail { strcpy((char *)tempbuf, (char *)pMsgStruct->msgBuf.getHdFile.dirName); @@ -1298,14 +1298,14 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; #endif case WIFI_SET_CAMERA_Zoom: // - printf("[WIFI_SET_CAMERA_Zoom],Zoom:%d\n",puiPara->Zoom); + MLOGI("[WIFI_SET_CAMERA_Zoom],Zoom:%d\n",puiPara->Zoom); puiPara->Zoom = pMsgStruct->msgBuf.deviceZoomSet.zoom; puiPara->Zoom = (puiPara->Zoom > 4 ? 1 : puiPara->Zoom); //forbuild sp5kModeGet(&curMode); curMode = 0;//forbuild - printf("mode = 0x%x, zoom = %d,\n", curMode, puiPara->Zoom); - printf(" factor = %d\n", zmFactor[puiPara->Zoom]); + MLOGI("mode = 0x%x, zoom = %d,\n", curMode, puiPara->Zoom); + MLOGI(" factor = %d\n", zmFactor[puiPara->Zoom]); //forbuild sp5kZoomFactorSet(curMode, zmFactor[puiPara.zoom]); sf_set_zoom(puiPara->Zoom); respFlag = 2; @@ -1330,7 +1330,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) saveMode = 1; } - printf("[WIFI_SET_CAMERA_CameraMode],cameraMode:%d,savemode:%d\n",pMsgStruct->msgBuf.setCameraMode.cameraMode,saveMode); + MLOGI("[WIFI_SET_CAMERA_CameraMode],cameraMode:%d,savemode:%d\n",pMsgStruct->msgBuf.setCameraMode.cameraMode,saveMode); if(saveMode != pMsgStruct->msgBuf.setCameraMode.cameraMode) { @@ -1390,7 +1390,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) case WIFI_SET_CAMERA_ImageSize: //O { U8 tmpValue; - printf("[WIFI_SET_CAMERA_ImageSize],ImgSize:%d\n",puiPara->ImgSize); + MLOGI("[WIFI_SET_CAMERA_ImageSize],ImgSize:%d\n",puiPara->ImgSize); tmpValue = pMsgStruct->msgBuf.setImageSize.imageSize; if(tmpValue == 0) @@ -1425,7 +1425,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_MultiShot: //O - printf("Multishot:%d\nMultishotInterval:%d\n,SendMultishot:%d\n", pMsgStruct->msgBuf.setMultiShot.multiShot, + MLOGI("Multishot:%d\nMultishotInterval:%d\n,SendMultishot:%d\n", pMsgStruct->msgBuf.setMultiShot.multiShot, pMsgStruct->msgBuf.setMultiShot.multiInterval, pMsgStruct->msgBuf.setMultiShot.sendMulti); puiPara->Multishot = pMsgStruct->msgBuf.setMultiShot.multiShot % 3+1; @@ -1459,7 +1459,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_PirSensitivity: //O - printf("[WIFI_SET_CAMERA_PirSensitivity],DigitPirSensitivity:%d\n",pMsgStruct->msgBuf.setPirSensitivity.PirSensitivity); + MLOGI("[WIFI_SET_CAMERA_PirSensitivity],DigitPirSensitivity:%d\n",pMsgStruct->msgBuf.setPirSensitivity.PirSensitivity); sf_set_pir_sensitivity(pMsgStruct->msgBuf.setPirSensitivity.PirSensitivity % 10); /*puiPara->PirSensitivity = pMsgStruct->msgBuf.setPirSensitivity.PirSensitivity % 10; @@ -1477,7 +1477,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_Timer: //O - printf("[WIFI_SET_CAMERA_Timer],timer:%d\n",pMsgStruct->msgBuf.setTimer.timer); + MLOGI("[WIFI_SET_CAMERA_Timer],timer:%d\n",pMsgStruct->msgBuf.setTimer.timer); puiPara->WorkTime1Switch = !!pMsgStruct->msgBuf.setTimer.timer; puiPara->WorkTime[0].StartTime.Hour = pMsgStruct->msgBuf.setTimer.timerStartHour % 24; puiPara->WorkTime[0].StartTime.Min = pMsgStruct->msgBuf.setTimer.timerStartMinute % 60; @@ -1493,14 +1493,14 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_MaxNum: //O - printf("[WIFI_SET_CAMERA_MaxNum],SendMaxNum:%d\n",pMsgStruct->msgBuf.setMaxNum.maxNum); + MLOGI("[WIFI_SET_CAMERA_MaxNum],SendMaxNum:%d\n",pMsgStruct->msgBuf.setMaxNum.maxNum); puiPara->SendMaxNum = pMsgStruct->msgBuf.setMaxNum.maxNum % 100; respFlag = 2; paramSaveFlag = 1; break; case WIFI_SET_CAMERA_Delay: //O - printf("[WIFI_SET_CAMERA_Delay],delay:%d\n",pMsgStruct->msgBuf.setDelay.delay); + MLOGI("[WIFI_SET_CAMERA_Delay],delay:%d\n",pMsgStruct->msgBuf.setDelay.delay); puiPara->PirDelaySwitch = !!pMsgStruct->msgBuf.setDelay.delay; puiPara->PirDelayTime.Hour = pMsgStruct->msgBuf.setDelay.delayHour % 24; puiPara->PirDelayTime.Min = pMsgStruct->msgBuf.setDelay.delayMinute % 60; @@ -1510,14 +1510,14 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_SDLoop: //O - printf("[WIFI_SET_CAMERA_SDLoop],SDLoop:%d\n",pMsgStruct->msgBuf.setSDLoop.SDLoop); + MLOGI("[WIFI_SET_CAMERA_SDLoop],SDLoop:%d\n",pMsgStruct->msgBuf.setSDLoop.SDLoop); puiPara->SdLoopSwitch = !!pMsgStruct->msgBuf.setSDLoop.SDLoop; respFlag = 2; paramSaveFlag = 1; break; case WIFI_SET_CAMERA_FlashPower: //O - printf("[WIFI_SET_CAMERA_FlashPower],flashPower:%d\n",pMsgStruct->msgBuf.setFlashPower.flashPower); + MLOGI("[WIFI_SET_CAMERA_FlashPower],flashPower:%d\n",pMsgStruct->msgBuf.setFlashPower.flashPower); puiPara->FlashLed = !!pMsgStruct->msgBuf.setFlashPower.flashPower; respFlag = 2; @@ -1525,7 +1525,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_NightMode: //O - printf("[WIFI_SET_CAMERA_NightMode],nightMode:%d\n",pMsgStruct->msgBuf.setNightMode.nightMode); + MLOGI("[WIFI_SET_CAMERA_NightMode],nightMode:%d\n",pMsgStruct->msgBuf.setNightMode.nightMode); puiPara->NightMode = pMsgStruct->msgBuf.setNightMode.nightMode % 3; //sf_set_img_size(puiPara->ImgSize); respFlag = 2; @@ -1533,10 +1533,10 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_SendType: //O - printf("[WIFI_SET_CAMERA_SendType],sendType:%d\n",pMsgStruct->msgBuf.setSendType.sendType); + MLOGI("[WIFI_SET_CAMERA_SendType],sendType:%d\n",pMsgStruct->msgBuf.setSendType.sendType); if(puiPara->GprsMode == 0) { - puiPara->SendType = pMsgStruct->msgBuf.setSendType.sendType % 3; + puiPara->SendType = pMsgStruct->msgBuf.setSendType.sendType % 3; puiPara->TimeSend1.Hour = pMsgStruct->msgBuf.setSendType.sendFirstTimeH % 24; puiPara->TimeSend1.Min = pMsgStruct->msgBuf.setSendType.sendFirstTimeM % 60; puiPara->TimeSend2.Hour = pMsgStruct->msgBuf.setSendType.sendSecondTimeH % 24; @@ -1561,6 +1561,8 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) puiPara->TimeSend1Switch = 1; puiPara->TimeSend2Switch = 1; } + MLOGI("SendType:%d TimeSend1Switch:%d %02d:%02d TimeSend2Switch:%d %02d:%02d\n",puiPara->SendType,puiPara->TimeSend1Switch,puiPara->TimeSend1.Hour,puiPara->TimeSend1.Min,puiPara->TimeSend2Switch, puiPara->TimeSend2.Hour,puiPara->TimeSend2.Min); + } respFlag = 2; paramSaveFlag = 1; @@ -1589,7 +1591,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_VideoSize://err - printf("[WIFI_SET_CAMERA_VideoSize],videoSize:%d\n",pMsgStruct->msgBuf.setVideoSize.videoSize); + MLOGI("[WIFI_SET_CAMERA_VideoSize],videoSize:%d\n",pMsgStruct->msgBuf.setVideoSize.videoSize); puiPara->VideoSize = pMsgStruct->msgBuf.setVideoSize.videoSize % 3; //forbuild appMediaAttrUpdate(puiPara.VideoSize); //sf_set_video_size(puiPara->VideoSize); @@ -1598,7 +1600,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_VideoTime: //O - printf("[WIFI_SET_CAMERA_VideoTime],videoTime:%d\n",pMsgStruct->msgBuf.setVideoTime.videoTime); + MLOGI("[WIFI_SET_CAMERA_VideoTime],videoTime:%d\n",pMsgStruct->msgBuf.setVideoTime.videoTime); puiPara->VideoLenth = pMsgStruct->msgBuf.setVideoTime.videoTime+5; //puiPara->VideoLenth = (puiPara->VideoLenth > 55 ? 0 : puiPara->VideoLenth); respFlag = 2; @@ -1606,7 +1608,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_BatteryType: //O - printf("[WIFI_SET_CAMERA_BatteryType],batType:%d\n",pMsgStruct->msgBuf.setBatType.batType); + MLOGI("[WIFI_SET_CAMERA_BatteryType],batType:%d\n",pMsgStruct->msgBuf.setBatType.batType); puiPara->BatteryType = pMsgStruct->msgBuf.setBatType.batType; puiPara->BatteryType = (puiPara->BatteryType > 3 ? 0 : puiPara->BatteryType); respFlag = 2; @@ -1614,18 +1616,18 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_CameraID: //O - printf("[WIFI_SET_CAMERA_CameraID],cameraID:%d\n",pMsgStruct->msgBuf.setCameraID.cameraID); + MLOGI("[WIFI_SET_CAMERA_CameraID],cameraID:%d\n",pMsgStruct->msgBuf.setCameraID.cameraID); puiPara->CamNameSwitch = pMsgStruct->msgBuf.setCameraID.cameraID ? 0 : 1; strncpy(puiPara->CamNameStr, (char *)pMsgStruct->msgBuf.setCameraID.cameraIDstr, 4); //Use SF_STRNCPY to avoid that APP has not send '\0'. sf_camera_name_check(puiPara->CamNameStr); puiPara->CamNameStr[4] = '\0'; - printf("Camid:%d,str:%s\n", puiPara->CamNameSwitch, puiPara->CamNameStr); + MLOGI("Camid:%d,str:%s\n", puiPara->CamNameSwitch, puiPara->CamNameStr); respFlag = 2; paramSaveFlag = 1; break; case WIFI_SET_CAMERA_DateTime: //O - printf("[WIFI_SET_CAMERA_DateTime],DateAuto:%d\n",pMsgStruct->msgBuf.setDateTime.dateTimeAuto); + MLOGI("[WIFI_SET_CAMERA_DateTime],DateAuto:%d\n",pMsgStruct->msgBuf.setDateTime.dateTimeAuto); puiPara->DateAuto = !pMsgStruct->msgBuf.setDateTime.dateTimeAuto; //NTPAuto 0: Auto , 1: Manual //puiPara->NTPZone = pMsgStruct->msgBuf.setDateTime.timeZone % 7; time.Year = htons(pMsgStruct->msgBuf.setDateTime.year); @@ -1636,7 +1638,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) time.Sec = pMsgStruct->msgBuf.setDateTime.second % 60; if(puiPara->DateAuto == 1) //1: Manual { - printf("Set RTC %d %d %d %d:%d%d\n", time.Year, time.Mon, time.Day, time.Hour, time.Min, time.Sec); + MLOGI("Set RTC %d %d %d %d:%d%d\n", time.Year, time.Mon, time.Day, time.Hour, time.Min, time.Sec); sf_sys_rtc_time_set(&time); sf_cardv_set_mcu_rtc_flag(); } @@ -1644,7 +1646,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_GPS: //o - printf("[WIFI_SET_CAMERA_GPS],gpsSendType:%d\n",pMsgStruct->msgBuf.setGPS.gpsSendType); + MLOGI("[WIFI_SET_CAMERA_GPS],gpsSendType:%d\n",pMsgStruct->msgBuf.setGPS.gpsSendType); #if SF_GPS_SUPPORT puiPara->GpsSwitch = pMsgStruct->msgBuf.setGPS.gpsSwitch % 2; puiPara->GpsNumber = pMsgStruct->msgBuf.setGPS.gpsSendType % 3; @@ -1654,7 +1656,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_timeLapse: //O - printf("[WIFI_SET_CAMERA_timeLapse],timelapse:%d\n",pMsgStruct->msgBuf.setTimeLapseTime.timelapse); + MLOGI("[WIFI_SET_CAMERA_timeLapse],timelapse:%d\n",pMsgStruct->msgBuf.setTimeLapseTime.timelapse); puiPara->TimelapseSwitch = pMsgStruct->msgBuf.setTimeLapseTime.timelapse % 2; puiPara->TimelapseTime.Hour = pMsgStruct->msgBuf.setTimeLapseTime.timelapseHour % 24; puiPara->TimelapseTime.Min = pMsgStruct->msgBuf.setTimeLapseTime.timelapseMin % 60; @@ -1668,16 +1670,16 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_SET_CAMERA_PicUponDailyReport: //O - printf("[WIFI_SET_CAMERA_PicUponDailyReport],picUponDailyReport:%d\n",pMsgStruct->msgBuf.setDailyReport.picUponDailyReport); + MLOGI("[WIFI_SET_CAMERA_PicUponDailyReport],picUponDailyReport:%d\n",pMsgStruct->msgBuf.setDailyReport.picUponDailyReport); puiPara->PicUpDailyReport = pMsgStruct->msgBuf.setDailyReport.picUponDailyReport; respFlag = 2; paramSaveFlag = 1; break; case WIFI_SET_CAMERA_WifiPWD: // - printf("[WIFI_CONTROL_CAMERA_ModifyPWD],pwd:%s\n",pMsgStruct->msgBuf.setWifiPWD.newPWD); + MLOGI("[WIFI_CONTROL_CAMERA_ModifyPWD],pwd:%s\n",pMsgStruct->msgBuf.setWifiPWD.newPWD); strncpy((char *)puiPara->WifiApPWD, (char *)pMsgStruct->msgBuf.setWifiPWD.newPWD, 16); - printf("new AP PWD: %s\n", puiPara->WifiApPWD); + MLOGI("new AP PWD: %s\n", puiPara->WifiApPWD); paraNeedReboot = 1; //sp5kHostMsgSend(APP_UI_MSG_WIFI_REBOOT, 0); poweroff_mode = POWEROFF_KEYREBOOT; @@ -1688,7 +1690,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) case WIFI_CONTROL_CAMERA_FormatSDCard: //err - printf("[WIFI_CONTROL_CAMERA_FormatSDCard],format:%d\n",pMsgStruct->msgBuf.ctrlFormat.format); + MLOGI("[WIFI_CONTROL_CAMERA_FormatSDCard],format:%d\n",pMsgStruct->msgBuf.ctrlFormat.format); if(pMsgStruct->msgBuf.ctrlFormat.format == 1) { sf_set_card_statu(CMD_FORMAT_SD_STA); @@ -1706,7 +1708,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_CONTROL_CAMERA_Reboot: //err - printf("[WIFI_CONTROL_CAMERA_Reboot],reboot:%d\n",pMsgStruct->msgBuf.ctrlReboot.reboot); + MLOGI("[WIFI_CONTROL_CAMERA_Reboot],reboot:%d\n",pMsgStruct->msgBuf.ctrlReboot.reboot); tmp = pMsgStruct->msgBuf.ctrlReboot.reboot; poweroff_mode = POWEROFF_KEYREBOOT; paraNeedReboot = 1; @@ -1715,7 +1717,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_CONTROL_CAMERA_Recovery: // - printf("[WIFI_CONTROL_CAMERA_Recovery]\n"); + MLOGI("[WIFI_CONTROL_CAMERA_Recovery]\n"); Reset_MenuInfo(); //sf_daily_report_count_clear(); paraNeedReboot = 1; @@ -1723,7 +1725,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_CONTROL_CAMERA_CloseAPMode: //err - printf("[WIFI_CONTROL_CAMERA_CloseAPMode]\n"); + MLOGI("[WIFI_CONTROL_CAMERA_CloseAPMode]\n"); //poweroff_mode = POWEROFF_PVDOWN; //appGoToPoweroff(); //appPowerOffUiMsgSend(APP_POWER_OFF_NORMAL); @@ -1742,7 +1744,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) keyMap = ntohl(pMsgStruct->msgBuf.ctrlFileTransfer.PORT); function = pMsgStruct->msgBuf.ctrlFileTransfer.function; - printf("[WIFI_CONTROL_CAMERA_FileTransfer], keyMap=%d, function=%d,type:%d\n",keyMap,function,pMsgStruct->msgBuf.ctrlFileTransfer.type); + MLOGI("[WIFI_CONTROL_CAMERA_FileTransfer], keyMap=%d, function=%d,type:%d\n",keyMap,function,pMsgStruct->msgBuf.ctrlFileTransfer.type); if(function) { if(pMsgStruct->msgBuf.ctrlFileTransfer.type == 0) //thumbnail @@ -1853,14 +1855,14 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_CONTROL_CAMERA_DeleteFile: //O - printf("[WIFI_SET_FILE_DeleteFile],fileName:%s\n",pMsgStruct->msgBuf.ctrlDelFile.fileName); + MLOGI("[WIFI_SET_FILE_DeleteFile],fileName:%s\n",pMsgStruct->msgBuf.ctrlDelFile.fileName); strcpy((char *)fileName, (char *)pMsgStruct->msgBuf.ctrlDelFile.fileName); if(strlen((char *)fileName) == 12) // only file name { appThumbNameToKey((thumbType_t *)&fileType, &dirKey, &fileKey, fileName); appThumbKeyToName(THUMB_320x240, fileType, dirKey, fileKey, fileName); ret = remove((char *)fileName); - printf("delete thumb name=%s ret=%d\n",fileName,ret); + MLOGI("delete thumb name=%s ret=%d\n",fileName,ret); if(fileType == STILL_THUMB) sprintf((char *)fileName,"./%3dMEDIA/%s%04d.JPG", dirKey, DCF_FILE_FREE_CHAR, fileKey); else @@ -1886,7 +1888,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) break; case WIFI_CONTROL_CAMERA_SHOOT: - printf("[WIFI_SET_CAMERA_SHOOT] shoot:%d\n",pMsgStruct->msgBuf.ctrlShoot.shoot); + MLOGI("[WIFI_SET_CAMERA_SHOOT] shoot:%d\n",pMsgStruct->msgBuf.ctrlShoot.shoot); if((TRUE == sf_is_preview()) && (pMsgStruct->msgBuf.ctrlShoot.shoot <= 3)) { @@ -1963,7 +1965,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) case WIFI_CONTROL_CAMERA_Update: // uTemp = htonl(pMsgStruct->msgBuf.ctrlUpdate.updateType); - printf("[WIFI_CTRL_UPGRADE],fSize:%d\n",fSize); + MLOGI("[WIFI_CTRL_UPGRADE],fSize:%d\n",fSize); #if 1//forbuild //sf_app_msg_data_snd(SY_MSG_UPGRADE_FW,(unsigned char*)NULL); #endif @@ -1972,7 +1974,7 @@ SINT32 sf_svr_packet_proc(SINT32 fd, UINT8 *pAppData, UINT16 dataLen) case WIFI_CONTROL_CAMERA_Debug: //O puiPara->DebugMode = pMsgStruct->msgBuf.setDebugMode.debugMode % 2; - printf("[WIFI_CONTROL_CAMERA_Debug]DebugMode:%d\n", puiPara->DebugMode); + MLOGI("[WIFI_CONTROL_CAMERA_Debug]DebugMode:%d\n", puiPara->DebugMode); if(puiPara->DebugMode) { //sf_led_flash_start(SF_LED_FAST_FLAH, Sf_LED_SD_G); @@ -2091,7 +2093,7 @@ UINT8 sf_wifi_server_stop_shoot_respond(UINT8 errCode) { APP_SVR_PACKET_T msgParse; UINT32 tmp = 0; - printf("sf_wifi_server_StopShootRespond errCode = %d gSendSocket=%d\n", errCode,gSendSocket); + MLOGI("sf_wifi_server_StopShootRespond errCode = %d gSendSocket=%d\n", errCode,gSendSocket); if(gSendSocket > 0) { @@ -2148,7 +2150,7 @@ static void sf_delete_ip_from_list(void) if(clientMacList[0] != '\0') { - printf("Device %s delete from list.\n", clientMacList); + MLOGI("Device %s delete from list.\n", clientMacList); memset(clientMacList, 0, 24); connectNum--; return; @@ -2196,28 +2198,28 @@ void *sf_server_accept_thread(void *pData) //UINT8 tmpBuf[50]; - printf("[sf_server_accept_thread] start...\n"); + MLOGI(" start...\n"); gAppSvrSocket = socket(AF_INET, SOCK_STREAM, 0); if (gAppSvrSocket < 0) { - printf("[Error][sf_server_accept_thread] socket,ret:%x\n", gAppSvrSocket); + MLOGE("[Error] socket,ret:%x\n", gAppSvrSocket); return NULL; } - printf("[sf_server_accept_thread],Server Socket:%d\n", gAppSvrSocket); + MLOGI(" Server Socket:%d\n", gAppSvrSocket); on = 1 ; ret = setsockopt(gAppSvrSocket, IPPROTO_TCP, SO_KEEPALIVE, &on, sizeof(on)); if ( ret < 0 ) { - printf("[Error][sf_server_accept_thread] setsockopt,ret:%x\n", ret); + MLOGE("[Error]setsockopt,ret:%x\n", ret); } ret = setsockopt( gAppSvrSocket, SOL_SOCKET, SO_REUSEADDR, &on, sizeof( on ) ); if( ret < 0 ) { - printf("[Error][sf_server_accept_thread] SO_REUSEADDR,ret:%d \n", ret); + MLOGE("[Error] SO_REUSEADDR,ret:%d \n", ret); return NULL; } @@ -2229,14 +2231,14 @@ void *sf_server_accept_thread(void *pData) ret = bind(gAppSvrSocket, (struct sockaddr*)&addrSend, sizeof(addrSend)); if( ret < 0 ) { - printf("[Error][sf_server_accept_thread] bind:%d \n", ret); + MLOGE("[Error] bind:%d \n", ret); return NULL; } ret = listen(gAppSvrSocket, LISTEN_PARAM) ; if(ret < 0) { - printf("[Error][sf_server_accept_thread]listen:%d\n", ret); + MLOGE("[Error]listen:%d\n", ret); close(gAppSvrSocket); return NULL; } @@ -2258,13 +2260,13 @@ void *sf_server_accept_thread(void *pData) new_fd = accept(gAppSvrSocket, (struct sockaddr *) &cliAddr, (socklen_t *)&clientLength); if (new_fd < 0) { - printf("[Error][sf_server_accept_thread]accept:%d\n",new_fd); + MLOGE("[Error]accept:%d\n",new_fd); continue; } else { - printf("\n\n[Port:8866]new client's socket:%d --------oliver\n", new_fd); - printf("cmd client.IP:%s, Port:%d\n\n\n", inet_ntoa(cliAddr.sin_addr), htons(cliAddr.sin_port)); + MLOGI("\n\n[Port:8866]new client's socket:%d --------oliver\n", new_fd); + MLOGI("cmd client.IP:%s, Port:%d\n\n\n", inet_ntoa(cliAddr.sin_addr), htons(cliAddr.sin_port)); /* if(SF_SUCCESS != sf_add_ip_to_list(inet_ntoa(cliAddr.sin_addr))) @@ -2293,7 +2295,7 @@ void *sf_server_accept_thread(void *pData) /* Error occured */ if (FD_ISSET(gAppSvrSocket, &errfds)) { - printf("[Error][sf_server_accept_thread] while accepting socket: %d.\n", errno/*getSocketError(gAppSvrSocket)*/); + MLOGE("[Error] while accepting socket: %d.\n", errno/*getSocketError(gAppSvrSocket)*/); continue; } @@ -2311,7 +2313,7 @@ void *sf_server_accept_thread(void *pData) { // if (FD_ISSET(pClient->socket, &errfds)) { - printf("errno: %d,pClient->socket=%d.\n", errno,pClient->socket); + MLOGE("errno: %d,pClient->socket=%d.\n", errno,pClient->socket); //memdump(pClient, sizeof(clientContext_t)); if(errno != 11) { @@ -2333,7 +2335,7 @@ void *sf_server_accept_thread(void *pData) if(nlasterr_socket >= 10) { fdClears(pClient->socket,&rdfds,&wrfds,&errfds); - printf("errno overmax; delete client,socket:%d\n",pClient->socket); + MLOGE("errno overmax; delete client,socket:%d\n",pClient->socket); pClientContextHead = DeleteClientContext(pClientContextHead,pClient); pClient = pClientContextHead; @@ -2377,7 +2379,7 @@ void *sf_server_accept_thread(void *pData) /* Check in Exception Set */ if (FD_ISSET(pClient->socket, &errfds)) { - printf("[Error][sf_server_accept_thread] the socket errno: %d.\n", errno/*getSocketError(pClient->socket)*/); + MLOGE("[Error] the socket errno: %d.\n", errno/*getSocketError(pClient->socket)*/); fdClears(pClient->socket,&rdfds,&wrfds,&errfds); pClient = DeleteClientContext(pClientContextHead,pClient); printf("fordebug: delete client program dead 1\n"); @@ -2399,7 +2401,7 @@ void *sf_server_accept_thread(void *pData) } else { - printf("[Error][sf_server_accept_thread]nbytes %d,close\n", nbytes ); + MLOGE("[Error]nbytes %d,close\n", nbytes ); pClient = pClientContextHead ; while (pClient != NULL) { @@ -2437,7 +2439,7 @@ void sf_server_init(SINT8 *pSvrIp, UINT16 nSvrPort) gAppSvrPort = nSvrPort; } - printf("IP:%s Port:%d\n", gAppSvrIp, gAppSvrPort); + MLOGI("IP:%s Port:%d\n", gAppSvrIp, gAppSvrPort); //forbuild sf_getb_ipmac(gbAppLocalIp,gbAppLocalMac,gAppLocalIp,gAppLocalMac); //printf("[appsvr_init_cmd]IP:%s, MAC:%s,SerialID:%s,%d.%d.%d.%d\n",gAppLocalIp ,gAppLocalMac,gAppSerialID,gbAppLocalIp[3],gbAppLocalIp[2],gbAppLocalIp[1],gbAppLocalIp[0] ); @@ -2456,7 +2458,7 @@ void sf_get_wifi_ssid(char *ssid) if(SSID_STR[0] != '\0') { strcpy(ssid, SSID_STR); - printf("SSID:%s\n", ssid); + MLOGI("SSID:%s\n", ssid); } return; } @@ -2530,14 +2532,14 @@ int sf_getb_mac(char *ifName, UINT8 *pbMacAddr) sock = socket(AF_INET, SOCK_STREAM, 0); if(sock < 0) { - printf("error sock"); + MLOGE("error sock"); return 2; } strcpy(ifreq.ifr_name, ifName); if(ioctl(sock,SIOCGIFHWADDR,&ifreq) < 0) { - printf("error ioctl"); + MLOGE("error ioctl"); return 3; } @@ -2546,7 +2548,7 @@ int sf_getb_mac(char *ifName, UINT8 *pbMacAddr) pbMacAddr[i]=(unsigned char)ifreq.ifr_hwaddr.sa_data[i]; } - printf("MAC: %02X-%02X-%02X-%02X-%02X-%02X\n", pbMacAddr[0],pbMacAddr[1],pbMacAddr[2],pbMacAddr[3],pbMacAddr[4],pbMacAddr[5]); + MLOGI("MAC: %02X-%02X-%02X-%02X-%02X-%02X\n", pbMacAddr[0],pbMacAddr[1],pbMacAddr[2],pbMacAddr[3],pbMacAddr[4],pbMacAddr[5]); return 0; } @@ -2558,7 +2560,7 @@ void sf_wifi_hw_init(void) char scmd[256]= {0}; UIMenuStoreInfo *puiPara = sf_ui_para_get(); char sSSID[128]= {0}; - printf("[%s:%d] s\n", __FUNCTION__, __LINE__); + MLOGI("[%s:%d] s\n", __FUNCTION__, __LINE__); unsigned char wifitype = sf_get_wifi_type(); //ret = system("modprobe cfg80211"); @@ -2586,17 +2588,17 @@ void sf_wifi_hw_init(void) //char buf[256]; ret = system("cp /etc/wifiap_wpa2.conf /tmp/wifiap_wpa2.conf"); - printf("[%s:%d] sSSID:%s WifiApPWD:%s\n", __FUNCTION__, __LINE__,sSSID,puiPara->WifiApPWD); + MLOGI("[%s:%d] sSSID:%s WifiApPWD:%s\n", __FUNCTION__, __LINE__,sSSID,puiPara->WifiApPWD); sprintf(scmd,"/etc/app/hostap.sh wpawpa2 %s %s 6 %s",sSSID,puiPara->WifiApPWD,SF_WIFI_NETDEV_8189_NAME); ret = system(scmd); - printf("[%s:%d] s\n", __FUNCTION__, __LINE__); + //printf("[%s:%d] s\n", __FUNCTION__, __LINE__); //ret = system("hostapd -B -dd /tmp/wifiap_wpa2.conf"); //printf("[%s:%d] s\n", __FUNCTION__, __LINE__); ret = system("udhcpd /etc/udhcpdw.conf"); - printf("[%s:%d] s\n", __FUNCTION__, __LINE__); + //printf("[%s:%d] s\n", __FUNCTION__, __LINE__); } else if(WIFI_TYPE_HI3881 == wifitype) { @@ -2628,10 +2630,10 @@ void sf_wifi_hw_init(void) if(ret != 0) { - printf("wifi hw init failed!scmd:%s\n",scmd); + MLOGE("wifi hw init failed!scmd:%s\n",scmd); } - printf("[%s:%d] e\n", __FUNCTION__, __LINE__); + MLOGI("[%s:%d] e\n", __FUNCTION__, __LINE__); } void *sf_wifi_sevrer_init(void *pNull) @@ -2642,10 +2644,10 @@ void *sf_wifi_sevrer_init(void *pNull) //usleep(1000*1000); sf_DataSvrInit(); - printf("wifi server data channel start....\n"); + MLOGI("wifi server data channel start....\n"); appSvrSendInit(); sf_server_init(NULL, 0); - printf("wifi server start\n"); + MLOGI("wifi server start\n"); sf_apinfo_thread_init(); //sf_sys_status_led_set(SF_LED_SYS_STATE_WIFI_CONNECTED); sf_sys_status_led_set(SF_LED_SYS_STATE_WIFI_DISCONNECT); diff --git a/code/hdal/vendor/output/libvendor_ai2_pub.a b/code/hdal/vendor/output/libvendor_ai2_pub.a index 21d4de6cf..7d3634a89 100644 Binary files a/code/hdal/vendor/output/libvendor_ai2_pub.a and b/code/hdal/vendor/output/libvendor_ai2_pub.a differ diff --git a/code/hdal/vendor/output/libvendor_ai2_pub2.a b/code/hdal/vendor/output/libvendor_ai2_pub2.a index 86c7e3fc2..edbe0d817 100644 Binary files a/code/hdal/vendor/output/libvendor_ai2_pub2.a and b/code/hdal/vendor/output/libvendor_ai2_pub2.a differ diff --git a/code/lib/source/sifar/code/source/common/sf_common.c b/code/lib/source/sifar/code/source/common/sf_common.c index 5caa05453..06ae7bf34 100644 --- a/code/lib/source/sifar/code/source/common/sf_common.c +++ b/code/lib/source/sifar/code/source/common/sf_common.c @@ -1542,6 +1542,33 @@ static SINT32 sf_cardv_proccess_cmd_wifi(SF_MESSAGE_BUF_S *pMessageBuf) case SF_WIFI_CMD_RESTART: ImageApp_Common_RtspStart(0); + break; + case SF_WIFI_CMD_CAPTURE: + if(PWR_ON_SETUP != sf_cardv_convert_power_on_mode()){ + if(TRUE != sf_is_preview()){ + UIMenuStoreInfo *puiPara = sf_ui_para_get(); + int iCurrMode = System_GetState(SYS_STATE_CURRMODE); + int iNextMode = PRIMARY_MODE_PHOTO; + if((puiPara->CamMode == SF_CAM_MODE_PHOTO) || (puiPara->CamMode == SF_CAM_MODE_PHOTO_VIDEO)) + { + iNextMode = PRIMARY_MODE_PHOTO; + } + else if(puiPara->CamMode == SF_CAM_MODE_VIDEO) + { + iNextMode = PRIMARY_MODE_MOVIE; + } + else + { + iNextMode = PRIMARY_MODE_PHOTO; + } + UI_SetData(FL_PreMode, iCurrMode); + UI_SetData(FL_NextMode, iNextMode); + Ux_PostEvent(NVTEVT_SYSTEM_MODE, 1, iNextMode); + vos_util_delay_ms(200); + } + } + + FlowPhoto_DoCapture(); break; default: diff --git a/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.dtb b/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.dtb new file mode 100644 index 000000000..52205426a Binary files /dev/null and b/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.dtb differ diff --git a/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.tmp.dts b/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.tmp.dts new file mode 100644 index 000000000..3c2dee5f4 --- /dev/null +++ b/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.tmp.dts @@ -0,0 +1,1181 @@ +# 1 "nvt-evb.dts" +# 1 "" +# 1 "" +# 1 "nvt-evb.dts" + + + + + + + +/dts-v1/; +# 1 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/gpio/nvt-gpio.h" 1 +# 13 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/gpio/nvt-gpio.h" +# 1 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/gpio/gpio.h" 1 +# 14 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/gpio/nvt-gpio.h" 2 +# 10 "nvt-evb.dts" 2 +# 1 "nvt-peri.dtsi" 1 +# 10 "nvt-peri.dtsi" +# 1 "nvt-basic.dtsi" 1 +# 9 "nvt-basic.dtsi" +# 1 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/interrupt-controller/arm-gic.h" 1 +# 9 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/interrupt-controller/arm-gic.h" +# 1 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/interrupt-controller/irq.h" 1 +# 10 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/interrupt-controller/arm-gic.h" 2 +# 10 "nvt-basic.dtsi" 2 + +/ { + model = "Novatek NA51089"; + compatible = "novatek,na51089", "nvt,ca9"; + interrupt-parent = <&gic>; + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0x0>; + next-level-cache = <&L2>; + clock-frequency = <960000000>; + }; + }; + + cg@f0020000 { + compatible = "nvt,core_clk"; + reg = <0xf0020000 0x1000>; + }; + + + periph_clk: periph_clk { + compatible = "nvt,periph_clk"; + #clock-cells = <0>; + clock-output-names = "periph_clk"; + }; + + global_timer@ffd00200 { + compatible = "arm,cortex-a9-global-timer"; + reg = <0xffd00200 0x20>; + interrupts = <1 11 0xf01>; + clocks = <&periph_clk>; + }; + + private_timer@ffd00600 { + compatible = "arm,cortex-a9-twd-timer"; + reg = <0xffd00600 0x20>; + interrupts = <1 13 0xf01>; + clocks = <&periph_clk>; + }; + + pmu { + compatible = "arm,cortex-a9-pmu"; + interrupts = <0 112 4>; + interrupt-affinity = <&cpu0>; + }; + + L2: cache-controller@ffe00000 { + compatible = "arm,pl310-cache"; + reg = <0xffe00000 0x1000>; + interrupts = <0 96 4>; + cache-unified; + arm,shared-override; + cache-level = <2>; + arm,data-latency = <2 2 2>; + arm,tag-latency = <2 2 2>; + }; + + gic: interrupt-controller@0xffd00000 { + compatible = "arm,cortex-a9-gic"; + #interrupt-cells = <3>; + interrupt-controller; + reg = <0xffd01000 0x1000>, + <0xffd00100 0x1000>; + }; + + scu: snoop-control-unit@0xffd00000 { + compatible = "arm,cortex-a9-scu"; + reg = <0xffd00000 0x100>; + }; +}; +# 11 "nvt-peri.dtsi" 2 + +/ { + chosen { + bootargs = " "; + }; + + aliases { + mmc0 = &mmc0; + mmc1 = &mmc1; + }; + + uart@f0290000 { + compatible = "ns16550a"; + reg = <0xf0290000 0x1000>; + interrupts = <0 43 4>; + baud = <115200>; + reg-shift = <2>; + reg-io-width = <4>; + no-loopback-test = <1>; + clock-frequency = <24000000>; + fifo-size = <64>; + uart_id = <0>; + }; + + uart@f0300000 { + compatible = "ns16550a"; + reg = <0xf0300000 0x1000>; + interrupts = <0 44 4>; + baud = <115200>; + reg-shift = <2>; + reg-io-width = <4>; + no-loopback-test = <1>; + clock-frequency = <48000000>; + fifo-size = <64>; + hw_flowctrl = <0>; + rx_trig_level = <3>; + uart_id = <1>; + }; + + uart@f0310000 { + compatible = "ns16550a"; + reg = <0xf0310000 0x1000>; + interrupts = <0 45 4>; + baud = <115200>; + reg-shift = <2>; + reg-io-width = <4>; + no-loopback-test = <1>; + clock-frequency = <48000000>; + fifo-size = <64>; + hw_flowctrl = <0>; + rx_trig_level = <3>; + uart_id = <2>; + }; + + kdrv_rpc: cc@f0090000 { + compatible = "kdrv_rpc"; + reg = <0xf0090000 0x300>; + interrupts = <0 59 4>; + }; + + mmc0: mmc@f0420000 { + compatible = "nvt,nvt_mmc"; + reg = <0xf0420000 0x1000>; + interrupts = <0 30 4>; + max-frequency = <48000000>; + voltage-switch = <0>; + max-voltage = <3300>; + bus-width = <4>; + neg-sample-edge = <0>; + driving = <15 15 15 20 15 15 25 25 25 25 25 25>; + cd_gpio = <(9) 0x0 0x0>; + card_power_gpio = <(7 + 0x20) 0x0>; + + + }; + + mmc1: mmc@f0500000 { + compatible = "nvt,nvt_mmc2"; + reg = <0xf0500000 0x1000>; + interrupts = <0 31 4>; + max-frequency = <48000000>; + voltage-switch = <0>; + max-voltage = <3300>; + bus-width = <4>; + neg-sample-edge = <0>; + driving = <15 8 8 20 8 8 20 8 8 20 8 8>; + cd_gpio = <0 0x0 0x1>; + + + + }; + + nand: nand@f0400000 { + #address-cells = <2>; + #size-cells = <2>; + compatible = "nvt,nvt_spinand"; + reg = <0xf0400000 0x1000>; + interrupts = <0 29 4>; + clock-frequency = <96000000>; + nvt-devname = "spi_nand.0"; + }; + + nor: nor@f0400000 { + #address-cells = <2>; + #size-cells = <2>; + compatible = "nvt,nvt_spinor"; + reg = <0xf0400000 0x1000>; + interrupts = <0 29 4>; + clock-frequency = <120000000>; + nvt-devname = "spi_nor.0"; + trace-stdtable = <0>; + }; + + gpio: gpio@f0070000 { + compatible = "nvt,nvt_gpio"; + reg = <0xf0070000 0x10000>; + interrupts = <0 24 4>; + #gpio-cells = <2>; + }; + + eth@f02b0000 { + compatible = "nvt,synopsys_eth"; + reg = <0xf02b0000 0x3800>; + interrupts = <0 34 4>; + sp-clk = <0>; + ref-clk-out = <0>; + }; + + phy@f02b3800 { + compatible = "nvt,eth_phy"; + reg = <0xf02b3800 0x400>; + }; + + wdt@f0050000 { + compatible = "nvt,nvt_wdt"; + reg = <0xf0050000 0x10000>; + interrupts = <0 57 4>; + }; + + pwm: pwm@f0210000 { + compatible = "nvt,nvt_kdrv_pwm"; + reg = <0xf0210000 0x2000>; + interrupts = <0 26 4>; + }; + + adc@f0260000 { + compatible = "nvt,nvt_adc"; + reg = <0xf0260000 0x1000>; + interrupts = <0 47 4>; + #io-channel-cells = <1>; + }; + + rtc@f0060000 { + compatible = "nvt,nvt_rtc"; + reg = <0xf0060000 0x100>; + interrupts = <0 56 4>; + }; + + drtc@f00b0000 { + compatible = "nvt,nvt_drtc"; + reg = <0xf00b0000 0x100>; + }; + + crypto: crypto@f0620000 { + compatible = "nvt,nvt_crypto"; + reg = <0xf0620000 0x100>; + interrupts = <0 38 4>; + mclk = <1>; + }; + + hash: hash@f0670000 { + compatible = "nvt,nvt_hash"; + reg = <0xf0670000 0x100>; + interrupts = <0 28 4>; + mclk = <1>; + }; + + rsa: rsa@f06a0000 { + compatible = "nvt,nvt_rsa"; + reg = <0xf06a0000 0x100>; + interrupts = <0 20 4>; + mclk = <1>; + }; + + top: top@f0010000 { + compatible = "nvt,nvt_top"; + reg = <0xf0010000 0x2000 + 0xf0030000 0x2000 + 0xf0070000 0x10000>; + }; + + sie@f0c00000 { + compatible = "nvt,drv_sie"; + reg = <0xf0c00000 0x900 + 0xf0d20000 0x900 + 0xF0D30000 0x900>; + interrupts = <0 1 4 + 0 2 4 + 0 3 4>; + + }; + + tge@f0cc0000 { + compatible = "nvt,kdrv_tge"; + reg = <0xf0cc0000 0x150>; + interrupts = <0 22 4>; + }; + + rhe@f0ce0000 { + compatible = "nvt,kdrv_rhe"; + reg = <0xf0ce0000 0x900>; + interrupts = <0 13 4>; + }; + + ime@f0c40000 { + compatible = "nvt,kdrv_ime"; + reg = <0xf0c40000 0x1000>; + interrupts = <0 6 4>; + }; + + ife2@f0d00000 { + compatible = "nvt,kdrv_ife2"; + reg = <0xf0d00000 0x100>; + interrupts = <0 9 4>; + }; + + ise@f0c90000 { + compatible = "nvt,kdrv_ise"; + reg = <0xf0c90000 0x100>; + interrupts = <0 21 4 + 0 85 4>; + }; + + ipe@f0c30000 { + compatible = "nvt,kdrv_ipe"; + reg = <0xf0c30000 0x900>; + interrupts = <0 5 4>; + }; + + ife@f0c70000 { + compatible = "nvt,kdrv_ife"; + reg = <0xf0c70000 0x800>; + interrupts = <0 8 4>; + }; + + vpe@f0cd0000 { + compatible = "nvt,kdrv_vpe"; + reg = <0xf0cd0000 0x1040>; + interrupts = <0 62 4>; + }; + + ai@f0c60000 { + compatible = "nvt,kdrv_ai"; + reg = <0xf0c60000 0x23c + 0xf0d50000 0x114 + 0xf0cb0000 0x22c>; + interrupts = <0 14 4 + 0 13 4 + 0 11 4>; + clock-frequency = <600000000 480000000 600000000>; + }; + + md@f0c10000 { + compatible = "nvt,kdrv_md"; + reg = <0xf0c10000 0x150>; + interrupts = <0 46 4>; + clock-frequency = <240000000>; + }; + dis@f0c50000 { + compatible = "nvt,kdrv_dis"; + reg = <0xf0c50000 0x114>; + interrupts = <0 10 4>; + }; + + coe@f0a11000 { + compatible = "nvt,nvt_coe"; + reg = <0xf0a11000 0x2c0>; + }; + + dce@f0c20000 { + compatible = "nvt,kdrv_dce"; + reg = <0xf0c20000 0x650>; + interrupts = <0 7 4>; + }; + + ive@f0d70000 { + compatible = "nvt,kdrv_ive"; + reg = <0xf0d70000 0x6c>; + interrupts = <0 53 4>; + }; + + sde@f0d90000 { + compatible = "nvt,kdrv_sde"; + reg = <0xf0d90000 0x90>; + interrupts = <0 74 4>; + }; + + ide@f0800000 { + compatible = "nvt,nvt_ide"; + reg = <0xf0800000 0x1000>; + interrupts = <0 48 4>; + }; + + dsi@f0840000 { + compatible = "nvt,nvt_dsi"; + reg = <0xf0840000 0x1000>; + interrupts = <0 50 4>; + }; + + csi@f0280000 { + compatible = "nvt,nvt_csi"; + reg = <0xf0280000 0x100 + 0xf0330000 0x100>; + interrupts = <0 54 4 + 0 55 4>; + }; + + lvds@f0270000 { + compatible = "nvt,nvt_lvds"; + reg = <0xF0270000 0x200 + 0xF0370000 0x200>; + interrupts = <0 54 4 + 0 55 4>; + }; + + senphy@f06b0000 { + compatible = "nvt,nvt_senphy"; + reg = <0xF06B0000 0x100>; + }; + + ssenif@f0xx0000 { + compatible = "nvt,nvt_ssenif"; + reg = <0xF02C0000 0x2000>; + interrupts = <0 61 4>; + }; + + sif@f0240000 { + compatible = "nvt,nvt_sif"; + reg = <0xf0240000 0x200>; + interrupts = <0 40 4>; + clock-frequency = <1000000>; + }; + + graphic@f0c80000 { + compatible = "nvt,nvt_graphic"; + reg = <0xF0C80000 0x300 + 0xF0D10000 0x100>; + interrupts = <0 18 4 + 0 19 4>; + }; + + affine@f0ca0000 { + compatible = "nvt,nvt_affine"; + reg = <0xF0CA0000 0x100>; + interrupts = <0 52 4>; + }; + + h26x@f0a10000 { + compatible = "nvt,nvt_h26x"; + reg = <0xf0a10000 0xa00>; + interrupts = <0 16 4>; + power_saving = <0>; + }; + + timer@f0040000 { + compatible = "nvt,nvt_timer"; + reg = <0xf0040000 0x300>; + interrupts = <0 0 4>; + }; + + eac@f0640000 { + compatible = "nvt,nvt_eac"; + reg = <0xF0640000 0x200>; + }; + + jpg@f0a00000 { + compatible = "nvt,nvt_jpg"; + reg = <0xf0a00000 0x100>; + interrupts = <0 17 4>; + }; + + nvt_usb2host@f0600000 { + compatible = "nvt,ehci-nvtivot"; + reg = <0xf0600000 0x10000>; + interrupts = <0 27 4>; + }; + + nvt_usb2dev@f0600000 { + compatible = "nvt,fotg200_udc"; + reg = <0xf0600000 0x10000>; + interrupts = <0 27 4>; + }; + + nvt_usb_chrg@f0600000 { + compatible = "nvt,nvt_usb_chrgdet"; + reg = <0xf0600000 0x10000>; + }; + + dai@f0630000 { + compatible = "nvt,nvt_dai"; + reg = <0xF0630000 0xbc>; + interrupts = <0 15 4>; + }; + + rotate@f0cf0000 { + compatible = "nvt,nvt_rotation"; + reg = <0xF0CF0000 0x100>; + interrupts = <0 81 4>; + }; + + drvdump@0 { + compatible = "nvt,nvt_drvdump"; + }; + + dsp@f1430000 { + compatible = "nvt,nvt_dsp"; + reg = <0xF1430000 0x200 + 0xF2000000 0x1000000 + 0xF1440000 0x200 + 0xF3000000 0x1000000>; + interrupts = <0 76 4 + 0 77 4>; + }; + + spi0: spi@f0230000 { + compatible = "nvt,nvt_spi"; + reg = <0xf0230000 0x10000>; + interrupts = <0 35 4>; + dma-support = <0>; + nvt-devname = <0>; + }; + + spi1: spi@f0320000 { + compatible = "nvt,nvt_spi"; + reg = <0xf0320000 0x10000>; + interrupts = <0 36 4>; + dma-support = <0>; + nvt-devname = <1>; + }; + + spi2: spi@f0340000 { + compatible = "nvt,nvt_spi"; + reg = <0xf0340000 0x10000>; + interrupts = <0 37 4>; + dma-support = <0>; + nvt-devname = <2>; + }; + + sdp@f0390000 { + compatible = "nvt,nvt_sdp"; + reg = <0xf0390000 0x28>; + interrupts = <0 12 4>; + }; + + tse@f0650000 { + compatible = "nvt,nvt_tse"; + reg = <0xF0650000 0x90>; + interrupts = <0 23 4>; + }; + + remote@f0250000 { + compatible = "nvt,nvt_remote"; + reg = <0xf0250000 0x28>; + interrupts = <0 25 4>; + }; + + rng: rng@f0680000 { + compatible = "nvt,nvt_rng"; + reg = <0xf0680000 0x100>; + }; + + nvt_arb@f0000000 { + compatible = "nvt,nvt_arb"; + reg = <0xF0000000 0xA000 + 0xF0FE0000 0x300>; + interrupts = <0 33 4>; + }; + + nvt_otp@f0660000 { + compatible = "nvt,nvt_otp"; + reg = <0xF0660000 0x70>; + }; + + kdrv_ipp { + clock-frequency = <240000000>; + }; + + uvcp: uvcp@f0690000 { + compatible = "nvt,nvt_uvcp"; + reg = <0xf0690000 0x200>; + interrupts = <0 59 4>; + }; + pll_preset@0 { + pll3{pll_config = <3 0 0>;}; + pll4{pll_config = <4 0 0>;}; + pll5{pll_config = <5 297000000 1>;}; + pll6{pll_config = <6 0 0>;}; + pll7{pll_config = <7 0 0>;}; + pll8{pll_config = <8 0 0>;}; + pll9{pll_config = <9 0 0>;}; + pll11{pll_config = <11 0 0>;}; + pll12{pll_config = <12 0 1>;}; + }; +}; +# 11 "nvt-evb.dts" 2 +# 1 "nvt-top.dtsi" 1 +&top { + sdio{pinmux = <0x5>;}; + sdio2{pinmux = <0x5>;}; + sdio3{pinmux = <0x0>;}; + nand{pinmux = <0x5>;}; + sensor{pinmux = <0x0>;}; + sensor2{pinmux = <0x0>;}; + mipi_lvds{pinmux = <0x0>;}; + i2c{pinmux = <0x40>;}; + sif{pinmux = <0x0>;}; + uart{pinmux = <0x1021>;}; + spi{pinmux = <0x0>;}; + sdp{pinmux = <0x0>;}; + remote{pinmux = <0x0>;}; + pwm{pinmux = <0x8000>;}; + pwm2{pinmux = <0x000000>;}; + ccnt{pinmux = <0x0>;}; + audio{pinmux = <0x0>;}; + lcd{pinmux = <0x0>;}; + tv{pinmux = <0x0>;}; + eth{pinmux = <0x0>;}; + misc{pinmux = <0x0>;}; +}; +# 12 "nvt-evb.dts" 2 +# 1 "nvt-i2c.dtsi" 1 + + + + + + + +/ { + i2c0: i2c@f0220000 { compatible = "nvt,nvt_i2c"; reg = <0xf0220000 0x100>; interrupts = <0 41 4>; clock-frequency = <1000000>; id = <0>; }; + i2c1: i2c2@f0350000 { compatible = "nvt,nvt_i2c"; reg = <0xf0350000 0x100>; interrupts = <0 42 4>; clock-frequency = <1000000>; id = <1>; }; + i2c2: i2c3@f03a0000 { compatible = "nvt,nvt_i2c"; reg = <0xf03a0000 0x100>; interrupts = <0 60 4>; clock-frequency = <50000>; id = <2>; }; +}; +# 13 "nvt-evb.dts" 2 +# 1 "nvt-gpio.dtsi" 1 +&top { +# 201 "nvt-gpio.dtsi" + pgpio11{gpio_config = <(11 + 0x20) 1>;}; + + pgpio2{gpio_config = <(2 + 0x20) 1>;}; +}; +# 14 "nvt-evb.dts" 2 +# 1 "nvt-peri-dev.dtsi" 1 +# 11 "nvt-peri-dev.dtsi" +&i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + + + + + +}; + +&i2c1 { + #address-cells = <1>; + #size-cells = <0>; +}; + +&i2c2 { + #address-cells = <1>; + #size-cells = <0>; +}; + +&spi0 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; +# 44 "nvt-peri-dev.dtsi" +}; + +&spi1 { + status = "okay"; +}; + +&spi2 { + status = "okay"; +}; +# 15 "nvt-evb.dts" 2 +# 1 "nvt-audio.dtsi" 1 + + + + + + + +/ { + audio@1 { type = "none"; i2s_ctrl = <0>; sif_channel = <0>; gpio_cold_reset = <0>; gpio_data = <0>; gpio_clk = <0>; gpio_cs = <0>; adc_zero = <0>; }; + audio@2 { type = "embedded"; i2s_ctrl = <4>; sif_channel = <0>; gpio_cold_reset = <0>; gpio_data = <0>; gpio_clk = <0>; gpio_cs = <0>; adc_zero = <0>; }; +}; +# 16 "nvt-evb.dts" 2 +# 1 "nvt-display.dtsi" 1 + + + + + + + +# 1 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/pinctrl/nvt_lcd.h" 1 +# 9 "nvt-display.dtsi" 2 +# 25 "nvt-display.dtsi" +/ { + display { type = "lcd"; lcd_ctrl = <1>; sif_channel = <4>; gpio_cs = <(7 + 0x20)>; gpio_clk = <(8 + 0x20)>; gpio_data = <(9 + 0x20)>; }; + logo { enable = <1>; lcd_type = <5>; lcd_rotate = <270>; lcd_reset = <(1 + 0x60)>; lcd_bl_gpio = <(11 + 0x20) 1>; lcd_power = <(8 + 0x20) 1>;}; +}; +# 17 "nvt-evb.dts" 2 +# 1 "nvt-media.dtsi" 1 +# 10 "nvt-media.dtsi" +# 1 "nvt-basic.dtsi" 1 +# 11 "nvt-basic.dtsi" +/ { + model = "Novatek NA51089"; + compatible = "novatek,na51089", "nvt,ca9"; + interrupt-parent = <&gic>; + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0x0>; + next-level-cache = <&L2>; + clock-frequency = <960000000>; + }; + }; + + cg@f0020000 { + compatible = "nvt,core_clk"; + reg = <0xf0020000 0x1000>; + }; + + + periph_clk: periph_clk { + compatible = "nvt,periph_clk"; + #clock-cells = <0>; + clock-output-names = "periph_clk"; + }; + + global_timer@ffd00200 { + compatible = "arm,cortex-a9-global-timer"; + reg = <0xffd00200 0x20>; + interrupts = <1 11 0xf01>; + clocks = <&periph_clk>; + }; + + private_timer@ffd00600 { + compatible = "arm,cortex-a9-twd-timer"; + reg = <0xffd00600 0x20>; + interrupts = <1 13 0xf01>; + clocks = <&periph_clk>; + }; + + pmu { + compatible = "arm,cortex-a9-pmu"; + interrupts = <0 112 4>; + interrupt-affinity = <&cpu0>; + }; + + L2: cache-controller@ffe00000 { + compatible = "arm,pl310-cache"; + reg = <0xffe00000 0x1000>; + interrupts = <0 96 4>; + cache-unified; + arm,shared-override; + cache-level = <2>; + arm,data-latency = <2 2 2>; + arm,tag-latency = <2 2 2>; + }; + + gic: interrupt-controller@0xffd00000 { + compatible = "arm,cortex-a9-gic"; + #interrupt-cells = <3>; + interrupt-controller; + reg = <0xffd01000 0x1000>, + <0xffd00100 0x1000>; + }; + + scu: snoop-control-unit@0xffd00000 { + compatible = "arm,cortex-a9-scu"; + reg = <0xffd00000 0x100>; + }; +}; +# 11 "nvt-media.dtsi" 2 + +/ { + nvtmpp { + compatible = "nvt,nvtmpp"; + }; + + isf_stream { + compatible = "nvt,isf_stream"; + }; + + isf_flow { + compatible = "nvt,isf_flow"; + }; + + isf_vdocap { + compatible = "nvt,isf_vdocap"; + }; + + isf_vdoprc { + compatible = "nvt,isf_vdoprc"; + }; + + isf_dummy { + compatible = "nvt,isf_dummy"; + }; + + isf_vdoenc { + compatible = "nvt,isf_vdoenc"; + }; + + isf_vdodec { + compatible = "nvt,isf_vdodec"; + }; + + isf_vdoout { + compatible = "nvt,isf_vdoout"; + }; + + dispobj { + compatible = "nvt,nvt_dispobj"; + }; + + dispdev { + compatible = "nvt,nvt_dispdev"; + }; + + audio { + compatible = "nvt,nvt_audio"; + }; + + msdcnvt { + compatible = "nvt,msdcnvt"; + }; + + msdcnvt_adj { + compatible = "nvt,msdcnvt_adj"; + }; + + msdcnvt_custom_si { + compatible = "nvt,msdcnvt_custom_si"; + }; + + wavstudio { + compatible = "nvt,wavstudio"; + }; + + isf_audenc { + compatible = "nvt,isf_audenc"; + }; + + isf_auddec { + compatible = "nvt,isf_auddec"; + }; + + isf_audcap { + compatible = "nvt,isf_audcap"; + }; + + isf_audout { + compatible = "nvt,isf_audout"; + }; + + nvt_ipc { + compatible = "nvt,nvt_ipc"; + }; +}; +# 18 "nvt-evb.dts" 2 +# 1 "nvt-mem-tbl.dtsi" 1 + + + + + + +/ { + + nvt_memory_cfg { + #address-cells = <1>; + #size-cells = <1>; + dram { reg = <0x00000000 0x08000000>; }; + shmem{ reg = <0x00007E00 0x00000200>; }; + loader { reg = <0x01000000 0x00080000>; }; + fdt { reg = <0x01800000 0x00040000>; }; + rtos { reg = <0x01840000 0x00FC0000>; }; + linuxtmp{ reg = <0x02800000 0x04000000>; }; + uboot{ reg = <0x06800000 0x01640000>; }; + logo-fb{ reg = <0x07E40000 0x001C0000>; }; + }; + + + memory { device_type = "memory"; reg = <0x00000000 0x01800000 0x02000000 0x01600000>; }; + + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + }; + + + + + + + libc-heap { size = <0x00200000>; }; + + hdal-memory { + #address-cells = <1>; + #size-cells = <1>; + media { reg = <0x03600000 0x04A00000>; }; + }; + + hdal-maxpath-cfg { + + vdocap_active_list = <1 0 0 0 0 0 0 0>; + vdoprc_maxdevice = <2>; + vdoenc_maxpath = <4>; + vdodec_maxpath = <3>; + vdoout_maxdevice = <1>; + adocap_maxdevice = <1>; + adoout_maxdevice = <2>; + adoenc_maxpath = <1>; + adodec_maxpath = <1>; + + gfx_maxjob = <2>; + + stamp_maximg = <9>; + + vdoprc_maxstamp = <4 4>; + + vdoprc_maxmask = <4 4>; + vdoenc_maxstamp = <9 9>; + vdoenc_maxmask = <0 64>; + vdoout_maxstamp = <0 16>; + vdoout_maxmask = <0 64>; + }; +}; +# 19 "nvt-evb.dts" 2 +# 1 "nvt-storage-partition.dtsi" 1 + + + + + + + +&nor { + partition_loader { label = "loader"; reg = <0x0 0x0000000 0x0 0x10000>; }; + partition_fdt { label = "fdt"; reg = <0x0 0x10000 0x0 0x10000>; }; + partition_fdt.restore { label = "fdt.restore"; reg = <0x0 0x20000 0x0 0x10000>; }; + partition_fdt.app { label = "fdt.app"; reg = <0x0 0x30000 0x0 0x20000>; }; + partition_uboot { label = "uboot"; reg = <0x0 0x50000 0x0 0xA0000>; }; + partition_uenv { label = "uenv"; reg = <0x0 0xF0000 0x0 0x10000>; }; + partition_kernel { label = "kernel"; reg = <0x0 0x100000 0x0 0x290000>; }; + partition_rootfs { label = "rootfs"; reg = <0x0 0x390000 0x0 0x3E0000>; }; + partition_rootfs1 { label = "rootfs1"; reg = <0x0 0x770000 0x0 0xB00000>; }; + partition_rtos { label = "rtos"; reg = <0x0 0x1270000 0x0 0x900000>; }; + partition_app { label = "app"; reg = <0x0 0x1B70000 0x0 0x50000>; }; + partition_sys { label = "sys"; reg = <0x0 0x1CC0000 0x0 0x10000>; }; + partition_all { label = "all"; reg = <0x0 0x0000000 0x0 0x2000000>; }; +}; +# 20 "nvt-evb.dts" 2 +# 1 "nvt-info.dtsi" 1 + + + + + + + +/ { + nvt_info { + BIN_NAME = "FW98565A"; + BIN_NAME_T = "FW98565T"; + RTOS_APP_MAIN = "cardv"; + + EMBMEM_BLK_SIZE = "0x10000"; +# 24 "nvt-info.dtsi" + EMBMEM = "EMBMEM_SPI_NOR"; +# 34 "nvt-info.dtsi" + FW_TYPE = "FW_TYPE_PARTIAL"; + + + + + + UI_STYLE = "UI_STYLE_LVGL"; + + + + + + NVT_CFG_APP_EXTERNAL = "hostapd wireless_tool iperf-3 wpa_supplicant dhd_priv"; + + NVT_CFG_APP = "mem cardv memcpy isp_demon sf_app"; + + NVT_ROOTFS_ETC = ""; + + NVT_BINARY_FILE_STRIP = "yes"; + + NVT_CFG_KERNEL_CFG = "na51089_evb_cardv_defconfig_release"; + + NVT_MAKE_POST = "make_post.sh"; + + NVT_SAMPLES_INSTALL = "DISABLE"; + + NVT_CFG_UBOOT_CFG = ""; + + + + + + + + NVT_LINUX_SMP = "NVT_LINUX_SMP_OFF"; + + + + + + + + NVT_CHIP_ID = "CHIP_NA51089"; + + + + + + + + NVT_LINUX_COMPRESS = "NVT_LINUX_COMPRESS_GZ"; + + + + + + + + NVT_DEFAULT_NETWORK_BOOT_PROTOCOL = "NVT_DEFAULT_NETWORK_BOOT_PROTOCOL_STATIC_IP"; +# 103 "nvt-info.dtsi" + NVT_ROOTFS_TYPE = "NVT_ROOTFS_TYPE_RAMDISK"; +# 113 "nvt-info.dtsi" + LCD1 = "disp_if8b_lcd1_psd200_st7789v"; +# 126 "nvt-info.dtsi" + SENSOR1 = "sen_os05b10"; + SENSOR1_CFG = "sen_os05b10_565"; + SENSOR2 = "sen_off"; + SENSOR2_CFG = "sen_off"; + + + + + + NVT_ROOTFS_RW_PART_EN = "NVT_ROOTFS_RW_PART_EN_ON"; + + + + + + + NVT_ETHERNET = "NVT_ETHERNET_NONE"; +# 151 "nvt-info.dtsi" + NVT_SDIO_WIFI = "NVT_SDIO_WIFI_RTK"; + + + + + + NVT_USB_WIFI = "NVT_USB_WIFI_NONE"; + + + + + + NVT_USB_4G = "NVT_USB_4G_NONE"; + + + + + + + WIFI_RTK_MDL = "WIFI_RTK_MDL_8189"; + + + + + + + + WIFI_BRCM_MDL = "WIFI_BRCM_MDL_43456c5_ampk6256c5"; + + + + + + + WIFI_NVT_MDL = "WIFI_NVT_MDL_18211"; + + + + + + + NVT_CURL_SSL = "NVT_CURL_SSL_OPENSSL"; +# 201 "nvt-info.dtsi" + NVT_UBOOT_ENV_IN_STORG_SUPPORT = "NVT_UBOOT_ENV_IN_STORG_SUPPORT_OFF"; + + + + + + + TOUCH = "TOUCH_OFF"; + + + + + + + UBOOT_ONLY_LOAD_LINUX = "UBOOT_ONLY_LOAD_LINUX_ON"; + + }; +}; +# 21 "nvt-evb.dts" 2 +# 1 "nvt-nvtpack.dtsi" 1 + + + + + + + +&nor { + + + + + nvtpack { + ver = "NVTPACK_FW_INI_16072017"; + method = <1>; + index { + id0 { partition_name = "loader"; source_file = ""; }; + id1 { partition_name = "fdt"; source_file = "nvt-evb.bin"; }; + id2 { partition_name = "fdt.restore"; source_file = ""; }; + id3 { partition_name = "fdt.app"; source_file = "../application.bin"; }; + id4 { partition_name = "uboot"; source_file = "u-boot.bin"; }; + id5 { partition_name = "uenv"; source_file = ""; }; + id6 { partition_name = "kernel"; source_file = "uImage.bin"; }; + id7 { partition_name = "rootfs"; source_file = "rootfs.ramdisk.bin"; }; + id8 { partition_name = "rootfs1"; source_file = "rootfs_1.squash.bin"; }; + id9 { partition_name = "rtos"; source_file = "../rtos-main.bin"; }; + id10 { partition_name = "app"; source_file = "appfs.cardv.jffs2.nor.bin"; }; + id11 { partition_name = "sys"; source_file = ""; }; + }; + }; +}; +# 21 "nvt-evb.dts" 2 diff --git a/rtos/code/driver/na51089/source/mcu/sf_mcu.c b/rtos/code/driver/na51089/source/mcu/sf_mcu.c index 2859f9970..775d734ea 100644 --- a/rtos/code/driver/na51089/source/mcu/sf_mcu.c +++ b/rtos/code/driver/na51089/source/mcu/sf_mcu.c @@ -1688,7 +1688,7 @@ UINT8 sf_mcu_reg_set(MCUParam_t attrId, UINT8 val) temp |= 0x40; } - if((puiPara->GprsMode) && (val == 1)) + if((puiPara->GprsSwitch) && (val == 1)) { temp |= 0x80; }else @@ -1729,7 +1729,7 @@ UINT8 sf_mcu_reg_set(MCUParam_t attrId, UINT8 val) temp |= 0x40; } - if((puiPara->GprsMode) && (simCardInsert)) + if((puiPara->GprsSwitch) && (simCardInsert)) { temp |= 0x80; }else @@ -2123,11 +2123,11 @@ void sf_add_file_name_to_send_list(char *sendfname) { char sendListName[64] = {0}; char buff[SF_SEND_LIST_ITEM_LENGTH+1] = {0}; - //UINT32 fd = 0; + int fd = 0; UIMenuStoreInfo *puiPara = sf_ui_para_get(); #if SF_IQ_TEST != ENABLE - FileSys_SetAttrib(PHOTO_THUMB_PATH, FST_ATTRIB_HIDDEN | FST_ATTRIB_SYSTEM, TRUE); + FileSys_SetAttrib(PHOTO_THUMB_PATH, FST_ATTRIB_HIDDEN/* | FST_ATTRIB_SYSTEM*/, TRUE); #endif if(strlen(sendfname) != SF_SEND_LIST_ITEM_LENGTH-3) //3 ->CamMode \r\n @@ -2142,9 +2142,13 @@ void sf_add_file_name_to_send_list(char *sendfname) }else { snprintf(sendListName, sizeof(sendListName), "%s", SF_THUMB_SEND_LIST); } - - - int fd = open(sendListName, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); + if(access(sendListName, F_OK) == 0) + { + fd = open(sendListName, O_APPEND | O_WRONLY); + } + else { + fd = open(sendListName, O_APPEND | O_WRONLY | O_CREAT); + } if(fd) {