1.保存gps信息到sd卡;2.发送前检查sd卡

This commit is contained in:
payton 2023-08-30 18:42:34 +08:00
parent a9367b68c3
commit fdb1df4514
2 changed files with 93 additions and 8 deletions

View File

@ -63,7 +63,8 @@ SINT32 open_gps(const SINT32 utc);
int get_gps_location(void); int get_gps_location(void);
void keep_get_gps_location(const SF_GPS_PARAM param); void keep_get_gps_location(const SF_GPS_PARAM param);
void keep_seraching_gps_location(const int timeout_ms); void keep_seraching_gps_location(const int timeout_ms);
int sf_check_sd(void);
void sf_save_camera_gps_info(void);
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }

View File

@ -1129,6 +1129,11 @@ static SINT32 app_file_transfer(SF_FN_PARAM_S *pfnParam) {
SINT32 sf_cardv_file_to_app_send_thread(void) { SINT32 sf_cardv_file_to_app_send_thread(void) {
SINT32 s32ret = 0; SINT32 s32ret = 0;
SF_FN_PARAM_S stpfncallback = {0}; SF_FN_PARAM_S stpfncallback = {0};
if(SF_FAILURE == sf_check_sd())
{
MLOGE("ERROR sf_check_sd\n");
return SF_FAILURE;
}
stpfncallback.pstParam = sf_customer_param_get(); stpfncallback.pstParam = sf_customer_param_get();
stpfncallback.pstaticParam = sf_app_ui_para_get(); stpfncallback.pstaticParam = sf_app_ui_para_get();
// stpfncallback.pstaticParam = sf_statistics_param_get(); // stpfncallback.pstaticParam = sf_statistics_param_get();
@ -1165,6 +1170,12 @@ SINT32 sf_cardv_file_to_app_send_thread(void) {
SINT32 sf_file_send_auto(void) { SINT32 sf_file_send_auto(void) {
SINT32 s32ret = 0; SINT32 s32ret = 0;
SF_FN_PARAM_S stpfncallback = {0}; SF_FN_PARAM_S stpfncallback = {0};
if(SF_FAILURE == sf_check_sd())
{
MLOGE("ERROR sf_check_sd\n");
return SF_FAILURE;
}
stpfncallback.pstParam = sf_customer_param_get(); stpfncallback.pstParam = sf_customer_param_get();
stpfncallback.pstaticParam = sf_app_ui_para_get(); stpfncallback.pstaticParam = sf_app_ui_para_get();
// stpfncallback.pstaticParam = sf_statistics_param_get(); // stpfncallback.pstaticParam = sf_statistics_param_get();
@ -1433,9 +1444,15 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) {
s32ret = sf_4G_register_net_manual(pfnParam); s32ret = sf_4G_register_net_manual(pfnParam);
if (s32ret != SF_SUCCESS) { if (s32ret != SF_SUCCESS) {
sf_set_signal_ready_flag(TRUE); sf_set_signal_ready_flag(TRUE);
} }
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()) { if (0 != sf_get_cq_signal()) {
pCustomerParam->NeedTimeSyncStartUp = 1; pCustomerParam->NeedTimeSyncStartUp = 1;
} }
@ -1456,11 +1473,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam) {
if ((SF_ON == pCustomerParam->GpsSwitch)) { if ((SF_ON == pCustomerParam->GpsSwitch)) {
s32ret = open_gps(s32ret); s32ret = open_gps(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);
}
//sf_dailyReport_set(); //sf_dailyReport_set();
//sf_share_mem_customer_down(1); //sf_share_mem_customer_down(1);
@ -1821,6 +1834,7 @@ int get_gps_location(void)
strcpy(pCustomerParam->Latitude, location.latitude); strcpy(pCustomerParam->Latitude, location.latitude);
LogInfo("location.Longitude = %s\n", pCustomerParam->Longitude); LogInfo("location.Longitude = %s\n", pCustomerParam->Longitude);
LogInfo("location.Latitude = %s\n", pCustomerParam->Latitude); LogInfo("location.Latitude = %s\n", pCustomerParam->Latitude);
sf_save_camera_gps_info();
return GPS_GET_SUCCEED; return GPS_GET_SUCCEED;
} }
return GPS_GET_FAILED; return GPS_GET_FAILED;
@ -1889,6 +1903,76 @@ void serach_gps_onkey_start(void)
pthread_attr_destroy(&attr); pthread_attr_destroy(&attr);
} }
int sf_check_sd(void)
{
UINT8 i = 0;
int ret = SF_SUCCESS;
if (sf_sd_status_get() != SF_SD_OK) {
ret = SF_FAILURE;
for (i = 0; i < 20; i++) {
ret = sf_sd_status_get();
if (SF_SD_OK == ret) {
ret = SF_SUCCESS;
MLOGI("usb net ip up\r\n");
break;
} else {
sleep(1);
}
}
return ret;
}
return ret;
}
/*************************************************
Function: sf_save_camera_info
Description: save camera info to sd
Input: N/A
Output: N/A
Return: N/A
Others: N/A
*************************************************/
void sf_save_camera_gps_info(void)
{
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
char *temp = NULL;
int fd = 0;
printf("[%s:%d] s\n", __FUNCTION__, __LINE__);
//if(fristRun == 0)
// return;
//fristRun = 0;
temp = malloc(200);
if (temp == NULL) {
MLOGE("temp malloc err\n");
return;
}
memset(temp,'\0', 200);
sprintf(temp, "LATITUDE:%s\r\nLONGITUDE:%s\r\n", puiPara->Latitude, puiPara->Longitude);
printf("[%s:%d] \n%s\n", __FUNCTION__, __LINE__,temp);
if(access((char*)SF_CAMERA_GPS_INFO_FILENAME, F_OK) == 0)
{
system("rm -rf /mnt/sd/gps.txt");
system("sync");
printf("[%s:%d] rm\n", __FUNCTION__, __LINE__);
//FileSys_DeleteFile();
}
fd = open(SF_CAMERA_GPS_INFO_FILENAME, O_WRONLY | O_CREAT);
if(fd)
{
lseek(fd, 0, SEEK_END);
write(fd, temp, strlen(temp));
close(fd);
system("sync");
}
free(temp);
printf("[%s:%d] e\n", __FUNCTION__, __LINE__);
}
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }