/*=========================================================================== ===========================================================================*/ static void SamplePosDet_GetGPSInfo_Paint( CSamplePosDet *pMe, GetGPSInfo_PaintRegions rgn ) { struct _GetGPSInfo *pGetGPSInfo = SamplePosDet_GetScreenData( pMe ); if( rgn == GETGPSINFO_PAINT_ALL ) { IDISPLAY_ClearScreen( pMe->theApp.m_pIDisplay ); SamplePosDet_Printf( pMe, 0, 3, AEE_FONT_BOLD, IDF_ALIGN_LEFT, "GetGPSInfo" ); if( pGetGPSInfo->wMainMenuEntry == MAINMENU_ITEM_ONE_SHOT ) { SamplePosDet_Printf( pMe, 0, 3, AEE_FONT_BOLD, IDF_ALIGN_RIGHT, "One Shot" ); } else if( pGetGPSInfo->wMainMenuEntry == MAINMENU_ITEM_TRACK_LOCAL ) { SamplePosDet_Printf( pMe, 0, 3, AEE_FONT_BOLD, IDF_ALIGN_RIGHT, "Track L" ); } else if( pGetGPSInfo->wMainMenuEntry == MAINMENU_ITEM_TRACK_NETWORK ) { SamplePosDet_Printf( pMe, 0, 3, AEE_FONT_BOLD, IDF_ALIGN_RIGHT, "Track N" ); } else if( pGetGPSInfo->wMainMenuEntry == MAINMENU_ITEM_TRACK_AUTO ) { SamplePosDet_Printf( pMe, 0, 3, AEE_FONT_BOLD, IDF_ALIGN_RIGHT, "Track A" ); } } if( rgn == GETGPSINFO_PAINT_FIXCOUNT || rgn == GETGPSINFO_PAINT_ALL ) { SamplePosDet_Printf( pMe, 1, 4, AEE_FONT_NORMAL, IDF_ALIGN_LEFT, "Failed : %d", pGetGPSInfo->dwFail+pGetGPSInfo->dwTimeout ); SamplePosDet_Printf( pMe, 1, 4, AEE_FONT_NORMAL, IDF_ALIGN_RIGHT, "Timeout : %d", pGetGPSInfo->dwTimeout ); } if( rgn == GETGPSINFO_PAINT_FIXDATA || rgn == GETGPSINFO_PAINT_ALL ) { #define MAXTEXTLEN 22 AECHAR wcText[MAXTEXTLEN]; char latlonStr[MAXTEXTLEN]; SamplePosDet_Printf( pMe, 2, 4, AEE_FONT_NORMAL, IDF_ALIGN_LEFT, "Fixes : %d", pGetGPSInfo->dwFixNumber ); FLOATTOWSTR( pGetGPSInfo->theInfo.lat, wcText, MAXTEXTLEN * sizeof(AECHAR) ); WSTR_TO_STR( wcText, latlonStr, MAXTEXTLEN ); SamplePosDet_Printf( pMe, 3, 4, AEE_FONT_BOLD, IDF_ALIGN_CENTER|IDF_RECT_FILL, "%s d", latlonStr ); FLOATTOWSTR( pGetGPSInfo->theInfo.lon, wcText, MAXTEXTLEN * sizeof(AECHAR) ); WSTR_TO_STR( wcText, latlonStr, MAXTEXTLEN ); SamplePosDet_Printf( pMe, 4, 4, AEE_FONT_BOLD, IDF_ALIGN_CENTER|IDF_RECT_FILL, "%s d", latlonStr ); SamplePosDet_Printf( pMe, 5, 4, AEE_FONT_BOLD, IDF_ALIGN_RIGHT|IDF_RECT_FILL, "%d m", pGetGPSInfo->theInfo.height ); { double fv; fv = FASSIGN_INT( pGetGPSInfo->dwFixDuration ); if( pGetGPSInfo->dwFixNumber ) { fv = FDIV(fv, pGetGPSInfo->dwFixNumber); } FLOATTOWSTR( fv, wcText, MAXTEXTLEN * sizeof(AECHAR) ); WSTR_TO_STR( wcText, latlonStr, MAXTEXTLEN ); SamplePosDet_Printf( pMe, 6, 4, AEE_FONT_BOLD, IDF_ALIGN_RIGHT|IDF_RECT_FILL, "Avg %ss", latlonStr ); } } if( rgn == GETGPSINFO_PAINT_ERROR ) { SamplePosDet_Printf( pMe, 7, 4, AEE_FONT_BOLD, IDF_ALIGN_BOTTOM|IDF_ALIGN_CENTER|IDF_TEXT_INVERTED, "ABORTED 0x%x", pGetGPSInfo->theInfo.nErr ); } if( rgn == GETGPSINFO_PAINT_FIXANIM || rgn == GETGPSINFO_PAINT_ALL ) { SamplePosDet_Printf( pMe, 7, 4, AEE_FONT_NORMAL, IDF_ALIGN_BOTTOM|IDF_ALIGN_CENTER|IDF_RECT_FILL, ".....%d.....", pGetGPSInfo->wProgress ); } //if (FABS(pGetGPSInfo->theInfo.lat) > 0) { Coordinate c1, c2; double dis = 0; char szDis[64]; AECHAR wcharbuf[32]; //shanghai 31.1774276, 121.5272106 c1.lat = 31.1774276; c1.lon = 121.5272106; //beijing 39.911954, 116.377817 c2.lat = 39.911954; c2.lon = 116.377817; //shenzhen 22.543847, 113.912316 //c1.lat = 22.543847; //c1.lon = 113.912316; c1.lat = pGetGPSInfo->theInfo.lat; c1.lon = pGetGPSInfo->theInfo.lon; dis = Track_Calc_Distance(c1.lat, c1.lon, c2.lat, c2.lon); MEMSET(szDis,0,sizeof(szDis)); FLOATTOWSTR(dis, wcharbuf, 32); WSTRTOSTR(wcharbuf,szDis, 64); DBGPRINTF("Track_cbOrientInfo dis:%s", szDis); SamplePosDet_Printf( pMe, 7, 4, AEE_FONT_BOLD, IDF_ALIGN_LEFT|IDF_RECT_FILL, "%s m", szDis ); } { uint16 d1 = 0; uint8 d2 = 0; d1 = ((uint16)(pGetGPSInfo->theInfo.wAzimuth & (~0x3f)))>>6; d2 = (uint8)(pGetGPSInfo->theInfo.wAzimuth & 0x3f); SamplePosDet_Printf( pMe, 8, 4, AEE_FONT_BOLD, IDF_ALIGN_LEFT|IDF_RECT_FILL, "Head %d.%d", d1, d2 ); SamplePosDet_Printf( pMe, 9, 4, AEE_FONT_BOLD, IDF_ALIGN_LEFT|IDF_RECT_FILL, "Heading %d", pGetGPSInfo->theInfo.heading); } }
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 ); } } } }