コード例 #1
0
ファイル: postpos.c プロジェクト: wolfgangr/rtklib
/* close procssing session ---------------------------------------------------*/
static void closeses(pcvs_t *pcvs, pcvs_t *pcvr)
{
    trace(3,"closeses:\n");
    
    /* free antenna parameters */
    free(pcvs->pcv); pcvs->pcv=NULL; pcvs->n=pcvs->nmax=0;
    free(pcvr->pcv); pcvr->pcv=NULL; pcvr->n=pcvr->nmax=0;
    
    /* close geoid data */
    closegeoid();
    
    /* close solution statistics and debug trace */
    rtkclosestat();
    traceclose();
}
コード例 #2
0
ファイル: rtkrcv.cpp プロジェクト: Fraunhofer-IIS/gnss
}

void stop_rtkrcv() {
    /* stop rtk server */
    stopsvr(&svr_vt);

    if (moniport>0) closemoni();

    if (outstat>0) rtkclosestat();

    if (rcv_trace>0) traceclose();

    /* save navigation data */
    if (!savenav(NAVIFILE,&svr.nav)) {
        fprintf(stderr,"navigation data save error: %s\n",NAVIFILE);
コード例 #3
0
ファイル: rtkserver.c プロジェクト: ampimis/RtkGps
static void RtkServer__stop(JNIEnv* env, jclass thiz, jobjectArray j_cmds)
{
   unsigned i;
   struct native_ctx_t *nctx;
   const char *cmds[3]={NULL, NULL, NULL};
   jstring cmds_jstring[3]={NULL, NULL, NULL};

   LOGV("RtkServer__stop()");

   nctx = (struct native_ctx_t *)(uintptr_t)(*env)->GetLongField(env, thiz, m_object_field);
   if (nctx == NULL) {
      LOGV("nctx is null");
      return;
   }

   for (i=0; i<sizeof(cmds)/sizeof(cmds[0]); ++i) {
      cmds_jstring[i] = (*env)->GetObjectArrayElement(env, j_cmds, i);
      if ((*env)->ExceptionOccurred(env))
	 goto rtksvrstop_close;
      if (cmds_jstring[i] != NULL) {
	 cmds[i] = (*env)->GetStringUTFChars(env, cmds_jstring[i], NULL);
	 if (cmds[i] == NULL)
	    goto rtksvrstop_close;
      }
   }

rtksvrstop_close:

   rtksvrstop(&nctx->rtksvr,(char **)cmds);

   traceclose();
   rtkclosestat();

   for (i=0; i<sizeof(cmds)/sizeof(cmds[0]); ++i) {
      if (cmds[i] != NULL)
	 (*env)->ReleaseStringUTFChars(env, cmds_jstring[i], cmds[i]);
   }

}
コード例 #4
0
ファイル: postpos.c プロジェクト: idaohang/rtk-streamserver
/* execute processing session ------------------------------------------------*/
static int execses(gtime_t ts, gtime_t te, double ti, const prcopt_t *popt,
                   const solopt_t *sopt, const filopt_t *fopt, int flag,
                   char **infile, const int *index, int n, char *outfile)
{
    FILE *fp;
    prcopt_t popt_=*popt;
    char tracefile[1024],statfile[1024];
    
    trace(3,"execses : n=%d outfile=%s\n",n,outfile);
    
    /* open debug trace */
    if (flag&&sopt->trace>0) {
        if (*outfile) {
            strcpy(tracefile,outfile);
            strcat(tracefile,".trace");
        }
        else {
            strcpy(tracefile,fopt->trace);
        }
        traceclose();
        traceopen(tracefile);
        tracelevel(sopt->trace);
    }
    /* read obs and nav data */
    if (!readobsnav(ts,te,ti,infile,index,n,&popt_,&obss,&navs,stas)) return 0;
    
    /* set antenna paramters */
    if (popt_.sateph==EPHOPT_PREC||popt_.sateph==EPHOPT_SSRCOM) {
        setpcv(obss.n>0?obss.data[0].time:timeget(),&popt_,&navs,&pcvss,&pcvsr,
               stas);
    }
    /* read ocean tide loading parameters */
    if (popt_.mode>PMODE_SINGLE&&fopt->blq) {
        readotl(&popt_,fopt->blq,stas);
    }
    /* rover/reference fixed position */
    if (popt_.mode==PMODE_FIXED) {
        if (!antpos(&popt_,1,&obss,&navs,stas,fopt->stapos)) {
            freeobsnav(&obss,&navs);
            return 0;
        }
    }
    else if (PMODE_DGPS<=popt_.mode&&popt_.mode<=PMODE_STATIC) {
        if (!antpos(&popt_,2,&obss,&navs,stas,fopt->stapos)) {
            freeobsnav(&obss,&navs);
            return 0;
        }
    }
    /* open solution statistics */
    if (flag&&sopt->sstat>0) {
        strcpy(statfile,outfile);
        strcat(statfile,".stat");
        rtkclosestat();
        rtkopenstat(statfile,sopt->sstat);
    }
    /* write header to output file */
    if (flag&&!outhead(outfile,infile,n,&popt_,sopt)) {
        freeobsnav(&obss,&navs);
        return 0;
    }
    iobsu=iobsr=isbs=ilex=revs=aborts=0;
    
    if (popt_.mode==PMODE_SINGLE||popt_.soltype==0) {
        if ((fp=openfile(outfile))) {
            procpos(fp,&popt_,sopt,0); /* forward */
            fclose(fp);
        }
    }
    else if (popt_.soltype==1) {
        if ((fp=openfile(outfile))) {
            revs=1; iobsu=iobsr=obss.n-1; isbs=sbss.n-1; ilex=lexs.n-1;
            procpos(fp,&popt_,sopt,0); /* backward */
            fclose(fp);
        }
    }
    else { /* combined */
        solf=(sol_t *)malloc(sizeof(sol_t)*nepoch);
        solb=(sol_t *)malloc(sizeof(sol_t)*nepoch);
        rbf=(double *)malloc(sizeof(double)*nepoch*3);
        rbb=(double *)malloc(sizeof(double)*nepoch*3);
        
        if (solf&&solb) {
            isolf=isolb=0;
            procpos(NULL,&popt_,sopt,1); /* forward */
            revs=1; iobsu=iobsr=obss.n-1; isbs=sbss.n-1; ilex=lexs.n-1;
            procpos(NULL,&popt_,sopt,1); /* backward */
            
            /* combine forward/backward solutions */
            if (!aborts&&(fp=openfile(outfile))) {
                combres(fp,&popt_,sopt);
                fclose(fp);
            }
        }
        else showmsg("error : memory allocation");
        free(solf);
        free(solb);
        free(rbf);
        free(rbb);
    }
    /* free obs and nav data */
    freeobsnav(&obss,&navs);
    
    return aborts?1:0;
}
コード例 #5
0
ファイル: rtkserver.c プロジェクト: ampimis/RtkGps
static jboolean RtkServer__rtksvrstart(JNIEnv* env, jclass thiz,
      jint j_cycle,
      jint j_buffsize,
      jintArray j_strs,
      jobjectArray j_paths,
      jintArray j_format,
      jint j_navsel,
      jobjectArray j_cmds,
      jobjectArray j_rcvopts,
      jint j_nmea_cycle,
      jint j_nmea_req,
      jdoubleArray j_nmeapos,
      jobject j_procopt,
      jobject j_solopt1,
      jobject j_solopt2
      ) {

   struct native_ctx_t *nctx;
   int i;
   jobject obj;
   jboolean res;

   /* Input stream types */
   int strs[8];
   /* input stream paths */
   const char *paths[8] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL };
   jstring paths_jstring[8] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL };
   /* input stream formats (STRFMT_???) */
   int format[3];
   /* input stream start commands */
   const char *cmds[3] = {NULL, NULL, NULL};
   jstring cmds_jstring[3] = {NULL, NULL, NULL};
   /* receiver options */
   const char *rcvopts[3] = {NULL, NULL, NULL};
   char *rcvopts_jstring[3] = {NULL, NULL, NULL};
   /* rtk processing options */
   prcopt_t prcopt;
   /* solution options */
   solopt_t solopt[2];
   /* nmea position */
   double nmeapos[3];

   res = JNI_FALSE;
   for (i=0; i<sizeof(paths)/sizeof(paths[0]); ++i) {
      paths_jstring[i] = (*env)->GetObjectArrayElement(env, j_paths, i);
      if ((*env)->ExceptionOccurred(env))
	 goto rtksvrstart_end;
      if (paths_jstring[i] != NULL) {
	 paths[i] = (*env)->GetStringUTFChars(env, paths_jstring[i], NULL);
	 if (paths[i] == NULL)
	    goto rtksvrstart_end;
      }
   }
   for (i=0; i<sizeof(cmds)/sizeof(cmds[0]); ++i) {
      cmds_jstring[i] = (*env)->GetObjectArrayElement(env, j_cmds, i);
      if ((*env)->ExceptionOccurred(env))
	 goto rtksvrstart_end;
      if (cmds_jstring[i] != NULL) {
	 cmds[i] = (*env)->GetStringUTFChars(env, cmds_jstring[i], NULL);
	 if (cmds[i] == NULL)
	    goto rtksvrstart_end;
      }
   }
   for (i=0; i<sizeof(rcvopts)/sizeof(rcvopts[0]); ++i) {
      rcvopts_jstring[i] = (*env)->GetObjectArrayElement(env, j_rcvopts, i);
      if ((*env)->ExceptionOccurred(env))
	 goto rtksvrstart_end;
      if (rcvopts_jstring[i] != NULL) {
	 rcvopts[i] = (*env)->GetStringUTFChars(env, rcvopts_jstring[i], NULL);
	 if (rcvopts[i] == NULL)
	    goto rtksvrstart_end;
      }
   }

   (*env)->GetIntArrayRegion(env, j_strs, 0,
	 sizeof(strs)/sizeof(strs[0]), strs);
   if ((*env)->ExceptionOccurred(env))
      goto rtksvrstart_end;

   (*env)->GetIntArrayRegion(env, j_format, 0,
	 sizeof(format)/sizeof(format[0]), format);
   if ((*env)->ExceptionOccurred(env))
      goto rtksvrstart_end;

   (*env)->GetDoubleArrayRegion(env, j_nmeapos, 0,
	 sizeof(nmeapos)/sizeof(nmeapos[0]), nmeapos);
   if ((*env)->ExceptionOccurred(env))
      goto rtksvrstart_end;

   solution_options2solopt_t(env, j_solopt1, &solopt[0]);
   solution_options2solopt_t(env, j_solopt2, &solopt[1]);

   nctx = (struct native_ctx_t *)(uintptr_t)(*env)->GetLongField(env, thiz, m_object_field);
   if (nctx == NULL) {
      LOGV("nctx is null");
      goto rtksvrstart_end;
   }

   {
      /* Open trace / solution files */
      gtime_t now;
      now = timeget();
      if (solopt[0].trace > 0)
	 open_trace_file(env, solopt[0].trace, now);

      /* treat processing options only now for having trace */
      processing_options2prcopt_t(env, j_procopt, &prcopt);

      if (solopt[0].sstat > 0)
	 open_solution_status_file(env, solopt[0].sstat, now);
   }

   if ((*env)->ExceptionOccurred(env))
      goto rtksvrstart_end;

    char errmsg[2048]="";                       //  Modif Mathieu Peyréga : adapt to new 2.4.3b26 API
    char *cmds_periodic[]={NULL,NULL,NULL};     //  Modif Mathieu Peyréga : adapt to new 2.4.3b26 API

   if (!rtksvrstart(
	    &nctx->rtksvr,
	    /* SvrCycle ms */ j_cycle,
	    /* SvrBuffSize */ j_buffsize,
	    /* stream types */ strs,
	    /* paths */ (char **)paths,
	    /* input stream format */ format,
	    /* NavSelect */ j_navsel,
	    /* input stream start commands */ (char **)cmds,
        /* input stream periodic  commands */ (char **)cmds_periodic,   //  Modif Mathieu Peyréga : adapt to new 2.4.3b26 API
	    /* receiver options */ (char **)rcvopts,
	    /* nmea request cycle ms */ j_nmea_cycle,
	    /* nmea request type */ j_nmea_req,
	    /* transmitted nmea position  */ nmeapos,
	    /* rtk processing options */&prcopt,
	    /* solution options */ solopt,
	    /* monitor stream */ &nctx->monistr,
        /* err */errmsg                                                  //  Modif Mathieu Peyréga : adapt to new 2.4.3b26 API
	    )) {
   }else {
      res = JNI_TRUE;
   }

rtksvrstart_end:

   for (i=0; i<sizeof(paths)/sizeof(paths[0]); ++i) {
      if (paths[i] != NULL)
	 (*env)->ReleaseStringUTFChars(env, paths_jstring[i], paths[i]);
   }
   for (i=0; i<sizeof(cmds)/sizeof(cmds[0]); ++i) {
      if (cmds[i] != NULL)
	 (*env)->ReleaseStringUTFChars(env, cmds_jstring[i], cmds[i]);
   }
   for (i=0; i<sizeof(rcvopts)/sizeof(rcvopts[0]); ++i) {
      if (rcvopts[i] != NULL)
	 (*env)->ReleaseStringUTFChars(env, rcvopts_jstring[i], rcvopts[i]);
   }

   if (!res) {
      traceclose();
      rtkclosestat();
   }

   return res;
}