{
int32_t i = 0;
int32_t timeout_count = 0; // 连续超时计数器
- char temp_buf[512] = {0};
+ // char temp_buf[512] = {0};
// 初始化GNSS服务缓冲区
if (init_gnss_service_buffer() != 0) {
{
if (decode_nmea(pbuf[index])==1)
{
- dump_location_data(&g_global_gpsData);
- memset_s(temp_buf,sizeof(temp_buf),0,sizeof(temp_buf));
+ // dump_location_data(&g_global_gpsData);
+ // memset_s(temp_buf,sizeof(temp_buf),0,sizeof(temp_buf));
// char *temp_buf = (char *)malloc(512);
// if (temp_buf == NULL) {
// printf("error: malloc temp_buf failed!\n");
// continue;
// }
- dump_location_data_to_buf(&g_global_gpsData, temp_buf, 512);
+ // dump_location_data_to_buf(&g_global_gpsData, temp_buf, 512);
// printf("temp_buf : %s\n",temp_buf);
// 追加到pgnss_log中
- if (pgnss_log != NULL) {
- int current_len = strlen(pgnss_log);
- int data_len = strlen(temp_buf);
- if (current_len + data_len < 2047) { // 留1字节给字符串结束符
- snprintf(pgnss_log + current_len, 2048 - current_len, "%s", temp_buf);
- } else {
- // 内存满了,清空从头开始存储
- printf("pgnss_log memory full, clearing and restarting\n");
- memset(pgnss_log, 0, 2048);
- snprintf(pgnss_log, 2048, "%s", temp_buf);
- }
- }
+ // if (pgnss_log != NULL) {
+ // int current_len = strlen(pgnss_log);
+ // int data_len = strlen(temp_buf);
+ // if (current_len + data_len < 2047) { // 留1字节给字符串结束符
+ // snprintf(pgnss_log + current_len, 2048 - current_len, "%s", temp_buf);
+ // } else {
+ // // 内存满了,清空从头开始存储
+ // printf("pgnss_log memory full, clearing and restarting\n");
+ // memset(pgnss_log, 0, 2048);
+ // snprintf(pgnss_log, 2048, "%s", temp_buf);
+ // }
+ // }
// printf("decode_nmea done\r\n");
// free(temp_buf);
g_is_pgnss_poweron = 0;
g_is_pgnss_start = 0;
g_pgnss_stopflag = 1;
- if (pgnss_log != NULL) {
- free(pgnss_log);
- pgnss_log = NULL;
- }
+ // if (pgnss_log != NULL) {
+ // free(pgnss_log);
+ // pgnss_log = NULL;
+ // }
return;
}
g_gnssLogFp = fopen("/user/userdata/gnsslog.txt", "w");
if (g_gnssLogFp == NULL) {
printf("error: open log file error\n");
- if (pgnss_log != NULL) {
- free(pgnss_log);
- pgnss_log = NULL;
- }
+ // if (pgnss_log != NULL) {
+ // free(pgnss_log);
+ // pgnss_log = NULL;
+ // }
return;
}
// 写入日志开启时间戳
g_is_pgnss_poweron = 0;
g_is_pgnss_start = 0;
g_pgnss_stopflag = 1;
- if (pgnss_log != NULL) {
- free(pgnss_log);
- pgnss_log = NULL;
- }
+ // if (pgnss_log != NULL) {
+ // free(pgnss_log);
+ // pgnss_log = NULL;
+ // }
return;
}
printf("open tiot service success for auto start\n");
// 释放pgnss_log内存
- if (pgnss_log != NULL) {
- printf("gnss_log: %s\r\n", pgnss_log);
- free(pgnss_log);
- pgnss_log = NULL;
- }
+ // if (pgnss_log != NULL) {
+ // printf("gnss_log: %s\r\n", pgnss_log);
+ // free(pgnss_log);
+ // pgnss_log = NULL;
+ // }
}
// 辅助函数:检查指定文件夹的文件数量
printf("\nenter gnss samples\r\n");
- if (pgnss_log == NULL)
- {
- pgnss_log = (char *)malloc(2048);
- if (pgnss_log == NULL) {
- printf("error: malloc pgnss_log failed!\n");
- return;
- }
- memset(pgnss_log, 0, 2048);
- }
+ // if (pgnss_log == NULL)
+ // {
+ // pgnss_log = (char *)malloc(2048);
+ // if (pgnss_log == NULL) {
+ // printf("error: malloc pgnss_log failed!\n");
+ // return;
+ // }
+ // memset(pgnss_log, 0, 2048);
+ // }
uapi_pm_add_sleep_veto(PM_ID_SYS);
g_is_pgnss_poweron = 0;
g_is_pgnss_start = 0;
g_pgnss_stopflag = 1;
- if (pgnss_log != NULL) {
- free(pgnss_log);
- pgnss_log = NULL;
- }
+ // if (pgnss_log != NULL) {
+ // free(pgnss_log);
+ // pgnss_log = NULL;
+ // }
return;
}
g_gnssLogFp = fopen("/user/userdata/gnsslog.txt", "w");
if (g_gnssLogFp == NULL) {
printf("error: open log file error\n");
- if (pgnss_log != NULL) {
- free(pgnss_log);
- pgnss_log = NULL;
- }
+ // if (pgnss_log != NULL) {
+ // free(pgnss_log);
+ // pgnss_log = NULL;
+ // }
return;
}
// 写入日志开启时间戳
g_is_pgnss_start = 0;
g_pgnss_stopflag = 1;
g_cold_start_pgnss_stopflag = 1;
- if (pgnss_log != NULL) {
- free(pgnss_log);
- pgnss_log = NULL;
- }
+ // if (pgnss_log != NULL) {
+ // free(pgnss_log);
+ // pgnss_log = NULL;
+ // }
return;
}
printf("open tiot service success\r\n");
// 释放pgnss_log内存
- if (pgnss_log != NULL) {
- printf("pgnss_log:%s\r\n",pgnss_log);
- free(pgnss_log);
- pgnss_log = NULL;
- }
+ // if (pgnss_log != NULL) {
+ // printf("pgnss_log:%s\r\n",pgnss_log);
+ // free(pgnss_log);
+ // pgnss_log = NULL;
+ // }
if(g_cold_start_pgnss_stopflag == 1)
{
PGnssServerStartAutoModeStart();