From 53a2bce15df15976709d7c4e3de517a50b0538b5 Mon Sep 17 00:00:00 2001 From: payton Date: Mon, 7 Aug 2023 16:27:35 +0800 Subject: [PATCH 1/9] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E6=B0=B4=E5=8D=B0?= =?UTF-8?q?=E9=96=8B=E9=97=9C=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rootfs/etc_Model/etc_565_HUNTING_EVB_LINUX_4G_S530/profile | 3 ++- code/application/source/cardv/SrcCode/System/SysMain_cmd.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/BSP/root-fs/rootfs/etc_Model/etc_565_HUNTING_EVB_LINUX_4G_S530/profile b/BSP/root-fs/rootfs/etc_Model/etc_565_HUNTING_EVB_LINUX_4G_S530/profile index a859ec77f..2717fbebe 100755 --- a/BSP/root-fs/rootfs/etc_Model/etc_565_HUNTING_EVB_LINUX_4G_S530/profile +++ b/BSP/root-fs/rootfs/etc_Model/etc_565_HUNTING_EVB_LINUX_4G_S530/profile @@ -77,4 +77,5 @@ alias setusbmuxs='cardv sys setusbmuxs' alias 4gusbboot='cardv sys 4gusbboot' alias ftpsw='cardv sys ftpsw' alias ftpset='cardv sys ftpset' -alias ftpsset='cardv sys ftpsset' \ No newline at end of file +alias ftpsset='cardv sys ftpsset' +alias stampsw='cardv sys stampsw' \ No newline at end of file diff --git a/code/application/source/cardv/SrcCode/System/SysMain_cmd.c b/code/application/source/cardv/SrcCode/System/SysMain_cmd.c index e078b17bb..7b9e113a2 100755 --- a/code/application/source/cardv/SrcCode/System/SysMain_cmd.c +++ b/code/application/source/cardv/SrcCode/System/SysMain_cmd.c @@ -212,6 +212,7 @@ SXCMD_ITEM("worktime %", sf_cmd_work_time_switch, "worktime x 0/1 hh mm hh mm ") SXCMD_ITEM("dateauto %", sf_cmd_date_auto, "dateauto 0/1") SXCMD_ITEM("datestyle %", sf_cmd_date_style, "datestyle 0/1/2") SXCMD_ITEM("campwd %", sf_cmd_pwd_switch, "campwd 0/1 xxxxxx") +SXCMD_ITEM("stampsw %", sf_cmd_stamp_switch, "stamp 0/1") SXCMD_ITEM("battype %", sf_cmd_battery_type, "battype 0/1/2/3") SXCMD_ITEM("sdloop %", sf_cmd_sd_loop_switch, "sdloop 0/1") SXCMD_ITEM("rtcset %", cmd_rtc_set, "rtcset y m d h m s") From 10268a2bf27427b4cc84caf0c67ec73125fad001 Mon Sep 17 00:00:00 2001 From: payton Date: Mon, 7 Aug 2023 16:35:54 +0800 Subject: [PATCH 2/9] =?UTF-8?q?1.getpic=20cmd=E4=BD=BF=E7=94=A8=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/source/sifar/code/include/sf_common.h | 1 + .../sifar/code/source/common/sf_common.c | 82 +++++++++++++------ 2 files changed, 57 insertions(+), 26 deletions(-) diff --git a/code/lib/source/sifar/code/include/sf_common.h b/code/lib/source/sifar/code/include/sf_common.h index aab391e67..deec4d975 100755 --- a/code/lib/source/sifar/code/include/sf_common.h +++ b/code/lib/source/sifar/code/include/sf_common.h @@ -118,4 +118,5 @@ BOOL sf_cmd_disp_para_set(unsigned char argc, char **argv); BOOL sf_cmd_ftp_switch(unsigned char argc, char **argv); BOOL sf_cmd_ftp(unsigned char argc, char **argv); BOOL sf_cmd_ftps(unsigned char argc, char **argv); +UINT32 sf_cardv_cap_start(void); #endif 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 27e34d47f..1ff20d8a7 100755 --- a/code/lib/source/sifar/code/source/common/sf_common.c +++ b/code/lib/source/sifar/code/source/common/sf_common.c @@ -99,7 +99,11 @@ static SF_THREAD_S WifiTskCfg = .IsRun = 0, .TskId = -1, }; - +static SF_THREAD_S CapTskCfg = +{ + .IsRun = 0, + .TskId = -1, +}; int sf_pir_statu_read(void) { static UINT8 state = 0; @@ -1626,31 +1630,7 @@ static SINT32 sf_cardv_proccess_cmd_wifi(SF_MESSAGE_BUF_S *pMessageBuf) 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(400); - } - } - - FlowPhoto_DoCapture(); + sf_cardv_cap_start(); break; case SF_WIFI_CMD_HD_TURE: if(!hdFlagInit) @@ -2436,4 +2416,54 @@ BOOL sf_cmd_ftp_switch(unsigned char argc, char **argv) } printf("[%s:%d] FtpSwitch:%d\n", __FUNCTION__, __LINE__,puiPara->FtpSwitch); return TRUE; +} + +void* sf_cardv_cap_thread(void *arg) +{ + 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(1000); + } + } + + FlowPhoto_DoCapture(); + CapTskCfg.IsRun = 0; + return NULL; +} + +UINT32 sf_cardv_cap_start(void) +{ + SINT32 ret = 1; + if(CapTskCfg.IsRun) + { + SLOGE("thread has already run !!!\n"); + return 1; + } + ret = pthread_create(&CapTskCfg.TskId, NULL, sf_cardv_cap_thread, NULL); + if(ret != SF_SUCCESS) + { + MLOGD("thread creat fail!\n"); + return ret; + } + CapTskCfg.IsRun = 1; + return SF_SUCCESS; + } \ No newline at end of file From b4ca6d2971f70083305b062ce928862d6b4280b8 Mon Sep 17 00:00:00 2001 From: payton Date: Mon, 7 Aug 2023 16:40:48 +0800 Subject: [PATCH 3/9] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8Ddptest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 code/application/source/sf_app/code/source/systemMng/sf_commu_mcu_reg.c 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 old mode 100644 new mode 100755 index 25adfc72d..3937841c8 --- 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 @@ -1269,7 +1269,7 @@ void sf_dailyReport_refresh(void) } else { - puiPara->DailyReportTime2.Hour = (preRtcTime.Hour + (preRtcTime.Min + 30) / 60) % 24; + puiPara->DailyReportTime2.Hour = (preRtcTime.Hour + (preRtcTime.Min + 5) / 60) % 24; puiPara->DailyReportTime2.Min = (preRtcTime.Min + 5) % 60; } } From 8f26bdcb0bf11533c23e357081232a304b58e4dd Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 9 Aug 2023 11:50:04 +0800 Subject: [PATCH 4/9] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ code/application/.gitignore | 1 + 2 files changed, 3 insertions(+) create mode 100755 code/application/.gitignore diff --git a/.gitignore b/.gitignore index f82d49a2c..828fc5408 100755 --- a/.gitignore +++ b/.gitignore @@ -32,5 +32,7 @@ configs/cfg_gen configs/rtos/cfg_565_HUNTING_EVB_LINUX_4G_S530/ModelConfig.mk configs/rtos/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.dtb configs/rtos/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.tmp.dts +build/nvt-tools/__pycache__/pyfdt.cpython-36.pyc +rtos/build/nvt-tools/__pycache__/pyfdt.cpython-36.pyc logs/ output/ \ No newline at end of file diff --git a/code/application/.gitignore b/code/application/.gitignore new file mode 100755 index 000000000..b67992051 --- /dev/null +++ b/code/application/.gitignore @@ -0,0 +1 @@ +sifarsdk/ \ No newline at end of file From 89c032a209716f06e67fd089b23dd65920b1b6b6 Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 9 Aug 2023 11:51:55 +0800 Subject: [PATCH 5/9] =?UTF-8?q?1.=E6=A0=BC=E5=BC=8F=E5=8C=96led=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=EF=BC=9B2.=E6=B3=A8=E7=BD=91led=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIApp/Background/UIBackgroundObj.c | 12 +++++++--- .../sf_app/code/source/devMng/sf_ledmng.c | 23 ++++++++++++------- 2 files changed, 24 insertions(+), 11 deletions(-) mode change 100644 => 100755 code/application/source/sf_app/code/source/devMng/sf_ledmng.c diff --git a/code/application/source/cardv/SrcCode/UIApp/Background/UIBackgroundObj.c b/code/application/source/cardv/SrcCode/UIApp/Background/UIBackgroundObj.c index 43229cefa..6742b6a50 100755 --- a/code/application/source/cardv/SrcCode/UIApp/Background/UIBackgroundObj.c +++ b/code/application/source/cardv/SrcCode/UIApp/Background/UIBackgroundObj.c @@ -883,20 +883,26 @@ UINT32 BackgroundFormatCard(void) #if HUNTING_CAMERA_MCU == ENABLE //vos_util_delay_ms(1000); sf_sys_status_led_set(SF_LED_SYS_STATE_SD_FORMAT_SUCCESS); - vos_util_delay_ms(3000); + if(sf_get_pir_statu_flag()){ + vos_util_delay_ms(3000); + } #endif } else { #if HUNTING_CAMERA_MCU == ENABLE sf_sys_status_led_set(SF_LED_SYS_STATE_SD_FORMAT_FAIL); - vos_util_delay_ms(3000); + if(sf_get_pir_statu_flag()){ + vos_util_delay_ms(3000); + } #endif } MovieExe_ResetFileSN(); #if HUNTING_CAMERA_MCU == ENABLE sf_sys_status_led_set(SF_LED_SYS_STATE_SD_FORMAT_EXIT); - vos_util_delay_ms(1000); + if(sf_get_pir_statu_flag()){ + vos_util_delay_ms(1000); + } sf_set_card_statu(ret); #endif DBG_FUNC_END("\r\n"); 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 old mode 100644 new mode 100755 index 71039c1ef..1240279ba --- a/code/application/source/sf_app/code/source/devMng/sf_ledmng.c +++ b/code/application/source/sf_app/code/source/devMng/sf_ledmng.c @@ -684,10 +684,13 @@ void sf_sys_status_led_set(LedSysState_t ledSysStateId) break; case SF_LED_SYS_STATE_SD_FORMAT_START: - FormatSdFlag = 1; - sf_led_set(SF_LED_BUSY, SF_LED_STATE_OFF); - sf_set_runningLed(0); - isGoToPir = FALSE; + if(sf_get_pir_statu_flag()){ + FormatSdFlag = 1; + sf_led_set(SF_LED_BUSY, SF_LED_STATE_OFF); + sf_set_runningLed(0); + isGoToPir = FALSE; + } + //sf_led_set(SF_LED_BUSY, SF_LED_STATE_ON); //sf_led_set(SF_LED_ALL, SF_LED_STATE_OFF); sf_led_set(SF_LED_SD_G, SF_LED_STATE_FLASHING); @@ -695,13 +698,17 @@ void sf_sys_status_led_set(LedSysState_t ledSysStateId) break; case SF_LED_SYS_STATE_SD_FORMAT_SUCCESS: - FormatSdFlag = 2; + if(sf_get_pir_statu_flag()){ + FormatSdFlag = 2; + } sf_led_set(SF_LED_SD_G, SF_LED_STATE_ON); sf_led_set(SF_LED_SD_R, SF_LED_STATE_OFF); break; case SF_LED_SYS_STATE_SD_FORMAT_FAIL: - FormatSdFlag = 3; + if(sf_get_pir_statu_flag()){ + FormatSdFlag = 3; + } sf_led_set(SF_LED_SD_G, SF_LED_STATE_OFF); sf_led_set(SF_LED_SD_R, SF_LED_STATE_ON); break; @@ -815,7 +822,7 @@ void sf_sys_status_led_set(LedSysState_t ledSysStateId) case SF_LED_SYS_STATE_SIM_ERROR: sf_set_runningLed(0); - sf_led_set(SF_LED_SIG1_R, SF_LED_STATE_FLASHING); + sf_led_set(SF_LED_SIG1_R, SF_LED_STATE_SLOW_FLASHING); sf_led_set(SF_LED_SIG1_G, SF_LED_STATE_OFF); sf_led_set(SF_LED_SIG2, SF_LED_STATE_OFF); sf_led_set(SF_LED_SIG3, SF_LED_STATE_OFF); @@ -824,7 +831,7 @@ void sf_sys_status_led_set(LedSysState_t ledSysStateId) case SF_LED_SYS_STATE_SERVER_FAIL: sf_set_runningLed(0); - sf_led_set(SF_LED_SIG1_R, SF_LED_STATE_SLOW_FLASHING); + sf_led_set(SF_LED_SIG1_R, SF_LED_STATE_FLASHING); sf_led_set(SF_LED_SIG1_G, SF_LED_STATE_OFF); sf_led_set(SF_LED_SIG2, SF_LED_STATE_OFF); sf_led_set(SF_LED_SIG3, SF_LED_STATE_OFF); From e6c93f8212ad97b91950f5f44d27a9233a738ddb Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 9 Aug 2023 13:36:21 +0800 Subject: [PATCH 6/9] =?UTF-8?q?1.3=E5=90=AF=E5=8A=A8=E6=97=B6=E4=BA=AE?= =?UTF-8?q?=E7=82=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/sf_app/code/source/app/sf_app.c | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/code/application/source/sf_app/code/source/app/sf_app.c b/code/application/source/sf_app/code/source/app/sf_app.c index 6ad5492db..cb2b030b5 100755 --- a/code/application/source/sf_app/code/source/app/sf_app.c +++ b/code/application/source/sf_app/code/source/app/sf_app.c @@ -153,25 +153,24 @@ int main(int argc, char *argv[]) if((!isUsb) && (SF_MCU_STARTUP_NORMAL != startup) /*&& (0 == isUpdate)*/) { #if SF_IQ_TEST != ENABLE - sf_4G_usb_init(); - app_RegisterNet_start(); + if((0 == isUpdate)) + { + sf_4G_usb_init(); + app_RegisterNet_start(); + } #endif sf_app_battery_start(); + sf_sys_status_led_set(SF_LED_SYS_STATE_PIR_NOT_DETECT); + sf_sys_status_led_set(SF_LED_SYS_STATE_NORMAL); + } + else if(isUsb){ + sf_sys_status_led_set(SF_LED_SYS_STATE_USB_IN); } //sf_battery_check_init(); //sf_app_data_ready_start(); - - if(isUsb){ - sf_sys_status_led_set(SF_LED_SYS_STATE_USB_IN); - } - else{ - sf_sys_status_led_set(SF_LED_SYS_STATE_PIR_NOT_DETECT); - sf_sys_status_led_set(SF_LED_SYS_STATE_NORMAL); - } - if((startup == SF_MCU_STARTUP_NORMAL) && (!isUsb)) { app_auto_poweroff_start(); From 477d06b3dd83dfd6dc22f0dd0f459bc217d5d53b Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 9 Aug 2023 13:40:03 +0800 Subject: [PATCH 7/9] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E5=B7=A6=E5=A3=B0?= =?UTF-8?q?=E9=81=93=E6=97=A0=E5=A3=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/cardv/SrcCode/UIApp/Movie/UIAppMovie_RecSetting.c | 2 +- .../source/cardv/SrcCode/UIApp/Movie/UIAppMovie_RecSetting.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/application/source/cardv/SrcCode/UIApp/Movie/UIAppMovie_RecSetting.c b/code/application/source/cardv/SrcCode/UIApp/Movie/UIAppMovie_RecSetting.c index aa16b5435..0a8cb0c5a 100755 --- a/code/application/source/cardv/SrcCode/UIApp/Movie/UIAppMovie_RecSetting.c +++ b/code/application/source/cardv/SrcCode/UIApp/Movie/UIAppMovie_RecSetting.c @@ -256,7 +256,7 @@ MOVIEMULTI_AUDIO_INFO gMovie_Audio_Info = { #else 32000, //MOVIE_CFG_AUD_RATE #endif - _CFG_AUDIO_CH_STEREO, //MOVIE_CFG_AUD_CH + _CFG_AUDIO_CH_RIGHT, //MOVIE_CFG_AUD_CH 2, //MOVIE_CFG_AUD_CH_NUM }; diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/Movie/UIAppMovie_RecSetting.c b/rtos/code/application/source/cardv/SrcCode/UIApp/Movie/UIAppMovie_RecSetting.c index a24a229ff..5ecbd51e6 100755 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/Movie/UIAppMovie_RecSetting.c +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/Movie/UIAppMovie_RecSetting.c @@ -258,7 +258,7 @@ MOVIEMULTI_AUDIO_INFO gMovie_Audio_Info = { #else 32000, //MOVIE_CFG_AUD_RATE #endif - _CFG_AUDIO_CH_STEREO, //MOVIE_CFG_AUD_CH + _CFG_AUDIO_CH_RIGHT, //MOVIE_CFG_AUD_CH 2, //MOVIE_CFG_AUD_CH_NUM }; From 82fc4f4bc779547aa46532258b645772c89834c7 Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 9 Aug 2023 13:52:33 +0800 Subject: [PATCH 8/9] =?UTF-8?q?1.=E4=BD=8E=E7=94=B5=E9=87=8F=E8=AD=A6?= =?UTF-8?q?=E5=91=8A=EF=BC=9B=202.=E9=9B=86=E4=B8=AD=E5=8F=91=E9=80=81?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9B=203.dp=E7=BB=9F=E8=AE=A1=E5=80=BC?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=EF=BC=9B=204.max=20num=EF=BC=9B=205.usb=20ne?= =?UTF-8?q?t=E6=A3=80=E6=9F=A520s=206.=E6=8B=A8=E5=BB=BA=E6=97=B6=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E6=A0=87=E8=AF=86=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/sf_app/code/include/sf_file.h | 2 + .../source/sf_app/code/include/sf_ftp.h | 1 + .../sf_app/code/include/sf_param_enum.h | 1 + .../source/sf_app/code/source/4gMng/sf_ftp.c | 103 +++++++++++++---- .../sf_app/code/source/app/sf_service.c | 5 +- .../sf_app/code/source/fileMng/sf_file.c | 104 +++++++++++++++++- .../code/source/paramMng/sf_param_common.c | 2 +- .../code/source/systemMng/sf_commu_mcu.c | 1 + .../sifar/code/source/common/sf_common.c | 2 +- 9 files changed, 193 insertions(+), 28 deletions(-) mode change 100644 => 100755 code/application/source/sf_app/code/include/sf_file.h mode change 100644 => 100755 code/application/source/sf_app/code/include/sf_ftp.h mode change 100644 => 100755 code/application/source/sf_app/code/include/sf_param_enum.h mode change 100644 => 100755 code/application/source/sf_app/code/source/fileMng/sf_file.c mode change 100644 => 100755 code/application/source/sf_app/code/source/paramMng/sf_param_common.c mode change 100644 => 100755 code/application/source/sf_app/code/source/systemMng/sf_commu_mcu.c diff --git a/code/application/source/sf_app/code/include/sf_file.h b/code/application/source/sf_app/code/include/sf_file.h old mode 100644 new mode 100755 index 2cef2ad25..57d9eda84 --- a/code/application/source/sf_app/code/include/sf_file.h +++ b/code/application/source/sf_app/code/include/sf_file.h @@ -25,6 +25,8 @@ void sf_app_set_battery(UINT8 val, UINT8 type); UINT32 sf_create_dailyreport_file(void); +UINT32 sf_create_low_power_warn_file(void); + UINT8 sf_app_get_battery(void); void sf_custom_send_str_get(UINT8 *sendName, UINT8 *pStr); diff --git a/code/application/source/sf_app/code/include/sf_ftp.h b/code/application/source/sf_app/code/include/sf_ftp.h old mode 100644 new mode 100755 index 125c7f3f3..a9afa1846 --- a/code/application/source/sf_app/code/include/sf_ftp.h +++ b/code/application/source/sf_app/code/include/sf_ftp.h @@ -219,5 +219,6 @@ SINT32 sf_hd_ftp_send(void); SINT32 sf_video_ftp_send(void); SINT32 sf_get_ftp_open_flag(void); SINT32 sf_log_send_ftp(void); +SINT32 sf_low_power_warn_send_ftp(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 old mode 100644 new mode 100755 index 0317ed1ef..3c2605e30 --- a/code/application/source/sf_app/code/include/sf_param_enum.h +++ b/code/application/source/sf_app/code/include/sf_param_enum.h @@ -147,6 +147,7 @@ extern "C" { #define SF_ERROR_CODE SF_SD_ROOT"THUMB/warning.txt" #define SF_DAILYREPORT_TXT "DailyReport.txt" #define SF_LOG_TXT "log.txt" +#define SF_LOW_POWER_WARN_FILENAME SF_SD_ROOT"/THUMB/btalarm.txt" #define GPIO_DIR_OUT 1 #define GPIO_DIR_IN 0 diff --git a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c index 9ed447f34..7b9e7d6ba 100755 --- a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c @@ -117,52 +117,55 @@ extern char gsmPara[GPRS_INFO_LINE_MAX]; SINT32 sf_check_max_num(void) { SINT32 ret = SF_SEND_ERROR_REACH_MAX_NUM; - /*UIMenuStoreInfo *pPara = sf_app_ui_para_get(); - sfPara_t *sfParam = sf_ParaGet(); + UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); + SF_PDT_PARAM_STATISTICS_S *sfParam = sf_statistics_param_get(); + SF_PARA_TIME_S rTime; - printf("[%s:%d]sfParam->SendSuccCntPerDay=%d,puiPara->SendMaxNum=%d\n", __FUNCTION__, __LINE__, sfParam->SendSuccCntPerDay, puiPara->SendMaxNum); + printf("[%s:%d]sfParam->picSendMax=%d,puiPara->SendMaxNum=%d\n", __FUNCTION__, __LINE__, sfParam->picSendMax, puiPara->SendMaxNum); //the next day or more long time,need clear the max num limit. sf_sys_rtc_time_get(&rTime); - if((rTime.year != sfParam->PreYear) || (rTime.mon != sfParam->PreMonth) || (rTime.day != sfParam->Preday)) + if((rTime.Year != sfParam->Year) || (rTime.Mon != sfParam->Mon) || (rTime.Day != sfParam->Day)) { printf("new day, refresh counter!\n"); - sfParam->EmailSendCntPerDay = 0; - sfParam->SendSuccCntPerDay = 0; - sfParam->PreYear = rTime.Year; - sfParam->PreMonth = rTime.Mon; - sfParam->Preday = rTime.Day; + sfParam->picSendMax = 0; + sfParam->subscribeSendCnt = 0; + sfParam->subscribeVideoSendCnt = 0; + sfParam->Year=rTime.Year; + sfParam->Mon=rTime.Mon; + sfParam->Day=rTime.Day; + sfParam->Hour=rTime.Hour; } if(puiPara->SendMaxNum == 0) { - sfParam->PreYear = rTime.Year; - sfParam->PreMonth = rTime.Mon; - sfParam->Preday = rTime.Day; + sfParam->Year = rTime.Year; + sfParam->Mon = rTime.Mon; + sfParam->Day = rTime.Day; ret = SF_SUCCESS; } else { - if((sfParam->SendSuccCntPerDay < puiPara->SendMaxNum) || (sf_get_pic() == SF_TRUE)) + if((sfParam->picSendMax < puiPara->SendMaxNum) || (sf_sms_check_send() == SF_TRUE)) { ret = SF_SUCCESS; } } - if(ConfigureModeFlag) + if(SF_MCU_STARTUP_ONKEY == sf_poweron_type_get()) { ret = SF_SUCCESS; } if(ret != SF_SUCCESS) { - sprintf((char *)errMsg, "[%s:%d]Reach Max Num/Day Limit,Error Code:0x%08x", __FUNCTION__, __LINE__, ret); - SLOGE((SINT8 *)errMsg); - }*/ + sprintf((char *)logStr, "[%s:%d]Reach Max Num/Day Limit,Error Code:0x%08x", __FUNCTION__, __LINE__, ret); + SLOGE((char *)logStr); + } ret = SF_SUCCESS; printf("[%s:%d]ret=%d\n", __FUNCTION__, __LINE__, ret); @@ -1120,6 +1123,7 @@ SINT32 sf_ftp_dailyreport_send(void) UINT8 filePath[64] = { 0 }; int timeout = 120000; UIMenuStoreInfo *pPara = sf_app_ui_para_get(); + SF_PDT_PARAM_STATISTICS_S *pSifarPara = sf_statistics_param_get(); printf("%s:%d start\n", __FUNCTION__, __LINE__); @@ -1151,6 +1155,21 @@ SINT32 sf_ftp_dailyreport_send(void) printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); }else { DailyReportFtpSendSucess = 1; + pSifarPara->picSendCount = 0; + pSifarPara->sendThumbnailCount = 0; + pSifarPara->picSendSucessCount = 0; + pSifarPara->picSendTimeoutCount = 0; + pSifarPara->picSendFailCount = 0; + pSifarPara->sendThumbnailFailCount = 0; + pSifarPara->picSendTimeCount = 0; + pSifarPara->sendThumbnailTimeCount = 0; + pSifarPara->TirgNum=0; + pSifarPara->NewFlieCount=0; + pSifarPara->videoSendCount = 0; + pSifarPara->videoSendTimeCount = 0; + pSifarPara->videoSendFailCount = 0; + pSifarPara->videoSendSucessCount = 0; + pSifarPara->SendlowPowerWarnCnt = 0; } sf_dailyReport_set(); } @@ -1551,7 +1570,7 @@ SINT32 sf_concentrated_ftp_send(void) { 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 *)ftpFileName, sizeof(ftpFileName), "%s", pThumbFileCfg->stfileattr[piccount].thumbfileName); snprintf((char *)filePath, sizeof(filePath), "%s", pThumbFileCfg->stfileattr[piccount].thumbfilePath); sf_set_del_flag(FALSE); @@ -1566,7 +1585,7 @@ SINT32 sf_concentrated_ftp_send(void) { ret1 = sf_quectel_upload_file_to_module(filePath, ftpFileName); } - } + }*/ battery = sf_app_get_battery(); memset(cameraID, '\0', sizeof(cameraID)); memset(ftpFileName, '\0', sizeof(ftpFileName)); @@ -1578,7 +1597,8 @@ SINT32 sf_concentrated_ftp_send(void) }else{ snprintf((char *)ftpFileName, sizeof(ftpFileName), "%s%s", cameraID, pThumbFileCfg->stfileattr[piccount].thumbfileName); } - snprintf((char *)filePath, sizeof(filePath), "UFS:/%s", pThumbFileCfg->stfileattr[piccount].thumbfileName); + //snprintf((char *)filePath, sizeof(filePath), "UFS:/%s", pThumbFileCfg->stfileattr[piccount].thumbfileName); + snprintf((char *)filePath, sizeof(filePath), "%s", pThumbFileCfg->stfileattr[piccount].thumbfilePath); printf("%s:%d ftpFileName:%s filePath:%s\n", __FUNCTION__, __LINE__, ftpFileName, filePath); @@ -2151,6 +2171,49 @@ SINT32 sf_log_send_ftp(void) return ret2; } } + +SINT32 sf_low_power_warn_send_ftp(void) +{ + SINT32 ret = SF_SUCCESS; + UINT8 uploadFname[64] = { 0 }; + UINT8 customStr[64] = { 0 }; + UINT8 filePath[64] = { 0 }; + int timeout = 120000; + UIMenuStoreInfo *pPara = sf_app_ui_para_get(); + SF_PDT_PARAM_STATISTICS_S *pSifarPara = sf_statistics_param_get(); + + MLOGD("chack\n"); + if(pSifarPara->SendlowPowerWarnCnt) + { + MLOGD("SendlowPowerWarnCnt:%d",pSifarPara->SendlowPowerWarnCnt); + return SF_FAILURE; + } + + if(SUCCESS != sf_create_low_power_warn_file()) + { + MLOGD("err\n"); + return SF_FAILURE; + } + MLOGD("start\n"); + + sprintf((char *)filePath, "%s", SF_LOW_POWER_WARN_FILENAME); + + printf("%s:%d filePath:%s\n", __FUNCTION__, __LINE__, filePath); + sf_custom_str_get(customStr); + sprintf((char *)uploadFname, "%s-%s-btalarm.txt",pPara->ModuleImei, customStr); + + ret = sf_ftp_send(uploadFname, filePath, timeout); + + if(SF_SUCCESS != ret) + { + printf("%s:%d err ret: [0x%08X] filePath:%s\n", __FUNCTION__, __LINE__, ret, filePath); + }else { + pSifarPara->SendlowPowerWarnCnt++; + } + + printf("[%s:%d]ret:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret); + return ret; +} #ifdef __cplusplus #if __cplusplus } 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 fd5bdc508..e519b25e6 100755 --- a/code/application/source/sf_app/code/source/app/sf_service.c +++ b/code/application/source/sf_app/code/source/app/sf_service.c @@ -177,7 +177,7 @@ SINT32 sf_USB_net_init(void) { if(SUCCESS != ret){ MLOGE("usb net err %d\n",ret); }else { - for (i = 0; i < 40; i++) { + for (i = 0; i < 20; i++) { if(strncmp(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0){ ret = sf_check_usb0(); }else{ @@ -1051,12 +1051,13 @@ static SINT32 app_file_transfer(SF_FN_PARAM_S *pfnParam) { if (TRUE == sf_check_auto_thumb_file()) { s32ret = sf_send_file_to_ftp(1); } - + sf_low_power_warn_send_ftp(); break; case SF_MCU_STARTUP_BATCH_SEND: if (TRUE == sf_check_auto_thumb_file()) { s32ret = sf_concentrated_ftp_send(); } + sf_low_power_warn_send_ftp(); break; case SF_MCU_STARTUP_RING: 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 old mode 100644 new mode 100755 index 0fa754975..2dc89d91a --- a/code/application/source/sf_app/code/source/fileMng/sf_file.c +++ b/code/application/source/sf_app/code/source/fileMng/sf_file.c @@ -936,6 +936,7 @@ UINT32 sf_create_dailyreport_file(void) UINT8 localfea[5] = {0};/*Software fea*/ SF_PARA_TIME_S drRtcTime; + SINT16 fTemper = 0, cTemper = 0; /*Avoid New Card*/ @@ -967,7 +968,8 @@ UINT32 sf_create_dailyreport_file(void) i=0; - sprintf(str, "%d Celsius Degree", sf_app_get_temper(1)); + sf_stamp_temperature_get(&fTemper,&cTemper); + sprintf(str, "%d Celsius Degree", cTemper); sf_sys_rtc_time_get(&drRtcTime); @@ -1043,16 +1045,16 @@ UINT32 sf_create_dailyreport_file(void) pSifarPara->picSendCount + pSifarPara->videoSendCount); sf_versionGet(localver,localfea); - temp = batteryType; + temp = sf_battery_type_get(); //if(CameraCmd.setPara) // pPara = pPara_sms_saved; - if(temp == 1) + if(temp == SF_POWER_TYPE_DC) { sprintf(str, "DC"); } - else if(temp == 2) + else if(temp == SF_POWER_TYPE_LI_POLYER) { sprintf(str, "Custom"); } @@ -1259,6 +1261,100 @@ UINT32 sf_create_dailyreport_file(void) return ret; } + +/************************************************* + Function: sf_create_low_power_warn_file + Description: create low power warn file + Input: N/A + Output: N/A + Return: SUCCESS/FAIL + Others: N/A +*************************************************/ +UINT32 sf_create_low_power_warn_file(void) +{ + UINT32 fd = 0, ret = FAIL; + UINT8 szTmp[50] = {0}; + UINT8 str[20]= {0}; + UINT16 temp = 0; + UINT8 batVal = 0; + UIMenuStoreInfo *pPara = sf_app_ui_para_get(); + + temp = sf_battery_type_get(); + batVal = sf_battery_value_get(0); + + if (batVal > 20) + { + printf("battery val > 20,no need to send\n"); + return ret; + } + + /*Avoid New Card*/ + + if (access(SF_THUMB_DIR, F_OK) == -1) { + printf("%s directory does not exist. Creating...\n", SF_THUMB_DIR); + + if (mkdir(SF_THUMB_DIR, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) { + //perror("mkdir() error"); + } else { + printf("%s directory created.\n", SF_THUMB_DIR); + } + } else { + printf("%s directory exists.\n", SF_THUMB_DIR); + } + + if(sf_file_IsExsit(SF_LOW_POWER_WARN_FILENAME) == SF_TRUE){ + sf_file_remove(SF_LOW_POWER_WARN_FILENAME); + } + + fd = open(SF_LOW_POWER_WARN_FILENAME, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); + + if(!fd) + { + fd = open(SF_LOW_POWER_WARN_FILENAME, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); + } + + if(fd) + { + if(temp == SF_POWER_TYPE_DC) + { + SF_SPRINTF(str, "DC"); + } + else if(temp == SF_POWER_TYPE_LI_POLYER) + { + SF_SPRINTF(str, "Custom"); + } + else + { + if(pPara->BatteryType == 0) + SF_SPRINTF(str, "Alkaline"); + else if(pPara->BatteryType == 1) + SF_SPRINTF(str, "NI-MH"); + else + SF_SPRINTF(str, "Lithium"); + } + + SF_SPRINTF(szTmp, "Battery:%d%%\r\nPower Type:%s\r\n", batVal, str); + printf("Low Power Warn:%s", szTmp); + ret = write(fd, szTmp, SF_STRLEN(szTmp)); + + if(ret <0) + { + close(fd); + sf_file_remove(SF_LOW_POWER_WARN_FILENAME); + printf("write low power warn file failed!,ret:%d\n",ret); + ret = FAIL; + } + else + { + close(fd); + + ret = SUCCESS; + } + } + + return ret; +} + #if 0 /************************************************* Function: sf_is_enough_power_to_update diff --git a/code/application/source/sf_app/code/source/paramMng/sf_param_common.c b/code/application/source/sf_app/code/source/paramMng/sf_param_common.c old mode 100644 new mode 100755 index 09a678f40..750ad82c4 --- a/code/application/source/sf_app/code/source/paramMng/sf_param_common.c +++ b/code/application/source/sf_app/code/source/paramMng/sf_param_common.c @@ -1138,7 +1138,7 @@ void sf_statistics_param_reset(SF_PDT_PARAM_STATISTICS_S *pSfPara) pSfPara->subscribeSendCnt = 0; pSfPara->subscribeVideoSendCnt = 0; pSfPara->GpsSearchFailCnt = 0;/*dailyReport mode, search gps fail cnt*/ - + pSfPara->SendlowPowerWarnCnt = 0; pSfPara->SmsFlag = 0; pSfPara->SmsNumber = 0; diff --git a/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu.c b/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu.c old mode 100644 new mode 100755 index dcc34116f..69893a72f --- a/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu.c +++ b/code/application/source/sf_app/code/source/systemMng/sf_commu_mcu.c @@ -956,6 +956,7 @@ unsigned char sf_commu_parse_mcu_data(unsigned char * src, unsigned int len) } else if(1 == stMessageBuf.arg3) //ON->SETUP { + sf_set_pir_statu_flag(0); sf_set_module_sleep_flag(0); sf_com_message_send_to_cardv(&stMessageBuf); } 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 1ff20d8a7..89d74c1f4 100755 --- a/code/lib/source/sifar/code/source/common/sf_common.c +++ b/code/lib/source/sifar/code/source/common/sf_common.c @@ -754,7 +754,7 @@ BOOL sf_cmd_latitude(unsigned char argc, char **argv) { //UINT32 value; UIMenuStoreInfo *puiPara = sf_ui_para_get(); - //printf("[%s:%d] value:%d\n", __FUNCTION__, __LINE__,value); + //printf("[%s:%d] value:%d\n", __FUNCTION__, __LINE__,value); if(1 == argc) { strncpy(puiPara->Latitude, argv[0], ((sizeof(puiPara->Latitude) <= strlen(argv[0])) ? (sizeof(puiPara->Latitude)) : (strlen(argv[0])))); From 75bf4c4ed7076117d477d5987a48e1f9bbe4bba0 Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 9 Aug 2023 13:53:12 +0800 Subject: [PATCH 9/9] =?UTF-8?q?1.eg91=E5=8D=87=E7=BA=A7=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/application/source/sf_app/code/source/app/sf_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 code/application/source/sf_app/code/source/app/sf_system.c 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 old mode 100644 new mode 100755 index 0527e0877..459411b27 --- a/code/application/source/sf_app/code/source/app/sf_system.c +++ b/code/application/source/sf_app/code/source/app/sf_system.c @@ -1160,7 +1160,7 @@ UINT32 sf_4g_update(UINT8 *upFname) sprintf(cmdStr, "/usr/bin/DownloadCLI-EG915Q -p /dev/ttyACM0 -c %s/cfg_ec618_usb.ini -B \"BL AP CP\" -r", upFname); sprintf(cmdtmp, "/dev/ttyACM0"); }else { - sprintf(cmdStr, "/customer/QFirehose -f %s",upFname); + sprintf(cmdStr, "/usr/bin/QFirehose-EG91 -f %s",upFname); sprintf(cmdtmp, "/dev/ttyUSB0"); } printf("[%s:%d] cmd:%s\n", __FUNCTION__, __LINE__,cmdStr);