static void Loc_cbInfo( LocState *pts ) { if( pts->theInfo.status == AEEGPS_ERR_NO_ERR || (pts->theInfo.status == AEEGPS_ERR_INFO_UNAVAIL && pts->theInfo.fValid) ) { #if MIN_BREW_VERSION(2,1) pts->pResp->lat = WGS84_TO_DEGREES( pts->theInfo.dwLat ); #ifdef AEE_SIMULATOR //FOR TEST pts->pResp->lon = -WGS84_TO_DEGREES( pts->theInfo.dwLon ); #else pts->pResp->lon = WGS84_TO_DEGREES( pts->theInfo.dwLon ); #endif #else double wgsFactor; wgsFactor = FASSIGN_STR("186413.5111"); pts->pResp->lat = FASSIGN_INT(pts->theInfo.dwLat); pts->pResp->lat = FDIV(pts->pResp->lat, wgsFactor); pts->pResp->lon = FASSIGN_INT(pts->theInfo.dwLon); pts->pResp->lon = FDIV(pts->pResp->lon, wgsFactor); #endif /* MIN_BREW_VERSION 2.1 */ pts->pResp->height = pts->theInfo.wAltitude - 500; pts->pResp->velocityHor = FMUL( pts->theInfo.wVelocityHor,0.25); //当前夹角 if (FCMP_G(FABS(pts->lastCoordinate.lat), 0)) { pts->pResp->heading = Loc_Calc_Azimuth(pts->lastCoordinate.lat, pts->lastCoordinate.lon, pts->pResp->lat, pts->pResp->lon); } else { pts->pResp->heading = 0; } //For Test Hack #ifdef AEE_SIMULATOR pts->pResp->lat = 38.0422378880; pts->pResp->lon = 114.4925141047; #endif if (pts->pResp->bSetDestPos) { //计算距离和方位角 pts->pResp->distance = Loc_Calc_Distance(pts->pResp->lat, pts->pResp->lon, pts->pResp->destPos.lat, pts->pResp->destPos.lon); pts->pResp->destHeading = Loc_Calc_Azimuth(pts->pResp->lat, pts->pResp->lon, pts->pResp->destPos.lat, pts->pResp->destPos.lon); } //记录历史定位信息 pts->lastCoordinate.lat = pts->pResp->lat; pts->lastCoordinate.lon = pts->pResp->lon; pts->pResp->dwFixNum++; pts->pResp->nErr = SUCCESS; Loc_Notify( pts ); if( FALSE == pts->bSetForCancellation ) { ISHELL_SetTimerEx( pts->pShell, pts->nLocInterval * 1000, &pts->cbIntervalTimer ); } else { Loc_Stop( pts ); } } }
static void Track_cbInfo( TrackState *pts ) { if( pts->theInfo.status == AEEGPS_ERR_NO_ERR || (pts->theInfo.status == AEEGPS_ERR_INFO_UNAVAIL && pts->theInfo.fValid) ) { #if MIN_BREW_VERSION(2,1) pts->pResp->lat = WGS84_TO_DEGREES( pts->theInfo.dwLat ); pts->pResp->lon = WGS84_TO_DEGREES( pts->theInfo.dwLon ); #else double wgsFactor; wgsFactor = FASSIGN_STR("186413.5111"); pts->pResp->lat = FASSIGN_INT(pts->theInfo.dwLat); pts->pResp->lat = FDIV(pts->pResp->lat, wgsFactor); pts->pResp->lon = FASSIGN_INT(pts->theInfo.dwLon); pts->pResp->lon = FDIV(pts->pResp->lon, wgsFactor); #endif /* MIN_BREW_VERSION 2.1 */ pts->pResp->height = pts->theInfo.wAltitude - 500; pts->pResp->wAzimuth = pts->orientInfo.wAzimuth; pts->pResp->heading = pts->theInfo.wHeading; pts->pResp->velocityHor = FMUL( pts->theInfo.wVelocityHor,0.25); pts->pResp->dwFixNum++; pts->pResp->nErr = SUCCESS; Track_Notify( pts ); if( (!pts->nPendingFixes || --pts->nPendingFixes > 0) && FALSE == pts->bSetForCancellation ) { if( pts->bModeAuto && pts->bModeLocal == FALSE ) { /* Try with local first */ Track_Local( pts ); } ISHELL_SetTimerEx( pts->pShell, pts->nTrackInterval * 1000, &pts->cbIntervalTimer ); } else { Track_Stop( pts ); } } else { if( pts->bModeAuto && pts->bModeLocal ) { /* Retry with TRACK_NETWORK */ Track_Network( pts ); Track_cbInterval( pts ); } else { DBGPRINTF("@Track_cbInfo status:%u", pts->theInfo.status); /* Inform the application of failure code. */ pts->pResp->nErr = pts->theInfo.status; Track_Notify( pts ); /* On timeout re-try. For other reasons bailout. */ if( pts->theInfo.status == AEEGPS_ERR_TIMEOUT ) { Track_cbInterval( pts ); } else { Track_Stop( pts ); } } } }