// // Created by Wakanda_shaw on 2022/5/16. // #include "main_window.h" #include "string" #include "QDateTime" #include "rtklib.h" /* ---------------------------------------------------- * read log file and convert to Obs and Nav * args : QString & path I inputs log path * : QString & Obspath IO Obspath * : QString & Navpath IO Navpath * return : status(1:ok,0:fail) * ---------------------------------------------------*/ using namespace std; int main_window::Read_Log(const QString& path, QString &Obspath, QString &Navpath) { QFileInfo fileinfo; fileinfo = QFileInfo(path); const char *abs_log_path; const char * log_path; const char *filename; const char *birth_time; string temp_birth_time = fileinfo.birthTime().toUTC().toString("yyyy MM dd hh mm ss").toStdString(); //得到文件创建时间 string temp_log_path = path.toStdString(); string temp_abs_log_path = fileinfo.absolutePath().toStdString(); string temp_filename = fileinfo.baseName().toStdString(); /* log文件路径 */ log_path = temp_log_path.c_str(); /* log文件的绝对路径(不包含文件名)*/ abs_log_path = temp_abs_log_path.c_str(); /* log文件名 */ filename = temp_filename.c_str(); /* appro start log time */ birth_time = temp_birth_time.c_str(); gtime_t trtcm={0}; str2time(birth_time,0,20,&trtcm); char *ofile[9]; for(int i=0;i<9;i++){ ofile[i] = (char*)malloc(sizeof(char) * 1024); strcpy(ofile[i], ""); } /* 输出obs的路径 */ strcpy(ofile[0], abs_log_path); strcat(ofile[0], "/"); strcat(ofile[0], filename); strcat(ofile[0], ".obs"); /* 输出nav的路径 */ strcpy(ofile[1], abs_log_path); strcat(ofile[1], "/"); strcat(ofile[1], filename); strcat(ofile[1], ".nav"); /* opt参数设置 */ rnxopt_t opt = {0}; opt.tint = 0.00; opt.tunit = 86400; opt.rnxver = 304; opt.navsys = SYS_GPS|SYS_CMP|SYS_GAL|SYS_QZS; opt.obstype = OBSTYPE_ALL; opt.freqtype = FREQTYPE_ALL; opt.outiono = 1; opt.outtime = 1; opt.trtcm = trtcm; if (convrnx(STRFMT_RTCM3, &opt, log_path, ofile)) { Obspath = ofile[0]; Navpath = ofile[1]; printf("\nconvet success !\n"); return 1; } return 0; }