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 bf0fcd70a..ccf2cb4f2 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 @@ -213,7 +213,7 @@ #define DEFAULT_PIR_DELAY_SWITCH SF_OFF #define DEFAULT_GPRS_MODE SF_REMOTE_CONTROL_OFF #define DEFAULT_DAILY_REPORT_SWITCH SF_ON -#define DEFAULT_GPS_SWITCH SF_OFF +#define DEFAULT_GPS_SWITCH SF_ON //#if defined(_MODEL_565_HUNTING_EVB_LINUX_4G_68CS_) //#define DEFAULT_PIR_SENSITIVITY SF_PIR_SENSITIVITY_HIGH //#elif defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) diff --git a/code/application/source/sf_app/Makefile b/code/application/source/sf_app/Makefile index 2f41d68e4..dec284432 100755 --- a/code/application/source/sf_app/Makefile +++ b/code/application/source/sf_app/Makefile @@ -194,6 +194,10 @@ EXTRA_LIB += \ -l:libFtpManager.a \ -l:libServers.a \ -l:libLog.a \ + -l:libAtManager.a \ + -l:libAtCommand.a \ + -l:libReturnCode.a \ + -l:libConfig.a \ $(APP_DIR)/sifarsdk/out/libs/libcurl.a \ $(APP_DIR)/sifarsdk/out/libs/libssl.a \ $(APP_DIR)/sifarsdk/out/libs/libcrypto.a \ diff --git a/code/application/source/sf_app/build/DownloadCLI-EG915Q b/code/application/source/sf_app/build/DownloadCLI-EG915Q new file mode 100755 index 000000000..a8743837f Binary files /dev/null and b/code/application/source/sf_app/build/DownloadCLI-EG915Q differ diff --git a/code/application/source/sf_app/build/quectel-CM-EG91 b/code/application/source/sf_app/build/quectel-CM-EG91 new file mode 100755 index 000000000..5675721e4 Binary files /dev/null and b/code/application/source/sf_app/build/quectel-CM-EG91 differ diff --git a/code/application/source/sf_app/build/quectel-CM-EG915Q b/code/application/source/sf_app/build/quectel-CM-EG915Q new file mode 100755 index 000000000..72c20f7f0 Binary files /dev/null and b/code/application/source/sf_app/build/quectel-CM-EG915Q differ 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 f255fa4ab..bbf75a5b0 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 @@ -281,7 +281,7 @@ UINT8 sf_get_netsearch_step(void); SINT32 sf_get_utc(VOID); -SINT32 sf_get_ntp(SINT32 value); +SINT32 sf_get_ntp(SINT32 value, SF_PARA_TIME_S *current_time); UINT8 sf_get_pdp_index(void); 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 c0e587f81..bc819bb94 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 @@ -24,6 +24,7 @@ extern "C" { #include "sf_service.h" #include "sf_ftp.h" #include "sf_module.h" +#include "at_manager.h" #define APNGPRS_WUYUAN1 "America.bics" #define APNGPRS_WUYUAN2 "bicsapn" @@ -42,7 +43,7 @@ BOOL GprsNetWorkReady = FALSE; UINT8 gprs_search_process = GPRS_SEARCH_STEP_IDLE; extern SF_PARA_TIME_S rtcTime; -SF_PARA_TIME_S nowDate = { 0, 0, 0, 0, 0, 0}; +// SF_PARA_TIME_S nowDate = { 0, 0, 0, 0, 0, 0}; typedef struct sf_cimi_id { @@ -596,7 +597,7 @@ SINT32 eg91_usb_net_apn_cfg(SF_FN_PARAM_S *pfnParam) } break; case USBNET_APN_QICSGP2: - if(strstr(gsmPara, "OK")) + if(strstr(gsmPara, "OK")) // TODO: ?? what happend. { count = 0; sts = 0; @@ -2445,7 +2446,13 @@ SINT32 sf_module_complete_init(void) } strcpy((char *)puiPara->ModuleVer, (const char *)strtmp[1]); - SF_DEBUG("ModuleVer=%s", puiPara->ModuleVer); + SF_DEBUG("ModuleVer=%s", puiPara->ModuleVer); + if(strstr(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q)){ + at_manager_init(AT_MODULE_TYPE_EG915Q, sf_hal_ttyusb2_read, sf_hal_ttyusb2_write); + } + else{ + at_manager_init(AT_MODULE_TYPE_EG91, sf_hal_ttyusb2_read, sf_hal_ttyusb2_write); + } eNetRegLocation = QUECTEL_NETREG_QGMR; strcpy((char *)gsmPara, "AT+QGMR\r"); @@ -4549,7 +4556,7 @@ SINT32 sf_get_utc(VOID) Return: 0 SUCCESS, 1 error Others: N/A *************************************************/ -SINT32 sf_get_ntp(SINT32 value) +SINT32 sf_get_ntp(SINT32 value, SF_PARA_TIME_S *current_time) { SINT32 ret = SF_SUCCESS; //UINT8 errMsg[128] = {0}; @@ -4577,6 +4584,7 @@ SINT32 sf_get_ntp(SINT32 value) while(sf_app_while_flag()) { + printf("================================================================== \n"); switch(eSmsLocation) { case SMS_SIM_INIT_CNTP: @@ -4633,14 +4641,16 @@ SINT32 sf_get_ntp(SINT32 value) calltime = 0; printf("[%s:%d]UTC: %04d/%02d/%02d %02d:%02d:%02d\n", __FUNCTION__, __LINE__, year, month, day, hour, minute, second); + if (current_time) + { + current_time->Year = year; + current_time->Mon = month; + current_time->Day = day; - nowDate.Year = year; - nowDate.Mon = month; - nowDate.Day = day; - - nowDate.Hour = hour; - nowDate.Min = minute; - nowDate.Sec = second; + current_time->Hour = hour; + current_time->Min = minute; + current_time->Sec = second; + } //getUtcTimeFlag = 1; rtcTime.Year = year; 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 dfbf6f8ea..6ad5492db 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 @@ -52,6 +52,7 @@ #include "sf_wifi_svr.h" #include "sf_battery.h" #include "ftp_manager.h" +#include "Log.h" //#include //#include //#include @@ -119,12 +120,16 @@ int main(int argc, char *argv[]) sf_app_mcu_para_start(); + InitLog(LOG_EASYLOGGING, NULL); + isUsb = sf_usb_IsInsert(); isCard = sf_in_card_exist(); isUpdate = sf_in_update(); sf_set_fw_update(isUpdate); + printf("[%s:%d] isUsb = %d isCard = %d isUpdate:%d\n", __FUNCTION__, __LINE__, isUsb,isCard,isUpdate); + if(!isUsb) { sf_app_load_ko_start(); 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 ac48d2e56..d470a3ee1 100755 --- a/code/application/source/sf_app/code/source/app/sf_device.c +++ b/code/application/source/sf_app/code/source/app/sf_device.c @@ -612,7 +612,7 @@ BOOL sf_load_ko(void) if(driver_path){ snprintf(cmd, sizeof(cmd), "insmod %s/%s", driver_path_prefix, driver_path); - //MLOGI("[%s:%d] %s\n", __FUNCTION__, __LINE__, cmd); + // MLOGI("[%s:%d] %s\n", __FUNCTION__, __LINE__, cmd); ret = system(cmd); if(0 != ret) { 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 f2026fcbf..fd5bdc508 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 @@ -53,6 +53,8 @@ #include "sf_service.h" #include "sf_sms.h" #include "sf_system.h" +#include "at_manager.h" +#include "Log.h" #ifdef __cplusplus @@ -1293,10 +1295,23 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) { break; #endif - s32ret = sf_get_utc(); if ((s32ret == SF_SIM_ERROR_UTC) || (SF_ON == pCustomerParam->GpsSwitch)) { - s32ret = sf_get_ntp(s32ret); + SF_PARA_TIME_S current_time = { 0, 0, 0, 0, 0, 0}; + s32ret = sf_get_ntp(s32ret, ¤t_time); + #define NTP_TIME_LENGTH 32 + char ntp_time[NTP_TIME_LENGTH] = {0}; + snprintf(ntp_time, NTP_TIME_LENGTH, "%04d/%02d/%02d,%02d:%02d:%02d", + current_time.Year, current_time.Mon, current_time.Day, + current_time.Hour, current_time.Min, current_time.Sec); + gps_map_update(pCustomerParam->Sim4gApn, pCustomerParam->Sim4gUsr, pCustomerParam->Sim4gPwd, ntp_time); + gps_open(ntp_time); + //while(1) + //{ + //GpsLocation location = gps_get_location(); + //LogInfo("location.latitude = %s\n", location.latitude); + //LogInfo("location.longitude = %s\n", location.longitude); + //} } sf_4G_usb_net_apn_cfg(pfnParam); @@ -1423,7 +1438,8 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) { s32ret = sf_get_utc(); if ((s32ret == SF_SIM_ERROR_UTC) || (SF_ON == pCustomerParam->GpsSwitch)) { - s32ret = sf_get_ntp(s32ret); + SF_PARA_TIME_S current_time = { 0, 0, 0, 0, 0, 0}; + s32ret = sf_get_ntp(s32ret, ¤t_time); } if (1 == pCustomerParam->NeedTimeSyncStartUp) { printf("[%s:%d]8 between A and B,no reg net again,no reset time sync.\n", @@ -1466,7 +1482,8 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) { s32ret = sf_get_utc(); if ((s32ret == SF_SIM_ERROR_UTC) || (SF_ON == pCustomerParam->GpsSwitch)) { - s32ret = sf_get_ntp(s32ret); + SF_PARA_TIME_S current_time = { 0, 0, 0, 0, 0, 0}; + s32ret = sf_get_ntp(s32ret, ¤t_time); } if (0 != sf_get_cq_signal()) { pCustomerParam->GpsSendFlag = 1;